From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id 5ECD83858D28; Sat, 19 Nov 2022 14:44:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5ECD83858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668869060; bh=p5H5vGsgqBD5xOHXUVMxhcH1DdCkk8KAGFmv6r1C7do=; h=From:To:Subject:Date:From; b=hcletGZ/NXFGAnzL7zAWV5wSaYZO7WbE6cACndmx2PKiSLJ4SK30f84MYBmrdhcCS GtXdnVziqY1PYgzIwa/VbUCS5IG82CB+26BzscJwTwkVbccc1u9yJZ36WzVTiLRb60 xzFyfesYfVfAC2Gncx5r7rwSaMFd2iCq2umBMLjE= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Thomas Schwinge To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-8919] nvptx: In 'STARTFILE_SPEC', fix 'crt0.o' for '-mmainkernel' X-Act-Checkin: gcc X-Git-Author: Thomas Schwinge X-Git-Refname: refs/heads/releases/gcc-12 X-Git-Oldrev: 2adcbcc69a1d5d9554042f09ec35e72bf39fb56f X-Git-Newrev: fab0fce5c198b4cc51e07caca6421928b832efe2 Message-Id: <20221119144420.5ECD83858D28@sourceware.org> Date: Sat, 19 Nov 2022 14:44:20 +0000 (GMT) List-Id: https://gcc.gnu.org/g:fab0fce5c198b4cc51e07caca6421928b832efe2 commit r12-8919-gfab0fce5c198b4cc51e07caca6421928b832efe2 Author: Thomas Schwinge 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 "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 ed72c253191..294dd715c3d 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}" #define TARGET_CPU_CPP_BUILTINS() nvptx_cpu_cpp_builtins ()