public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug driver/96190] New: --enable-default-pie on sparc uses crtbeginS.o (correct) and crtend.o (incorrect) @ 2020-07-13 23:12 slyfox at inbox dot ru 2020-07-14 7:02 ` [Bug target/96190] " slyfox at inbox dot ru ` (4 more replies) 0 siblings, 5 replies; 6+ messages in thread From: slyfox at inbox dot ru @ 2020-07-13 23:12 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96190 Bug ID: 96190 Summary: --enable-default-pie on sparc uses crtbeginS.o (correct) and crtend.o (incorrect) Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: driver Assignee: unassigned at gcc dot gnu.org Reporter: slyfox at inbox dot ru Target Milestone: --- The side-effect of the crtbeginS.o/crtend.o mismatch are: - R_SPARC_NONE relocations in final executables: https://sourceware.org/PR26236 - TEXTRELs in binaries Simple reproducer: $ echo 'int main(){}' | sparc-unknown-linux-gnu-gcc -x c - -o a /usr/libexec/gcc/sparc-unknown-linux-gnu/ld: warning: creating a DT_TEXTREL in object $ echo 'int main(){}' | sparc-unknown-linux-gnu-gcc -x c - -o a -no-pie $ echo 'int main(){}' | sparc-unknown-linux-gnu-gcc -x c - -o a -pie gcc is built as: """ Using built-in specs. COLLECT_GCC=/usr/bin/sparc-unknown-linux-gnu-gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/sparc-unknown-linux-gnu/10.1.0/lto-wrapper Target: sparc-unknown-linux-gnu Configured with: /tmp/portage-tmpdir/portage/cross-sparc-unknown-linux-gnu/gcc-10.1.0-r2/work/gcc-10.1.0/configure --host=x86_64-pc-linux-gnu --target=sparc-unknown-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/sparc-unknown-linux-gnu/gcc-bin/10.1.0 --includedir=/usr/lib/gcc/sparc-unknown-linux-gnu/10.1.0/include --datadir=/usr/share/gcc-data/sparc-unknown-linux-gnu/10.1.0 --mandir=/usr/share/gcc-data/sparc-unknown-linux-gnu/10.1.0/man --infodir=/usr/share/gcc-data/sparc-unknown-linux-gnu/10.1.0/info --with-gxx-include-dir=/usr/lib/gcc/sparc-unknown-linux-gnu/10.1.0/include/g++-v10 --with-python-dir=/share/gcc-data/sparc-unknown-linux-gnu/10.1.0/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 10.1.0-r2 p3' --disable-esp --enable-libstdcxx-time --enable-poison-system-directories --with-sysroot=/usr/sparc-unknown-linux-gnu --disable-bootstrap --enable-__cxa_atexit --enable-clocale=gnu --disable-multilib --disable-fixed-point --enable-targets=all --enable-libgomp --disable-libmudflap --disable-libssp --disable-libada --disable-systemtap --enable-vtable-verify --without-zstd --enable-lto --without-isl --enable-default-pie --enable-default-ssp Thread model: posix Supported LTO compression algorithms: zlib gcc version 10.1.0 (Gentoo 10.1.0-r2 p3) """ I think the bug here is in SPEC files where crtendS.o is only pulled by explicit options: gcc/config/sparc/linux.h: "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\ gcc/config/sparc/linux64.h: "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\ AFAIu it should be something similar to generic case: gcc/config/gnu-user.h: shared|static-pie|" PIE_SPEC ":crtendS.o%s; \ Does it sound about right? Should other targets follow as well? Specifically: gcc/config/alpha/linux.h: crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" gcc/config/alpha/linux.h: crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" gcc/config/alpha/linux.h: %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" gcc/config/bfin/linux.h: crti.o%s %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}" gcc/config/c6x/uclinux-elf.h: "%{!shared:crt1%O%s} crti%O%s %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}" gcc/config/csky/csky-linux-elf.h: crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" gcc/config/csky/csky-linux-elf.h: "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" gcc/config/frv/linux.h: crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" gcc/config/frv/linux.h: "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" gcc/config/ia64/linux.h: crti.o%s %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}" gcc/config/ia64/linux.h: crti.o%s %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}" gcc/config/ia64/linux.h: %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" gcc/config/m32r/linux.h: crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" gcc/config/m32r/linux.h: "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" gcc/config/sparc/linux.h: "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\ gcc/config/sparc/linux64.h: "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\ ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/96190] --enable-default-pie on sparc uses crtbeginS.o (correct) and crtend.o (incorrect) 2020-07-13 23:12 [Bug driver/96190] New: --enable-default-pie on sparc uses crtbeginS.o (correct) and crtend.o (incorrect) slyfox at inbox dot ru @ 2020-07-14 7:02 ` slyfox at inbox dot ru 2020-07-20 19:47 ` cvs-commit at gcc dot gnu.org ` (3 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: slyfox at inbox dot ru @ 2020-07-14 7:02 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96190 --- Comment #1 from Sergei Trofimovich <slyfox at inbox dot ru> --- Sent https://gcc.gnu.org/pipermail/gcc-patches/2020-July/549983.html for review. If it's a reasonable thing to do I'll convert the rest of targets. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/96190] --enable-default-pie on sparc uses crtbeginS.o (correct) and crtend.o (incorrect) 2020-07-13 23:12 [Bug driver/96190] New: --enable-default-pie on sparc uses crtbeginS.o (correct) and crtend.o (incorrect) slyfox at inbox dot ru 2020-07-14 7:02 ` [Bug target/96190] " slyfox at inbox dot ru @ 2020-07-20 19:47 ` cvs-commit at gcc dot gnu.org 2020-07-20 21:48 ` slyfox at inbox dot ru ` (2 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2020-07-20 19:47 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96190 --- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Sergei Trofimovich <slyfox@gcc.gnu.org>: https://gcc.gnu.org/g:87891d5eafe8d1de90b9d9b056eca81c508d1c77 commit r11-2235-g87891d5eafe8d1de90b9d9b056eca81c508d1c77 Author: Sergei Trofimovich <siarheit@google.com> Date: Tue Jul 14 07:48:42 2020 +0100 sparc/sparc64: use crtendS.o for default-pie executables [PR96190] In --enable-default-pie mode compiler should switch from using crtend.o to crtendS.o. On sparc it is especially important because crtend.o contains PIC-unfriendly code. We use GNU_USER_TARGET_ENDFILE_SPEC as a baseline spec to get crtendS.o instead of crtend.o in !no-pie mode. gcc: 2020-07-14 Sergei Trofimovich <siarheit@google.com> PR target/96190 * config/sparc/linux.h (ENDFILE_SPEC): Use GNU_USER_TARGET_ENDFILE_SPEC to get crtendS.o for !no-pie mode. * config/sparc/linux64.h (ENDFILE_SPEC): Ditto. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/96190] --enable-default-pie on sparc uses crtbeginS.o (correct) and crtend.o (incorrect) 2020-07-13 23:12 [Bug driver/96190] New: --enable-default-pie on sparc uses crtbeginS.o (correct) and crtend.o (incorrect) slyfox at inbox dot ru 2020-07-14 7:02 ` [Bug target/96190] " slyfox at inbox dot ru 2020-07-20 19:47 ` cvs-commit at gcc dot gnu.org @ 2020-07-20 21:48 ` slyfox at inbox dot ru 2020-07-23 23:07 ` cvs-commit at gcc dot gnu.org 2020-07-25 20:12 ` slyfox at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: slyfox at inbox dot ru @ 2020-07-20 21:48 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96190 --- Comment #3 from Sergei Trofimovich <slyfox at inbox dot ru> --- As suggested by Eric I plan to apply sparc fix from master into gcc-10 branch after 10.2 release cut. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/96190] --enable-default-pie on sparc uses crtbeginS.o (correct) and crtend.o (incorrect) 2020-07-13 23:12 [Bug driver/96190] New: --enable-default-pie on sparc uses crtbeginS.o (correct) and crtend.o (incorrect) slyfox at inbox dot ru ` (2 preceding siblings ...) 2020-07-20 21:48 ` slyfox at inbox dot ru @ 2020-07-23 23:07 ` cvs-commit at gcc dot gnu.org 2020-07-25 20:12 ` slyfox at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2020-07-23 23:07 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96190 --- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-10 branch has been updated by Sergei Trofimovich <slyfox@gcc.gnu.org>: https://gcc.gnu.org/g:ca47325f300462b6f4ea84de2103eef81a4a7684 commit r10-8527-gca47325f300462b6f4ea84de2103eef81a4a7684 Author: Sergei Trofimovich <siarheit@google.com> Date: Thu Jul 23 23:58:35 2020 +0100 sparc/sparc64: use crtendS.o for default-pie executables [PR96190] In --enable-default-pie mode compiler should switch from using crtend.o to crtendS.o. On sparc it is especially important because crtend.o contains PIC-unfriendly code. We use GNU_USER_TARGET_ENDFILE_SPEC as a baseline spec to get crtendS.o instead of crtend.o in !no-pie mode. gcc: 2020-07-14 Sergei Trofimovich <siarheit@google.com> PR target/96190 * config/sparc/linux.h (ENDFILE_SPEC): Use GNU_USER_TARGET_ENDFILE_SPEC to get crtendS.o for !no-pie mode. * config/sparc/linux64.h (ENDFILE_SPEC): Ditto. (cherry picked from commit 87891d5eafe8d1de90b9d9b056eca81c508d1c77) ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/96190] --enable-default-pie on sparc uses crtbeginS.o (correct) and crtend.o (incorrect) 2020-07-13 23:12 [Bug driver/96190] New: --enable-default-pie on sparc uses crtbeginS.o (correct) and crtend.o (incorrect) slyfox at inbox dot ru ` (3 preceding siblings ...) 2020-07-23 23:07 ` cvs-commit at gcc dot gnu.org @ 2020-07-25 20:12 ` slyfox at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: slyfox at gcc dot gnu.org @ 2020-07-25 20:12 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96190 Sergei Trofimovich <slyfox at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |slyfox at gcc dot gnu.org Status|UNCONFIRMED |RESOLVED Target Milestone|--- |10.3 Resolution|--- |FIXED Assignee|unassigned at gcc dot gnu.org |slyfox at gcc dot gnu.org --- Comment #5 from Sergei Trofimovich <slyfox at gcc dot gnu.org> --- Should be fixed for sparc for 10.3. Will handle other targets separately. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-07-25 20:12 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-07-13 23:12 [Bug driver/96190] New: --enable-default-pie on sparc uses crtbeginS.o (correct) and crtend.o (incorrect) slyfox at inbox dot ru 2020-07-14 7:02 ` [Bug target/96190] " slyfox at inbox dot ru 2020-07-20 19:47 ` cvs-commit at gcc dot gnu.org 2020-07-20 21:48 ` slyfox at inbox dot ru 2020-07-23 23:07 ` cvs-commit at gcc dot gnu.org 2020-07-25 20:12 ` slyfox at gcc dot gnu.org
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).