Skip to content

Commit

Permalink
[gn build] Add rules for crtbegin/end (#66012)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeubanks authored Oct 16, 2023
1 parent 4718b40 commit e2e32f0
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
5 changes: 4 additions & 1 deletion llvm/utils/gn/secondary/compiler-rt/lib/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
Expand Down
32 changes: 32 additions & 0 deletions llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down

0 comments on commit e2e32f0

Please sign in to comment.