[Bug ld/14926] New: "Not enough room for program headers" error, even though there is
http://sourceware.org/bugzilla/show_bug.cgi?id=14926 Bug #: 14926 Summary: "Not enough room for program headers" error, even though there is Product: binutils Version: 2.23 Status: NEW Severity: normal Priority: P2 Component: ld AssignedTo: unassig...@sourceware.org ReportedBy: josh.m.con...@gmail.com Classification: Unclassified In the following example, I get an unwarranted error message: $ cat test.s .file"test.c" .text .p2align 4,,15 .globl_start .type_start, @function _start: .LFB0: movl$42, %eax ret .LFE0: .size_start, .-_start $ as test.s -o test.o $ ld test.o -o test -Ttext=0x60 ld: test: Not enough room for program headers, try linking with -N ld: final link failed: Bad value $ If I specify -Ttext=0x30 (or less) or -Ttext=0x80 (or greater), the link happens as expected. I'm reporting this because we've had a fix in our local tree for a while, and it would be nice to get it into mainline. The problem is that when we are determining if the ELF and program headers can share the same segment as .text, we only compare the address of .text against the size of the program headers -- we fail to take into account the size of the ELF header. Specifically, in _bfd_elf_map_sections_to_segments (elf.c), the code following this comment: /* Deal with -Ttext or something similar such that the first section ... should add the ELF header size to the program header size when determining whether the section needs to go into a new segment. -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- 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/15323] New: Unable to redefine weak function in -flto incrementally-linked executable
http://sourceware.org/bugzilla/show_bug.cgi?id=15323 Bug #: 15323 Summary: Unable to redefine weak function in -flto incrementally-linked executable Product: binutils Version: 2.23 Status: NEW Severity: normal Priority: P2 Component: ld AssignedTo: unassig...@sourceware.org ReportedBy: josh.m.con...@gmail.com Classification: Unclassified If I have a weak function defined in an executable created with -flto -r, when I try to redefine the function by re-linking with an object file containing a non-weak definition of the same function, I get an error: `foobar' referenced in section `.text.startup' of test-intermediate: defined in discarded section `.text' of test.o (symbol from plugin) collect2: error: ld returned 1 exit status Here are some steps to reproduce, where gcc is using ld with the linker plugin for lto: $ cat test-weak.c volatile int x; __attribute__((weak)) void foobar (void) { x++; } int main (void) { foobar (); return 0; } $ cat test.c extern volatile int x; void foobar (void) { x--; } $ gcc -flto -g -O2 -c -o test-weak.o test-weak.c $ gcc -flto -g -O2 -c -o test.o test.c $ gcc -flto -g -O2 -r -o test-intermediate test-weak.o -nostdlib -nostartfiles $ gcc -flto -g -O2 -o test test-intermediate test.o `foobar' referenced in section `.text.startup' of test-intermediate: defined in discarded section `.text' of test.o (symbol from plugin) collect2: error: ld returned 1 exit status Let me know if you need an example that is assembly-only, or if you need me to verify with top-of-tree. (Note that I can work around the error with -fno-use-linker-plugin, but I want to use the linker plugin for whole program optimization purposes). -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- 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/15323] Unable to redefine weak function in -flto incrementally-linked executable
http://sourceware.org/bugzilla/show_bug.cgi?id=15323 --- Comment #5 from Joshua Conner 2013-04-03 23:38:43 UTC --- Thanks for the quick help! -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- 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