[libc-commits] [libc] [libc] Add `Scrt1.o` to `startup_components` (PR #97497)
Izaak Schroeder via libc-commits
libc-commits at lists.llvm.org
Tue Jul 2 17:44:27 PDT 2024
https://github.com/izaakschroeder created https://github.com/llvm/llvm-project/pull/97497
Needs for `-fpie` targets. Don't know if this is safe or not... but it seems to run compiled executables.
>From 7efe4b0502d2973ab5c2a0b4707ddfcdf675cdc3 Mon Sep 17 00:00:00 2001
From: Izaak Schroeder <izaak.schroeder at gmail.com>
Date: Sun, 30 Jun 2024 14:15:21 -0700
Subject: [PATCH] [libc] Add `Scrt1.o` to `startup_components`
Needs for `-fpie` targets. Don't know if this is safe or not... but it seems to run compiled executables.
---
libc/startup/linux/CMakeLists.txt | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/libc/startup/linux/CMakeLists.txt b/libc/startup/linux/CMakeLists.txt
index 336c5d0f6bfa2..b721d15091227 100644
--- a/libc/startup/linux/CMakeLists.txt
+++ b/libc/startup/linux/CMakeLists.txt
@@ -118,6 +118,15 @@ merge_relocatable_object(
.do_start
)
+# HACK: Is this even ok?
+# For reference: `Scrt1` is used when `-fpie` vs `crt1` for `-fno-pie`
+merge_relocatable_object(
+ Scrt1
+ .${LIBC_TARGET_ARCHITECTURE}.start
+ .${LIBC_TARGET_ARCHITECTURE}.tls
+ .do_start
+)
+
add_startup_object(
crti
SRC
@@ -131,7 +140,7 @@ add_startup_object(
)
add_custom_target(libc-startup)
-set(startup_components crt1 crti crtn)
+set(startup_components Scrt1 crt1 crti crtn)
foreach(target IN LISTS startup_components)
set(fq_target_name libc.startup.linux.${target})
add_dependencies(libc-startup ${fq_target_name})
More information about the libc-commits
mailing list