This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch, nios2] don't set sh_entsize for PLT section

The nios2 BFD port is presently setting the sh_entsize ELF attribute for the PLT section to the size of the first PLT entry. However, this is incorrect; the nios2 ABI allows PLT entries of different sizes, and the ELF specification says that sh_entsize should be nonzero only if all entries are that size. Since BFD normally defaults this to zero, all that's needed is to delete the code that is erroneously setting sh_entsize.

This bug was found by a customer who was doing elfutils/libelf testing, but readelf on a simple "hello, world" program was sufficient to show the problem and verify the fix.

Patch committed after usual regression testing on nios2-linux-gnu target.


2013-06-22  Sandra Loosemore  <>

	* elf32-nios2.c (nios2_elf32_finish_dynamic_sections): Don't
	set sh_entsize for PLT section.
Index: bfd/elf32-nios2.c
RCS file: /cvs/src/src/bfd/elf32-nios2.c,v
retrieving revision 1.5
diff -u -p -r1.5 elf32-nios2.c
--- bfd/elf32-nios2.c	30 Mar 2013 10:14:15 -0000	1.5
+++ bfd/elf32-nios2.c	22 Jun 2013 19:50:28 -0000
@@ -3264,9 +3264,6 @@ nios2_elf32_finish_dynamic_sections (bfd
 	      nios2_elf32_install_imm16 (splt, 4, hiadj (corrected));
 	      nios2_elf32_install_imm16 (splt, 12, (corrected & 0xffff) + 4);
 	      nios2_elf32_install_imm16 (splt, 16, (corrected & 0xffff) + 8);
-	      elf_section_data (splt->output_section)->this_hdr.sh_entsize
-		= 24;
@@ -3292,9 +3289,6 @@ nios2_elf32_finish_dynamic_sections (bfd
 					 (got_address & 0xffff) + 4);
 	      nios2_elf32_install_imm16 (splt, res_size + 20,
 					 (got_address & 0xffff) + 8);
-	      elf_section_data (splt->output_section)->this_hdr.sh_entsize
-		= 28 + res_size;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]