public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Stan Shebs <shebs@sourceware.org>
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
Date: Tue,  9 Jun 2020 17:10:07 +0000 (GMT)	[thread overview]
Message-ID: <20200609171007.AF1A83840C14@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=07fd96dba6bb8aeeb137bb628d6a3eabc395c170

commit 07fd96dba6bb8aeeb137bb628d6a3eabc395c170
Author: Stan Shebs <stanshebs@google.com>
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/


             reply	other threads:[~2020-06-09 17:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-09 17:10 Stan Shebs [this message]
2021-08-28  0:37 Fangrui Song

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=20200609171007.AF1A83840C14@sourceware.org \
    --to=shebs@sourceware.org \
    --cc=glibc-cvs@sourceware.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).