[Bug ld/22394] hppa-linux-ld fails to emit dynamic relocations on function pointer initialization
https://sourceware.org/bugzilla/show_bug.cgi?id=22394 --- Comment #1 from John David Anglin --- Hi Alan, Although your example is not technically supported, I think it should work on linux because it doesn't use the PIC register and because of the flat address space. First, calls to functions in shared libraries are not supported using the -mfast-indirect-calls gcc option: @item -mfast-indirect-calls @opindex mfast-indirect-calls Generate code that assumes calls never cross space boundaries. This allows GCC to emit code that performs faster indirect calls. This option does not work in the presence of shared libraries or nested functions. What works is: $ gcc -o funcp funcp.c funcpdef.c -mfast-indirect-calls $ ./funcp $ Issues are the space register used for the call and the PIC register. Looking at your example, it seems to me that R_PARISC_DIR32 relocations are not handled correctly when they refer to a function. This is the assembly code: .LEVEL 1.1 .globl fp .section.data.rel,"aw",@progbits .align 4 .type fp, @object .size fp, 4 fp: .word foo At runtime, fp is NULL causing the segmentation fault. So, I agree with your assessment. -- 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/22394] hppa-linux-ld fails to emit dynamic relocations on function pointer initialization
https://sourceware.org/bugzilla/show_bug.cgi?id=22394 --- Comment #2 from John David Anglin --- The segmentation fault doesn't occur with trunk plus your proposed elf32-hppa.c patch. -- 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/22397] New: BFD internal error when message locale isn't C
https://sourceware.org/bugzilla/show_bug.cgi?id=22397 Bug ID: 22397 Summary: BFD internal error when message locale isn't C Product: binutils Version: 2.29 Status: UNCONFIRMED Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: nintendocatz at msn dot com Target Milestone: --- Hello, Arch user here, I just hit this exact same bug with ld-2.29.1 without any patches : https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=873485 I will repeat the information from this bug report here : When ld tries to localize a you-need-fPIC error in fr_FR.UTF-8 (french), it aborts ("abandon") with an internal error ("erreur interne"): $ cat wtf.c++ #include void lol() { std::cout << "fail"; } $ LC_ALL="fr_FR.UTF-8" g++ -shared wtf.c++ /usr/bin/ld: /usr/bin/ld: BFD erreur interne (GNU Binutils for Debian) 2.29, abandon à ../../bfd/bfd.c:843 dans _doprnt /usr/bin/ld: Merci de rapporter cette anomalie. collect2: error: ld returned 1 exit status When switching to C locale, ld outputs an error as expected: $ LC_ALL="C" g++ -shared wtf.c++ /usr/bin/ld: /tmp/ccomgT5o.o: relocation R_X86_64_PC32 against symbol `_ZSt4cout@@GLIBCXX_3.4' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Bad value collect2: error: ld returned 1 exit status I'm not sure if the bug can be triggered with any other locale. I couldn't find any bug report looking similar to this one. -- 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/22394] hppa-linux-ld fails to emit dynamic relocations on function pointer initialization
https://sourceware.org/bugzilla/show_bug.cgi?id=22394 --- Comment #3 from John David Anglin --- On HP-UX, the 64-bit HP linker treats the DIR64 and FPTR64 relocations the same when "symbol" is a function pointer. Both point to a function descriptor. The ABI description is here: https://uclibc.org/docs/psABI-parisc.pdf If DIR32 and PLABEL32 were to behave similarly on 32-bit ELF, this would break the current fast indirect call implementation. We would have one additional layer for fast indirect calls. This is reasonably efficient when generating PA 2.0 code because there is the bve instruction. However, things are not efficient when generating PA 1.X code. So, fast indirect calls would no longer be useful. The original HP SOM linker required the P' selector for procedure labels for functions in shared libraries. So, it wasn't possible to do a fast indirect call to a function in a shared library. When the function isn't in a shared library, the call is direct and no function descriptor is used. Thus, I think it best that the DIR32 relocation provide the actual function address and not point to a descriptor. This will enable calls into shared libraries to functions that don't need the PIC register. Having the ability to directly load the address of a function is probably useful for other things. -- 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/22394] hppa-linux-ld fails to emit dynamic relocations on function pointer initialization
https://sourceware.org/bugzilla/show_bug.cgi?id=22394 --- Comment #4 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=127e8e9f62ed0e7145dfa1172c6253275fc150dd commit 127e8e9f62ed0e7145dfa1172c6253275fc150dd Author: Alan Modra Date: Tue Oct 31 18:13:03 2017 +1030 PR22394, hppa-linux-ld fails to emit dynamic relocations gcc -mfast-indirect-calls emits a function pointer initialization without a P% (plabel) modifier. ld does not create the necessary dynamic relocations for this to work. It turns out that the problem is caused by the non_got_ref symbol flag. This flag is set for non-pic by check_relocs to indicate that the symbol might need copy relocations or dynamic relocations. Later, the backend adjust_dynamic_symbol clears the flag to indicate dynamic relocations are needed, but leaves it set when copy relocations were created. The inversion in meaning is insane, but it's that way because the backend adjust_dynamic_symbol function doesn't get to look at all symbols.. Anyway, the insanity works for non-function symbols. However, the flag is left set on any function symbol with a dynamic relocation. This patch fixes the non_got_ref handling for function symbols, adds -z nocopyreloc for hppa-elf, reports where textrel occurs, and expands comments. The check_relocs change just stops creation of dyn_relocs we always threw away later. PR 22394 * elf32-hppa.c (elf32_hppa_check_relocs): Don't create dyn_relocs for plabels when non-pic. (maybe_set_textrel): New function. (readonly_dynrelocs): Move and rewrite. (elf32_hppa_adjust_dynamic_symbol): Use it. Don't create copy relocs when def_regular or -z nocopyreloc. Handle non_got_ref for functions. Expand non_got_ref comments. (elf32_hppa_size_dynamic_sections): Use maybe_set_textrel. -- 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/22394] hppa-linux-ld fails to emit dynamic relocations on function pointer initialization
https://sourceware.org/bugzilla/show_bug.cgi?id=22394 Alan Modra changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #5 from Alan Modra --- Dave, thanks for the commentary on ABI issues. Fixed, I think in line with your comments. -- 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/22397] BFD internal error when message locale isn't C
https://sourceware.org/bugzilla/show_bug.cgi?id=22397 Alan Modra changed: What|Removed |Added Status|UNCONFIRMED |ASSIGNED Last reconfirmed||2017-11-05 CC||amodra at gmail dot com Assignee|unassigned at sourceware dot org |amodra at gmail dot com Ever confirmed|0 |1 --- Comment #1 from Alan Modra --- The relevant lines from fr.po are these: # Les %s%s au début de %s%s« %s » peuvent être « non défini » ou rien pour le premier et # un des fragments ci-dessus pour le second ce qui donne par exemple « symbole interne non défini» en inversant les deux %s. # Le dernier %s collé au dernier mot peut être rien ou un des fragments traduits ci-dessus et commençant par un point-virgule. #: elf64-x86-64.c:1947 #, c-format msgid "%B: relocation %s against %s%s`%s' can not be used when making a shared object%s" msgstr "%1$B: réadressage %2$s vers %4$s%3$s« %5$s » ne peut pas être utilisé en créant un objet partagé%6$s" The internal error is due to the use of 1$ and other parameter number specifiers. -- 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