[llvm] e2e32f0 - [gn build] Add rules for crtbegin/end (#66012)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 16 12:50:27 PDT 2023
Author: Arthur Eubanks
Date: 2023-10-16T12:50:24-07:00
New Revision: e2e32f091a903a57c9fd8778c88488d32330ca6e
URL: https://github.com/llvm/llvm-project/commit/e2e32f091a903a57c9fd8778c88488d32330ca6e
DIFF: https://github.com/llvm/llvm-project/commit/e2e32f091a903a57c9fd8778c88488d32330ca6e.diff
LOG: [gn build] Add rules for crtbegin/end (#66012)
Added:
Modified:
llvm/utils/gn/secondary/compiler-rt/lib/BUILD.gn
llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn
Removed:
################################################################################
diff --git a/llvm/utils/gn/secondary/compiler-rt/lib/BUILD.gn b/llvm/utils/gn/secondary/compiler-rt/lib/BUILD.gn
index d8c75a01c6945eb..398b95a06b805e3 100644
--- a/llvm/utils/gn/secondary/compiler-rt/lib/BUILD.gn
+++ b/llvm/utils/gn/secondary/compiler-rt/lib/BUILD.gn
@@ -5,7 +5,10 @@ group("lib") {
"//compiler-rt/lib/cfi:ignorelist($host_toolchain)",
]
if (current_os == "linux") {
- deps += [ "//compiler-rt/lib/msan" ]
+ deps += [
+ "//compiler-rt/lib/builtins:crt",
+ "//compiler-rt/lib/msan",
+ ]
}
if (current_os == "linux" || current_os == "android") {
deps += [ "//compiler-rt/lib/ubsan_minimal" ]
diff --git a/llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn b/llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn
index 303a6c29d7b91e2..a45795d194c6127 100644
--- a/llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn
+++ b/llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn
@@ -574,6 +574,38 @@ static_library("builtins") {
deps = lse_targets
}
+if (current_os == "linux") {
+ source_set("crt_src") {
+ sources = [
+ "crtbegin.c",
+ "crtend.c",
+ ]
+ cflags = [
+ "-std=c11",
+ "-fPIC",
+ ]
+ }
+ copy("crtbegin") {
+ # TODO: use get_target_outputs if it ever works with source_set to avoid hardcoding crt_src.crtbegin.o
+ input_dir = get_label_info(":crt_src", "target_out_dir")
+ sources = [ "$input_dir/crt_src.crtbegin.o" ]
+ outputs = [ "$crt_current_out_dir/clang_rt.crtbegin.o" ]
+ deps = [ ":crt_src" ]
+ }
+ copy("crtend") {
+ input_dir = get_label_info(":crt_src", "target_out_dir")
+ sources = [ "$input_dir/crt_src.crtend.o" ]
+ outputs = [ "$crt_current_out_dir/clang_rt.crtend.o" ]
+ deps = [ ":crt_src" ]
+ }
+ group("crt") {
+ deps = [
+ ":crtbegin",
+ ":crtend",
+ ]
+ }
+}
+
# Currently unused but necessary to make sync_source_lists_from_cmake.py happy.
source_set("_unused") {
sources = [
More information about the llvm-commits
mailing list