Skip to content

Commit 27433d6

Browse files
jgmelberclaudeandrej
authored
Force PIE on bootgen to fix PDI-generation segfault (#3327)
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com> Co-authored-by: André Rösti <an.roesti@gmail.com>
1 parent ee23ed1 commit 27433d6

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

tools/bootgen/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ string(REPLACE "#include \"openssl/ms/applink.c\"" "" FILE_CONTENTS "${FILE_CONT
107107
file(WRITE ${BOOTGEN_SOURCE}/main.cpp "${FILE_CONTENTS}")
108108

109109
add_library(bootgen-lib STATIC ${libsources})
110+
# bootgen must be compiled with PIE/PIC, irrespective of the remainder of
111+
# the project, because auditwheel repair's patchelf-based RPATH rewrite
112+
# corrupts the non-PIE binary
113+
set_target_properties(bootgen-lib PROPERTIES POSITION_INDEPENDENT_CODE ON)
110114
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
111115
set(bootgen_warning_ignores
112116
-Wno-cast-qual
@@ -154,6 +158,7 @@ install(
154158
DESTINATION include)
155159

156160
add_executable(bootgen ${BOOTGEN_SOURCE}/main.cpp)
161+
set_target_properties(bootgen PROPERTIES POSITION_INDEPENDENT_CODE ON)
157162
target_include_directories(bootgen PUBLIC ${BOOTGEN_SOURCE} ${OPENSSL_INCLUDE_DIR}
158163
${CMAKE_CURRENT_BINARY_DIR}/include)
159164
target_compile_options(bootgen PRIVATE ${bootgen_warning_ignores})

0 commit comments

Comments
 (0)