[Bug ld/20117] New: GOT relocation changes another instruction
https://sourceware.org/bugzilla/show_bug.cgi?id=20117 Bug ID: 20117 Summary: GOT relocation changes another instruction Product: binutils Version: 2.25 Status: UNCONFIRMED Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: louis.granboulan.developer at gmail dot com Target Milestone: --- Created attachment 9278 --> https://sourceware.org/bugzilla/attachment.cgi?id=9278&action=edit Almost minimal example that triggers the bug Using the attached file, on a recent Debian (with gcc 4.9.2 as the default compiler), we can reproduce the bug with the following steps. echo 'long DEBUGLEVEL; int main(){return 66;}' > main.c gcc -m32 -c -o main.o main.c gcc -m32 -c -o bug-ld.o bug-ld.s gcc -m32 -o main main.o bug-ld.o The bug can be seen using objdump. objdump -d bug-ld.o | grep jmp returns 73: eb 8b jmp0 but objdump -d main | grep jmp 80482a6: ff 25 bc 96 04 08 jmp*0x80496bc 80482b0: ff 25 c0 96 04 08 jmp*0x80496c0 80482bb: e9 e0 ff ff ff jmp80482a0 <_init+0x2c> 80482c0: ff 25 c4 96 04 08 jmp*0x80496c4 80482cb: e9 d0 ff ff ff jmp80482a0 <_init+0x2c> 80483ab: eb 93 jmp8048340 80483c6: e9 75 ff ff ff jmp8048340 8048448: eb 8d jmp80483d7 80484b1: eb 0d jmp80484c0 <__libc_csu_fini> We can see that "eb 8b" has been transformed to "eb 8d". This appears to be a bug of ld. The last command can be replaced by ld -m elf_i386 -o main main.o bug-ld.o /usr/lib/gcc/x86_64-linux-gnu/4.9/32/crtend.o /usr/lib32/crtn.o /usr/lib32/crt1.o /usr/lib32/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.9/32/crtbegin.o -lc The bug is diffult to trigger: if you replace in bug-ld.s 0xeb, 0x8b by something else, e.g. 0xeb, 0x8c, then the bug is not triggered. -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/20118] New: gas should set .init_array etc. sh_entsize to word size
https://sourceware.org/bugzilla/show_bug.cgi?id=20118 Bug ID: 20118 Summary: gas should set .init_array etc. sh_entsize to word size Product: binutils Version: 2.26 Status: NEW Severity: normal Priority: P2 Component: gas Assignee: unassigned at sourceware dot org Reporter: ro at gcc dot gnu.org Target Milestone: --- Solaris elfdump complains about sh_entsize being 0for .init_array etc. sections. The following example is on Solaris/x86, but the same applies to any ELF target. $ cat ia-i386.s .text .globl init .type init, @function init: ret .size init, .-init .section.init_array,"aw" .align 4 .long init $ gas-2.26 --32 ia-i386.s -o ia-i386.o $ elfdump -N .init_array ia-i386.o ia-i386.o: .init_array: zero sh_entsize information, expected 0x4 Init/Fini Array Section: .init_array index value derived-address name [0] 0 0 init $ elfdump -c -N .init_array ia-i386.o Section Header[4]: sh_name: .init_array sh_addr: 0 sh_flags: [ SHF_WRITE SHF_ALLOC ] sh_size: 0x4 sh_type:[ SHT_INIT_ARRAY ] sh_offset:0x38sh_entsize: 0 sh_link: 0 sh_info:0 sh_addralign: 0x4 Solaris/x86 as behaves the same, while Solaris/SPARC correctly sets sh_entsize to the respective word size. Solaris ld also gets it right: $ cat ia-cc.c void init() { } $ gcc -c ia-cc.c $ ld -r -zinitarray=init ia-cc.o -o ia-cc-ld.o $ elfdump -N .init_array ia-cc-ld.o Init/Fini Array Section: .init_array index value derived-address name [0] 0 0 init $ elfdump -c -N .init_array ia-cc-ld.o Section Header[2]: sh_name: .init_array sh_addr: 0 sh_flags: [ SHF_WRITE SHF_ALLOC ] sh_size: 0x4 sh_type:[ SHT_INIT_ARRAY ] sh_offset:0x3csh_entsize: 0x4 (1 entry) sh_link: 0 sh_info:0 sh_addralign: 0x4 Rainer -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/20118] gas should set .init_array etc. sh_entsize to word size
https://sourceware.org/bugzilla/show_bug.cgi?id=20118 Alan Modra changed: What|Removed |Added Status|NEW |ASSIGNED CC||amodra at gmail dot com Assignee|unassigned at sourceware dot org |amodra at gmail dot com --- Comment #1 from Alan Modra --- Seems a reasonable thing to do, and the ELF gABI could be read as requiring it. -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/20118] gas should set .init_array etc. sh_entsize to word size
https://sourceware.org/bugzilla/show_bug.cgi?id=20118 --- Comment #2 from cvs-commit at gcc dot gnu.org --- The master branch has been updated by Alan Modra : https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=606851fbf66c4a9e47c958014579dd363a74ba76 commit 606851fbf66c4a9e47c958014579dd363a74ba76 Author: Alan Modra Date: Fri May 20 00:33:42 2016 +0930 Set sh_entsize for .init_array and similar. PR gas/20118 * elf.c (elf_fake_sections): Set sh_entsize for SHT_INIT_ARRAY, SHT_FINI_ARRAY, and SHT_PREINIT_ARRAY. -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/20118] gas should set .init_array etc. sh_entsize to word size
https://sourceware.org/bugzilla/show_bug.cgi?id=20118 Alan Modra changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED Target Milestone|--- |2.27 --- Comment #3 from Alan Modra --- Fixed. -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/20118] gas should set .init_array etc. sh_entsize to word size
https://sourceware.org/bugzilla/show_bug.cgi?id=20118 --- Comment #4 from Rainer Orth --- > --- Comment #3 from Alan Modra --- > Fixed. Great, thanks for the blazingly fast fix. Rainer -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug binutils/14625] [2.23/2.24 regression] ar: File truncated
https://sourceware.org/bugzilla/show_bug.cgi?id=14625 H.J. Lu changed: What|Removed |Added CC||hjl.tools at gmail dot com -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/20117] GOT relocation changes another instruction
https://sourceware.org/bugzilla/show_bug.cgi?id=20117 --- Comment #1 from cvs-commit at gcc dot gnu.org --- The master branch has been updated by H.J. Lu : https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7d4d970973c4735dcdd2a69d645309f167a1d9d4 commit 7d4d970973c4735dcdd2a69d645309f167a1d9d4 Author: H.J. Lu Date: Thu May 19 12:56:55 2016 -0700 Don't convert R_386_GOT32 relocation Don't convert R_386_GOT32 since we can't tell if it is applied to "mov $foo@GOT, %reg" which isn't a load via GOT. bfd/ PR ld/20117 * elf32-i386.c (elf_i386_convert_load_reloc): Don't check R_386_GOT32X. (elf_i386_convert_load): Don't convert R_386_GOT32. ld/ PR ld/20117 * testsuite/ld-i386/i386.exp: Run pr20117. * testsuite/ld-i386/pr19609-1i.d: Updated. * testsuite/ld-i386/pr20117.d: New file. * testsuite/ld-i386/pr20117.s: Likewise. -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/20117] GOT relocation changes another instruction
https://sourceware.org/bugzilla/show_bug.cgi?id=20117 H.J. Lu changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2016-05-19 Assignee|unassigned at sourceware dot org |hjl.tools at gmail dot com Ever confirmed|0 |1 --- Comment #2 from H.J. Lu --- Fixed on master branch so far. -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/20117] GOT relocation changes another instruction
https://sourceware.org/bugzilla/show_bug.cgi?id=20117 H.J. Lu changed: What|Removed |Added CC||hjl.tools at gmail dot com -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gold/19823] gold produces copy reloc of protected symbols
https://sourceware.org/bugzilla/show_bug.cgi?id=19823 --- Comment #8 from cvs-commit at gcc dot gnu.org --- The master branch has been updated by Cary Coutant : https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6eeb0170bbb43ffb73e8f01b8b481adde8194c21 commit 6eeb0170bbb43ffb73e8f01b8b481adde8194c21 Author: Cary Coutant Date: Thu May 19 14:58:18 2016 -0700 Don't allow COPY relocations for protected symbols. gold/ PR gold/19823 * copy-relocs.cc (Copy_relocs::make_copy_reloc): Add object parameter; check for protected symbol. * copy-relocs.h (Copy_relocs::make_copy_reloc): Add object parameter. * mips.cc (Mips_copy_relocs): Adjust call to make_copy_reloc. * symtab.cc (Symbol::init_fields): Initialize is_protected_. (Symbol_table::add_from_dynobj): Mark protected symbols. * symtab.h (Symbol::is_protected): New method. (Symbol::set_is_protected): New method. (Symbol::is_protected_): New data member. * testsuite/Makefile.am (copy_test_protected): New test. * testsuite/Makefile.in: Regenerate. * testsuite/copy_test.cc (main): Add legal reference to protected symbol. * testsuite/copy_test_v1.cc (main): Likewise. * testsuite/copy_test_2.cc (ip): Add protected symbol. * testsuite/copy_test_protected.cc: New test source file. * testsuite/copy_test_protected.sh: New test script. -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gold/19823] gold produces copy reloc of protected symbols
https://sourceware.org/bugzilla/show_bug.cgi?id=19823 Cary Coutant changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #9 from Cary Coutant --- Fixed on trunk. -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gold/20062] Gold2.26 fail to link Uefi firmware with internal error in do_layout, but ld works
https://sourceware.org/bugzilla/show_bug.cgi?id=20062 Cary Coutant changed: What|Removed |Added Status|NEW |ASSIGNED --- Comment #3 from Cary Coutant --- Gold does not currently support the combination of --gc-sections with either -r or --emit-relocs. Unfortunately, we only diagnose with -r, and hit an internal error if --emit-relocs is used. If you remove --gc-sections from the link, we hit another internal error, which is the result of trying to layout the .rela.* sections according to the linker script. It turns out that Gnu ld ignores the .rela directives in the SECTIONS clause, instead writing the output relocations as orphan sections. Gold should do the same. If you also remove the .rela directive from the SECTIONS clause, gold will link successfully, and it makes no difference to Gnu ld. -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gold/20108] gcctestdir/ld: internal error in write_info_blocks, at /git/binutils-gdb/gold/incremental.cc:1651
https://sourceware.org/bugzilla/show_bug.cgi?id=20108 Cary Coutant changed: What|Removed |Added Status|UNCONFIRMED |ASSIGNED Last reconfirmed||2016-05-20 Ever confirmed|0 |1 --- Comment #1 from Cary Coutant --- Gold does not support --incremental with -s. This should be diagnosed as an error. The testsuite should also insulate itself from options passed in via LDFLAGS or by the compiler, as it currently does for -z,relro. Unfortunately, there is no --no-strip-all option, so it's not quite so simple to turn off a -s that has been passed in globally. -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils