[Bug ld/18167] New: [2.25 regression] binutils fails to link gmp on ARM32
https://sourceware.org/bugzilla/show_bug.cgi?id=18167 Bug ID: 18167 Summary: [2.25 regression] binutils fails to link gmp on ARM32 Product: binutils Version: 2.25 Status: NEW Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: doko at debian dot org seen when building gmp 6.0.0a on ARM32 linux only, other architectures work fine: libtool: link: arm-linux-gnueabihf-gcc -std=gnu99 -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -O3 -Wl,-Bsymbolic-functions -Wl,-z -Wl,relro -o .libs/t-constants t-constants.o ./.libs/libtests.a /build/buildd/gmp-6.0.0+dfsg/build/.libs/libgmp.so ../.libs/libgmp.so /usr/bin/ld: copy reloc against protected `__gmp_binvert_limb_table' is invalid /usr/bin/ld: failed to set dynamic section sizes: Bad value collect2: error: ld returned 1 exit status Makefile:760: recipe for target 't-constants' failed likely exposed by the fixes for PR ld/pr15228, PR ld/pr17709 -- 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/18167] [2.25 regression] binutils fails to link gmp on ARM32
https://sourceware.org/bugzilla/show_bug.cgi?id=18167 Matthias Klose changed: What|Removed |Added Target||arm-linux-gnueabihf CC||hjl at sourceware dot org -- 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/18167] [2.25 regression] binutils fails to link gmp on ARM32
https://sourceware.org/bugzilla/show_bug.cgi?id=18167 --- Comment #1 from H.J. Lu --- All ELF targets with copy relocation should set elf_backend_extern_protected_data to 1, like x86 in https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=031994d25c8c8dc392ceb43abc2dfd9a851bc384 -- 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/18167] [2.25 regression] binutils fails to link gmp on ARM32
https://sourceware.org/bugzilla/show_bug.cgi?id=18167 H.J. Lu changed: What|Removed |Added CC|hjl at sourceware dot org |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/18167] [2.25 regression] binutils fails to link gmp on ARM32
https://sourceware.org/bugzilla/show_bug.cgi?id=18167 Alan Modra changed: What|Removed |Added CC||amodra at gmail dot com --- Comment #2 from Alan Modra --- Likely due to my PR 15228 fix. HJ's advice is only reasonable if you have glibc and gcc changes that a) make code generated for access to protected visibility variables in shared libraries effectively be the same as for default visibility variables, and b) you have glibc changes that ensure you keep the semantics of protected visibility variables. Otherwise all HJ's changes do is revert the PR 15228 fix, and you will silently generate buggy executables that have a copy of a protected variable in .dynbss that isn't used by the shared library defining that variable. ie. you've broken the semantics of protected variables. If either the executable or the shared library update the variable's value, then they see different values in a variable that has only one definition. I also think HJ's linker changes are unsafe since there is no attempt to detect shared libraries that are compiled without the as yet uncommitted gcc changes. -- 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/18160] Segmentation Fault in lang_gc_sections when linking elf_x86_64 output
https://sourceware.org/bugzilla/show_bug.cgi?id=18160 --- Comment #9 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=b19a8f8545100a08ee2a64c05631aff6f651faa1 commit b19a8f8545100a08ee2a64c05631aff6f651faa1 Author: H.J. Lu Date: Thu Mar 26 08:22:08 2015 -0700 Skip gc-sections if relocation is incompatible This patch skips gc-sections if input relocation is incompatible with output. bfd/ PR ld/18160 * elflink.c (elf_gc_sweep): Skip if relocation is incompatible. (bfd_elf_gc_sections): Likewise. ld/testsuite/ PR ld/18160 * ld-x86-64/pr18160.d: New file. * ld-x86-64/pr18160.s: Likewise. * ld-x86-64/pr18160.t: Likewise. * ld-x86-64/x86-64.exp: Run pr18160. -- 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/18160] Segmentation Fault in lang_gc_sections when linking elf_x86_64 output
https://sourceware.org/bugzilla/show_bug.cgi?id=18160 H.J. Lu changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED Target Milestone|--- |2.26 --- Comment #10 from H.J. Lu --- 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 ld/18169] New: sh_info of .rel.plt/.rela.plt sections isn't correct
https://sourceware.org/bugzilla/show_bug.cgi?id=18169 Bug ID: 18169 Summary: sh_info of .rel.plt/.rela.plt sections isn't correct Product: binutils Version: 2.26 (HEAD) Status: NEW Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: hjl.tools at gmail dot com gABI says that sh_info of SHT_REL/SHT_RELA sections has the section header index of the section to which the relocation applies. [hjl@gnu-tools-1 rel]$ cat x.c extern void bar (void); void foo () { bar (); } [hjl@gnu-tools-1 rel]$ make cc -m32 -O2 -fPIC -c -o x.o x.c ./ld -m elf_i386 --emit-relocs -shared -o x.so x.o readelf -SW x.so #| grep REL There are 18 section headers, starting at offset 0x540: Section Headers: [Nr] Name TypeAddr OffSize ES Flg Lk Inf Al [ 0] NULL 00 00 00 0 0 0 [ 1] .hash HASH00b4 b4 2c 04 A 2 0 4 [ 2] .dynsym DYNSYM 00e0 e0 60 10 A 3 1 4 [ 3] .dynstr STRTAB 0140 000140 21 00 A 0 0 1 [ 4] .rel.plt REL 0164 000164 08 08 AI 2 5 4 [ 5] .plt PROGBITS0170 000170 20 04 AX 0 0 16 [ 6] .text PROGBITS0190 000190 1d 00 AX 0 0 16 [ 7] .rel.text REL 000518 18 08 I 16 6 4 [ 8] .eh_frame PROGBITS01b0 0001b0 70 00 A 0 0 4 [ 9] .rel.eh_frame REL 000530 10 08 I 16 8 4 [10] .dynamic DYNAMIC 1220 000220 78 08 WA 3 0 4 [11] .got.plt PROGBITS1298 000298 10 04 WA 0 0 4 [12] .data PROGBITS12a8 0002a8 00 00 WA 0 0 1 [13] .bss NOBITS 12a8 0002a8 00 00 WA 0 0 1 [14] .comment PROGBITS 0002a8 2c 01 MS 0 0 1 [15] .shstrtab STRTAB 0002d4 78 00 0 0 1 [16] .symtab SYMTAB 00034c 000170 10 17 18 4 [17] .strtab STRTAB 0004bc 5a 00 0 0 1 Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings) I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown) O (extra OS processing required) o (OS specific), p (processor specific) [hjl@gnu-tools-1 rel]$ sh_info of .rel.plt is 5 which points to .plt section. It should be 0. -- 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/18167] [2.25 regression] binutils fails to link gmp on ARM32
https://sourceware.org/bugzilla/show_bug.cgi?id=18167 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 -- 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/18167] [2.25 regression] binutils fails to link gmp on ARM32
https://sourceware.org/bugzilla/show_bug.cgi?id=18167 --- Comment #3 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=b84171287ffe60dd1e7c02262a0493862fa21a97 commit b84171287ffe60dd1e7c02262a0493862fa21a97 Author: Alan Modra Date: Fri Mar 27 15:41:05 2015 +1030 Relax PR 15228 protected visibility restriction Allows .dynbss copy of shared library protected visibility variables if they are read-only. To recap: Copying a variable from a shared library into an executable's .dynbss is an old hack invented for non-PIC executables, to avoid the text relocations you'd otherwise need to access a shared library variable. This works with ELF shared libraries because global symbols can be overridden. The trouble is that protected visibility symbols can't be overridden. A shared library will continue to access it's own protected visibility variable while the executable accesses a copy. If either the shared library or the executable updates the value then the copy diverges from the original. This is wrong since there is only one definition of the variable in the application. So I made the linker report an error on attempting to copy protected visibility variables into .dynbss. However, you'll notice the above paragraph contains an "If". An application that does not modify the variable value remains correct even though two copies of the variable exist. The linker can detect this situation if the variable was defined in a read-only section. PR ld/15228 PR ld/18167 * elflink.c (elf_merge_st_other): Add "sec" parameter. Don't set protected_def when symbol section is read-only. Adjust all calls. * elf-bfd.h (struct elf_link_hash_entry): Update protected_def comment. -- 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/15228] copy relocations against protected symbols should be disallowed
https://sourceware.org/bugzilla/show_bug.cgi?id=15228 --- Comment #6 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=b84171287ffe60dd1e7c02262a0493862fa21a97 commit b84171287ffe60dd1e7c02262a0493862fa21a97 Author: Alan Modra Date: Fri Mar 27 15:41:05 2015 +1030 Relax PR 15228 protected visibility restriction Allows .dynbss copy of shared library protected visibility variables if they are read-only. To recap: Copying a variable from a shared library into an executable's .dynbss is an old hack invented for non-PIC executables, to avoid the text relocations you'd otherwise need to access a shared library variable. This works with ELF shared libraries because global symbols can be overridden. The trouble is that protected visibility symbols can't be overridden. A shared library will continue to access it's own protected visibility variable while the executable accesses a copy. If either the shared library or the executable updates the value then the copy diverges from the original. This is wrong since there is only one definition of the variable in the application. So I made the linker report an error on attempting to copy protected visibility variables into .dynbss. However, you'll notice the above paragraph contains an "If". An application that does not modify the variable value remains correct even though two copies of the variable exist. The linker can detect this situation if the variable was defined in a read-only section. PR ld/15228 PR ld/18167 * elflink.c (elf_merge_st_other): Add "sec" parameter. Don't set protected_def when symbol section is read-only. Adjust all calls. * elf-bfd.h (struct elf_link_hash_entry): Update protected_def comment. -- 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/18167] [2.25 regression] binutils fails to link gmp on ARM32
https://sourceware.org/bugzilla/show_bug.cgi?id=18167 --- Comment #4 from Alan Modra --- Matthias, please check that the patch I've just committed fixes the problem in gmp. -- 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