Skip to content

Commit

Permalink
Move GNU/Hurd startfile spec from config/i386/gnu.h to config/gnu.h
Browse files Browse the repository at this point in the history
Since it's not i386-specific; this makes it possible to reuse it for other
architectures.

Also, add a warning for the case gnu.h is specified before gnu-user.h, which
would cause gnu-user's version of the spec to override gnu's, and not the other
way around as it's intended. The i?86-gnu target currently specifies them in
the right order, but it's easy to accidentally put them in a wrong order.

gcc/Changelog:

	* config/i386/gnu.h: Move GNU/Hurd STARTFILE_SPEC from here...
	* config/gnu.h: ...to here.

Signed-off-by: Sergey Bugaev <[email protected]>
  • Loading branch information
bugaevc authored and tschwinge committed Apr 9, 2024
1 parent d76df69 commit 532c57f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
16 changes: 16 additions & 0 deletions gcc/config/gnu.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,19 @@ along with GCC. If not, see <http://www.gnu.org/licenses/>.
builtin_assert ("system=unix"); \
builtin_assert ("system=posix"); \
} while (0)


#ifndef GNU_USER_TARGET_STARTFILE_SPEC
# warning This file should be included after gnu-user.h, to override its STARTFILE_SPEC
#endif

#undef STARTFILE_SPEC
#if defined HAVE_LD_PIE
#define STARTFILE_SPEC \
"%{!shared: %{pg|p|profile:%{static-pie:grcrt0.o%s;static:gcrt0.o%s;:gcrt1.o%s};static-pie:rcrt0.o%s;static:crt0.o%s;" PIE_SPEC ":Scrt1.o%s;:crt1.o%s}} \
crti.o%s %{static:crtbeginT.o%s;shared|static-pie|" PIE_SPEC ":crtbeginS.o%s;:crtbegin.o%s}"
#else
#define STARTFILE_SPEC \
"%{!shared: %{pg|p|profile:%{static:gcrt0.o%s;:gcrt1.o%s};static:crt0.o%s;:crt1.o%s}} \
crti.o%s %{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbegin.o%s}"
#endif
11 changes: 0 additions & 11 deletions gcc/config/i386/gnu.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,6 @@ along with GCC. If not, see <http://www.gnu.org/licenses/>.
#undef GNU_USER_DYNAMIC_LINKER
#define GNU_USER_DYNAMIC_LINKER "/lib/ld.so"

#undef STARTFILE_SPEC
#if defined HAVE_LD_PIE
#define STARTFILE_SPEC \
"%{!shared: %{pg|p|profile:%{static-pie:grcrt0.o%s;static:gcrt0.o%s;:gcrt1.o%s};static-pie:rcrt0.o%s;static:crt0.o%s;" PIE_SPEC ":Scrt1.o%s;:crt1.o%s}} \
crti.o%s %{static:crtbeginT.o%s;shared|static-pie|" PIE_SPEC ":crtbeginS.o%s;:crtbegin.o%s}"
#else
#define STARTFILE_SPEC \
"%{!shared: %{pg|p|profile:%{static:gcrt0.o%s;:gcrt1.o%s};static:crt0.o%s;:crt1.o%s}} \
crti.o%s %{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbegin.o%s}"
#endif

#ifdef TARGET_LIBC_PROVIDES_SSP

/* i386 glibc provides __stack_chk_guard in %gs:0x14. */
Expand Down

0 comments on commit 532c57f

Please sign in to comment.