public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-4166] nvptx: In 'STARTFILE_SPEC', fix 'crt0.o' for '-mmainkernel'
@ 2022-11-19 14:41 Thomas Schwinge
0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-11-19 14:41 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:dda43e1ef0c9f6c32ad022d3a08ce7651e42a129
commit r13-4166-gdda43e1ef0c9f6c32ad022d3a08ce7651e42a129
Author: Thomas Schwinge <thomas@codesourcery.com>
Date: Fri Nov 18 23:57:52 2022 +0100
nvptx: In 'STARTFILE_SPEC', fix 'crt0.o' for '-mmainkernel'
A recent nvptx-tools change: commit 886a95faf66bf66a82fc0fe7d2a9fd9e9fec2820
"ld: Don't search for input files in '-L'directories" (of
<https://github.com/MentorEmbedded/nvptx-tools/pull/38>
"Match standard 'ld' "search" behavior") in GCC/nvptx target testing
generally causes linking to fail with:
error opening crt0.o
collect2: error: ld returned 1 exit status
compiler exited with status 1
Indeed per GCC '-v' output, there is an undecorated 'crt0.o' on the linker
('collect2') command line:
[...]/build-gcc/./gcc/collect2 -o [...] crt0.o [...]
This is due to:
gcc/config/nvptx/nvptx.h:#define STARTFILE_SPEC "%{mmainkernel:crt0.o}"
..., and the fix, as used by numerous other GCC targets, is to instead use
'crt0.o%s'; for '%s' means, per 'gcc/gcc.cc', "The Specs Language":
%s current argument is the name of a library or startup file of some sort.
Search for that file in a standard list of directories
and substitute the full name found.
With that, we get the expected path to 'crt0.o'.
gcc/
* config/nvptx/nvptx.h (STARTFILE_SPEC): Fix 'crt0.o' for
'-mmainkernel'.
Diff:
---
gcc/config/nvptx/nvptx.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/config/nvptx/nvptx.h b/gcc/config/nvptx/nvptx.h
index 0afc83b10a3..dc676dcb5fc 100644
--- a/gcc/config/nvptx/nvptx.h
+++ b/gcc/config/nvptx/nvptx.h
@@ -35,7 +35,7 @@
'../../gcc.cc:asm_options', 'HAVE_GNU_AS'. */
#define ASM_SPEC "%{v}"
-#define STARTFILE_SPEC "%{mmainkernel:crt0.o}"
+#define STARTFILE_SPEC "%{mmainkernel:crt0.o%s}"
#define TARGET_CPU_CPP_BUILTINS() nvptx_cpu_cpp_builtins ()
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-11-19 14:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-19 14:41 [gcc r13-4166] nvptx: In 'STARTFILE_SPEC', fix 'crt0.o' for '-mmainkernel' Thomas Schwinge
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).