public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/maskray/grte] Use crt*.o files from llvm compiler-rt when building with clang
@ 2021-08-28  0:29 Fangrui Song
  0 siblings, 0 replies; 3+ messages in thread
From: Fangrui Song @ 2021-08-28  0:29 UTC (permalink / raw)
  To: glibc-cvs

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

commit b7a7a3008ea3096ba7d4e88a893a2ca66a31ba4f
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/


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [glibc/maskray/grte] Use crt*.o files from llvm compiler-rt when building with clang
@ 2021-08-28  0:33 Fangrui Song
  0 siblings, 0 replies; 3+ messages in thread
From: Fangrui Song @ 2021-08-28  0:33 UTC (permalink / raw)
  To: glibc-cvs

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

commit e62db8fce49a3437dbda71e4b7058954595939f5
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/


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [glibc/maskray/grte] Use crt*.o files from llvm compiler-rt when building with clang
@ 2021-08-27 23:46 Fangrui Song
  0 siblings, 0 replies; 3+ messages in thread
From: Fangrui Song @ 2021-08-27 23:46 UTC (permalink / raw)
  To: glibc-cvs

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

commit d6a51badbb349e170107ad7a4885a7e2b8a58ab3
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/


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-28  0:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-28  0:29 [glibc/maskray/grte] Use crt*.o files from llvm compiler-rt when building with clang Fangrui Song
  -- strict thread matches above, loose matches on Subject: below --
2021-08-28  0:33 Fangrui Song
2021-08-27 23:46 Fangrui Song

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).