Summary: | Bogus global symbol ABS redefinition when linking PIC app to eh_frame-stripped shared library | ||
---|---|---|---|
Product: | binutils | Reporter: | Rich Felker <bugdal> |
Component: | binutils | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | NEW --- | ||
Severity: | normal | CC: | amodra |
Priority: | P2 | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Last reconfirmed: |
Description
Rich Felker
2012-05-01 02:13:34 UTC
On the face of it this appears to be a strip/objcopy bug. "global" is defined in .bss, section number 22 with my version of x86-64 gcc. .eh_frame_hdr and .eh_frame are sections 13 and 14. When they are removed, the dynamic symbol table is not updated. "global" stays defined in section 22, which is now .shstrtab, an entirely different type of section. This confuses the linker. However, the documentation for objcopy -R and strip -R says "Note that using this option inappropriately may make the output file unusable". Which is exactly what you've done. If you want to strip sections, do so at link time using a linker script with /DISCARD/. Thanks for getting to the bottom of this so quickly. That makes it a strip bug, then. If strip is going to renumber the sections, it needs to fix the section numbers in the symbol table too. Or it could just leave the section numbers alone and replace the stripped sections with dummy zero-length sections with unobtrusive names to avoid the problem. Another way of looking at the issue is that, if strip is going to break things like this, the default linker scripts should order the sections such that mandatory sections like text/data/bss all come before (in the section table, not necessarily in the file) optional sections like dwarf2 unwind tables rather than interspersed. Another way of looking at the issue is that, if strip is going to break things like this, the default linker scripts should order the sections such that mandatory sections like text/data/bss all come before (in the section table, not necessarily in the file) optional sections like dwarf2 unwind tables rather than interspersed. |