[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/23428] ld does not put program headers in a code-only load segme
From: |
evangelos at foutrelis dot com |
Subject: |
[Bug ld/23428] ld does not put program headers in a code-only load segment |
Date: |
Fri, 10 Aug 2018 17:19:26 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=23428
--- Comment #11 from Evangelos Foutras <evangelos at foutrelis dot com> ---
Created attachment 11174
--> https://sourceware.org/bugzilla/attachment.cgi?id=11174&action=edit
Test case with Arch's and Debian's GCC-provided crt{begin,end}.o
(In reply to nsz from comment #10)
> i'd try to verify that the right ld is used (e.g. strace -f -e execve
> musl-gcc ...)
> then i'd try to reproduce the issue outside of musl-gcc (e.g. manually
> invoking
> ld with the options seen in the strace and look for the NOTE program header)
Thanks for the suggestion. I was able to reduce my test case to something that
is reproducible on both Arch and Debian.
The attached test case indicates that it's some difference between Debian's and
Arch's crt{begin,end}.o (as provided by GCC) that's causing ld to add the NOTE
program header and .note.gnu.property section to the produced binary.
Comparing them using 'objdump -h', I notice that Arch's crt{begin,end}.o have a
.note.gnu.property section and Debian's don't. If I use 'objcopy -R
.note.gnu.property' on the Arch ones, then those produce a working executable
too!
Does the above indicate that the fix to binutils needs to be tweaked?
=================================
[pr23428-test]$ make
cc -c -o test.o test.c
ld -static -o test-arch arch-crts/* arch-musl/* test.o
ld -static -o test-debian debian-crts/* arch-musl/* test.o
pr23428-test$ grep gnu.property test-*
Binary file test-debian matches
[pr23428-test]$ ./test-debian
[pr23428-test]$ ./test-arch
Segmentation fault (core dumped)
[pr23428-test]$ objcopy -R .note.gnu.property arch-crts/crtbegin.o
[pr23428-test]$ objcopy -R .note.gnu.property arch-crts/crtend.o
[pr23428-test]$ make -Bs test-arch
[pr23428-test]$ gdb -q -ex run ./test-arch
Reading symbols from ./test-arch...(no debugging symbols found)...done.
Starting program: /home/../desktop/pr23428-test/test-arch
[Inferior 1 (process 17284) exited normally]
=================================
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/23428] ld does not put program headers in a code-only load segment, evangelos at foutrelis dot com, 2018/08/09
- [Bug ld/23428] ld does not put program headers in a code-only load segment, nsz at port70 dot net, 2018/08/09
- [Bug ld/23428] ld does not put program headers in a code-only load segment, evangelos at foutrelis dot com, 2018/08/09
- [Bug ld/23428] ld does not put program headers in a code-only load segment, nsz at port70 dot net, 2018/08/10
- [Bug ld/23428] ld does not put program headers in a code-only load segment,
evangelos at foutrelis dot com <=
- [Bug ld/23428] ld does not put program headers in a code-only load segment, hjl.tools at gmail dot com, 2018/08/10
- [Bug ld/23428] ld does not put program headers in a code-only load segment, evangelos at foutrelis dot com, 2018/08/10
- [Bug ld/23428] ld does not put program headers in a code-only load segment, nsz at port70 dot net, 2018/08/11
- [Bug ld/23428] ld does not put program headers in a code-only load segment, hjl.tools at gmail dot com, 2018/08/11
- [Bug ld/23428] ld does not put program headers in a code-only load segment, evangelos at foutrelis dot com, 2018/08/11
- [Bug ld/23428] ld does not put program headers in a code-only load segment, cvs-commit at gcc dot gnu.org, 2018/08/11
- [Bug ld/23428] ld does not put program headers in a code-only load segment, hjl.tools at gmail dot com, 2018/08/11
- [Bug ld/23428] ld does not put program headers in a code-only load segment, evangelos at foutrelis dot com, 2018/08/11
- [Bug ld/23428] ld does not put program headers in a code-only load segment, cvs-commit at gcc dot gnu.org, 2018/08/12
- [Bug ld/23428] ld does not put program headers in a code-only load segment, hjl.tools at gmail dot com, 2018/08/22