[libc-commits] [libc] [libc] Baremetal target builds should be static (PR #208055)
Prabhu Rajasekaran via libc-commits
libc-commits at lists.llvm.org
Tue Jul 7 10:52:13 PDT 2026
https://github.com/Prabhuk created https://github.com/llvm/llvm-project/pull/208055
We are noticing that the baremetal target builds produce GOT relocations
since we set `-fpie`. Excluding baremetal builds from setting this flag
as they are typically just static builds.
>From b9d0d1a747838136eb6ef3d2d9d68a20aaa23146 Mon Sep 17 00:00:00 2001
From: prabhukr <prabhukr at google.com>
Date: Tue, 7 Jul 2026 17:16:15 +0000
Subject: [PATCH] [libc] Baremetal target builds should be static
We are noticing that the baremetal target builds produce GOT relocations
since we set `-fpie`. Excluding baremetal builds from setting this flag
as they are typically just static builds.
---
libc/cmake/modules/LLVMLibCCompileOptionRules.cmake | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
index b013152effa4c..ebc82c2ac8cee 100644
--- a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
+++ b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
@@ -223,7 +223,9 @@ function(_get_common_compile_options output_var flags)
set(compile_options ${LIBC_COMPILE_OPTIONS_DEFAULT} ${compile_flags} ${config_flags} ${arch_flags})
if(LLVM_LIBC_COMPILER_IS_GCC_COMPATIBLE)
- list(APPEND compile_options "-fpie")
+ if(NOT LIBC_TARGET_OS_IS_BAREMETAL)
+ list(APPEND compile_options "-fpie")
+ endif()
if(LLVM_LIBC_FULL_BUILD)
# Only add -ffreestanding flag in non-GPU full build mode.
More information about the libc-commits
mailing list