public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r11-10383] nvptx: In 'STARTFILE_SPEC', fix 'crt0.o' for '-mmainkernel'
Date: Sat, 19 Nov 2022 14:44:30 +0000 (GMT)	[thread overview]
Message-ID: <20221119144430.0985F3858D1E@sourceware.org> (raw)

https://gcc.gnu.org/g:4805d602d8dd25c10d1d8f30daa8a2eed0aed108

commit r11-10383-g4805d602d8dd25c10d1d8f30daa8a2eed0aed108
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'.
    
    (cherry picked from commit dda43e1ef0c9f6c32ad022d3a08ce7651e42a129)

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 3273ad86673..f1965d91fdd 100644
--- a/gcc/config/nvptx/nvptx.h
+++ b/gcc/config/nvptx/nvptx.h
@@ -27,7 +27,7 @@
 
 /* Run-time Target.  */
 
-#define STARTFILE_SPEC "%{mmainkernel:crt0.o}"
+#define STARTFILE_SPEC "%{mmainkernel:crt0.o%s}"
 
 /* Default needs to be in sync with default for misa in nvptx.opt.
    We add a default here to work around a hard-coded sm_30 default in

                 reply	other threads:[~2022-11-19 14:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221119144430.0985F3858D1E@sourceware.org \
    --to=tschwinge@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).