From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2154) id AF1A83840C14; Tue, 9 Jun 2020 17:10:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AF1A83840C14 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Stan Shebs To: glibc-cvs@sourceware.org Subject: [glibc/google/grte/v5-2.27/master] Use crt*.o files from llvm compiler-rt when building with clang X-Act-Checkin: glibc X-Git-Author: Stan Shebs X-Git-Refname: refs/heads/google/grte/v5-2.27/master X-Git-Oldrev: 7e9285612d997d7cface8141ad4db191758864c4 X-Git-Newrev: 07fd96dba6bb8aeeb137bb628d6a3eabc395c170 Message-Id: <20200609171007.AF1A83840C14@sourceware.org> Date: Tue, 9 Jun 2020 17:10:07 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jun 2020 17:10:07 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=07fd96dba6bb8aeeb137bb628d6a3eabc395c170 commit 07fd96dba6bb8aeeb137bb628d6a3eabc395c170 Author: Stan Shebs Date: Tue Jun 9 10:09:34 2020 -0700 Use crt*.o files from llvm compiler-rt when building with clang Diff: --- Makeconfig | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Makeconfig b/Makeconfig index ff744a8f0d..f5cd92014f 100644 --- a/Makeconfig +++ b/Makeconfig @@ -661,20 +661,40 @@ libc.so-gnulib := -lgcc endif +preinit = $(addprefix $(csu-objpfx),crti.o) +postinit = $(addprefix $(csu-objpfx),crtn.o) +ifeq ($(with-clang),yes) +# With clang, use the crt*.o files from llvm's compiler-rt package. +# The files normally have an architecture name appended, in case of +# variants (32/64, le/be etc) installed in the same directory. ++prector = `$(CC) $(sysdep-LDFLAGS) --print-file-name=clang_rt.crtbegin-$(config-machine).o` ++postctor = `$(CC) $(sysdep-LDFLAGS) --print-file-name=clang_rt.crtend-$(config-machine).o` +else +prector = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbegin.o` +postctor = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o` +endif # Variants of the two previous definitions for linking PIE programs. +ifeq ($(with-clang),yes) +# compiler-rt crt*.o also works for PIE. ++prectorS = $(+prector) ++postctorS = $(+postctor) +else +prectorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginS.o` +postctorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtendS.o` +endif # Variants of the two previous definitions for statically linking programs. ifeq (yes,$(enable-static-pie)) # Static PIE must use PIE variants. +prectorT = $(+prectorS) +postctorT = $(+postctorS) else +ifeq ($(with-clang),yes) +# compiler-rt crt*.o also works for static PIE. ++prectorT = $(+prector) ++postctorT = $(+postctor) +else +prectorT = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginT.o` +postctorT = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o` endif +endif csu-objpfx = $(common-objpfx)csu/ elf-objpfx = $(common-objpfx)elf/