Merge pull request #57980 from dtzWill/update/compilerrt-crtbegin-patch

llvmPackages_{7,8}.compiler-rt: update crtbegin-and-end.patch

authored by Will Dietz and committed by GitHub baa62d9a 31ba1d6f

+30 -30
+15 -15
pkgs/development/compilers/llvm/7/crtbegin-and-end.patch
··· 156 156 =================================================================== 157 157 --- /dev/null 158 158 +++ compiler-rt/lib/crt/CMakeLists.txt 159 - @@ -0,0 +1,101 @@ 159 + @@ -0,0 +1,102 @@ 160 160 +add_compiler_rt_component(crt) 161 161 + 162 162 +function(check_cxx_section_exists section output) ··· 216 216 + OUTPUT_VARIABLE CHECK_OUTPUT 217 217 + ERROR_VARIABLE CHECK_ERROR 218 218 + ) 219 - + string(FIND ${CHECK_OUTPUT} ${section} SECTION_FOUND) 219 + + string(FIND "${CHECK_OUTPUT}" "${section}" SECTION_FOUND) 220 220 + 221 221 + if(NOT SECTION_FOUND EQUAL -1) 222 222 + set(${output} TRUE PARENT_SCOPE) ··· 231 231 + SOURCE "__attribute__((constructor)) void f() {}\nint main() { return 0; }\n") 232 232 + 233 233 +append_list_if(COMPILER_RT_HAS_INITFINI_ARRAY -DCRT_HAS_INITFINI_ARRAY CRT_CFLAGS) 234 + +append_list_if(COMPILER_RT_HAS_FPIC_FLAG -fPIC CRT_CFLAGS) 234 235 + 235 236 +foreach(arch ${CRT_SUPPORTED_ARCH}) 236 237 + add_compiler_rt_runtime(clang_rt.crtbegin ··· 243 244 + OBJECT 244 245 + ARCHS ${arch} 245 246 + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/crtbegin.c 246 - + CFLAGS ${CRT_CFLAGS} -DCRT_SHARED -fPIC 247 + + CFLAGS ${CRT_CFLAGS} -DCRT_SHARED 247 248 + PARENT_TARGET crt) 248 249 + add_compiler_rt_runtime(clang_rt.crtend 249 250 + OBJECT ··· 255 256 + OBJECT 256 257 + ARCHS ${arch} 257 258 + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/crtend.c 258 - + CFLAGS ${CRT_CFLAGS} -DCRT_SHARED -fPIC 259 + + CFLAGS ${CRT_CFLAGS} -DCRT_SHARED 259 260 + PARENT_TARGET crt) 260 261 +endforeach() 261 262 Index: compiler-rt/lib/crt/crtbegin.c 262 263 =================================================================== 263 264 --- /dev/null 264 265 +++ compiler-rt/lib/crt/crtbegin.c 265 - @@ -0,0 +1,110 @@ 266 + @@ -0,0 +1,108 @@ 266 267 +/* ===-- crtbegin.c - Start of constructors and destructors ----------------=== 267 268 + * 268 269 + * The LLVM Compiler Infrastructure ··· 282 283 +void *__dso_handle = (void *)0; 283 284 +#endif 284 285 + 285 - +static long __EH_FRAME_LIST__[] __attribute__(( 286 - + section(".eh_frame"), aligned(sizeof(void *)), visibility("hidden"))) = {}; 286 + +static long __EH_FRAME_LIST__[] 287 + + __attribute__((section(".eh_frame"), aligned(sizeof(void *)))) = {}; 287 288 + 288 289 +extern void __register_frame_info(const void *, void *) __attribute__((weak)); 289 290 +extern void *__deregister_frame_info(const void *) __attribute__((weak)); ··· 292 293 +typedef void (*fp)(void); 293 294 + 294 295 +static fp __CTOR_LIST__[] 295 - + __attribute__((section(".ctors"), aligned(sizeof(fp)), visibility("hidden"), 296 - + used)) = {(fp)-1}; 297 - +extern fp __CTOR_LIST_END__[] __attribute__((visibility("hidden"))); 296 + + __attribute__((section(".ctors"), aligned(sizeof(fp)), used)) = {(fp)-1}; 297 + +extern fp __CTOR_LIST_END__[]; 298 298 +#endif 299 299 + 300 300 +#ifdef CRT_SHARED ··· 334 334 + 335 335 +#ifndef CRT_HAS_INITFINI_ARRAY 336 336 +static fp __DTOR_LIST__[] 337 - + __attribute__((section(".dtors"), aligned(sizeof(fp)), visibility("hidden"), 338 - + used)) = {(fp)-1}; 339 - +extern fp __DTOR_LIST_END__[] __attribute__((visibility("hidden"))); 337 + + __attribute__((section(".dtors"), aligned(sizeof(fp)), used)) = {(fp)-1}; 338 + +extern fp __DTOR_LIST_END__[]; 340 339 +#endif 341 340 + 342 341 +static void __attribute__((used)) __do_fini() { ··· 377 376 =================================================================== 378 377 --- /dev/null 379 378 +++ compiler-rt/lib/crt/crtend.c 380 - @@ -0,0 +1,23 @@ 379 + @@ -0,0 +1,24 @@ 381 380 +/* ===-- crtend.c - End of constructors and destructors --------------------=== 382 381 + * 383 382 + * The LLVM Compiler Infrastructure ··· 392 391 + 393 392 +// Put 4-byte zero which is the length field in FDE at the end as a terminator. 394 393 +const int32_t __EH_FRAME_LIST_END__[] 395 - + __attribute__((section(".eh_frame"), aligned(sizeof(int32_t)), used)) = {0}; 394 + + __attribute__((section(".eh_frame"), aligned(sizeof(int32_t)), 395 + + visibility("hidden"), used)) = {0}; 396 396 + 397 397 +#ifndef CRT_HAS_INITFINI_ARRAY 398 398 +typedef void (*fp)(void);
+15 -15
pkgs/development/compilers/llvm/8/crtbegin-and-end.patch
··· 156 156 =================================================================== 157 157 --- /dev/null 158 158 +++ compiler-rt/lib/crt/CMakeLists.txt 159 - @@ -0,0 +1,101 @@ 159 + @@ -0,0 +1,102 @@ 160 160 +add_compiler_rt_component(crt) 161 161 + 162 162 +function(check_cxx_section_exists section output) ··· 216 216 + OUTPUT_VARIABLE CHECK_OUTPUT 217 217 + ERROR_VARIABLE CHECK_ERROR 218 218 + ) 219 - + string(FIND ${CHECK_OUTPUT} ${section} SECTION_FOUND) 219 + + string(FIND "${CHECK_OUTPUT}" "${section}" SECTION_FOUND) 220 220 + 221 221 + if(NOT SECTION_FOUND EQUAL -1) 222 222 + set(${output} TRUE PARENT_SCOPE) ··· 231 231 + SOURCE "__attribute__((constructor)) void f() {}\nint main() { return 0; }\n") 232 232 + 233 233 +append_list_if(COMPILER_RT_HAS_INITFINI_ARRAY -DCRT_HAS_INITFINI_ARRAY CRT_CFLAGS) 234 + +append_list_if(COMPILER_RT_HAS_FPIC_FLAG -fPIC CRT_CFLAGS) 234 235 + 235 236 +foreach(arch ${CRT_SUPPORTED_ARCH}) 236 237 + add_compiler_rt_runtime(clang_rt.crtbegin ··· 243 244 + OBJECT 244 245 + ARCHS ${arch} 245 246 + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/crtbegin.c 246 - + CFLAGS ${CRT_CFLAGS} -DCRT_SHARED -fPIC 247 + + CFLAGS ${CRT_CFLAGS} -DCRT_SHARED 247 248 + PARENT_TARGET crt) 248 249 + add_compiler_rt_runtime(clang_rt.crtend 249 250 + OBJECT ··· 255 256 + OBJECT 256 257 + ARCHS ${arch} 257 258 + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/crtend.c 258 - + CFLAGS ${CRT_CFLAGS} -DCRT_SHARED -fPIC 259 + + CFLAGS ${CRT_CFLAGS} -DCRT_SHARED 259 260 + PARENT_TARGET crt) 260 261 +endforeach() 261 262 Index: compiler-rt/lib/crt/crtbegin.c 262 263 =================================================================== 263 264 --- /dev/null 264 265 +++ compiler-rt/lib/crt/crtbegin.c 265 - @@ -0,0 +1,110 @@ 266 + @@ -0,0 +1,108 @@ 266 267 +/* ===-- crtbegin.c - Start of constructors and destructors ----------------=== 267 268 + * 268 269 + * The LLVM Compiler Infrastructure ··· 282 283 +void *__dso_handle = (void *)0; 283 284 +#endif 284 285 + 285 - +static long __EH_FRAME_LIST__[] __attribute__(( 286 - + section(".eh_frame"), aligned(sizeof(void *)), visibility("hidden"))) = {}; 286 + +static long __EH_FRAME_LIST__[] 287 + + __attribute__((section(".eh_frame"), aligned(sizeof(void *)))) = {}; 287 288 + 288 289 +extern void __register_frame_info(const void *, void *) __attribute__((weak)); 289 290 +extern void *__deregister_frame_info(const void *) __attribute__((weak)); ··· 292 293 +typedef void (*fp)(void); 293 294 + 294 295 +static fp __CTOR_LIST__[] 295 - + __attribute__((section(".ctors"), aligned(sizeof(fp)), visibility("hidden"), 296 - + used)) = {(fp)-1}; 297 - +extern fp __CTOR_LIST_END__[] __attribute__((visibility("hidden"))); 296 + + __attribute__((section(".ctors"), aligned(sizeof(fp)), used)) = {(fp)-1}; 297 + +extern fp __CTOR_LIST_END__[]; 298 298 +#endif 299 299 + 300 300 +#ifdef CRT_SHARED ··· 334 334 + 335 335 +#ifndef CRT_HAS_INITFINI_ARRAY 336 336 +static fp __DTOR_LIST__[] 337 - + __attribute__((section(".dtors"), aligned(sizeof(fp)), visibility("hidden"), 338 - + used)) = {(fp)-1}; 339 - +extern fp __DTOR_LIST_END__[] __attribute__((visibility("hidden"))); 337 + + __attribute__((section(".dtors"), aligned(sizeof(fp)), used)) = {(fp)-1}; 338 + +extern fp __DTOR_LIST_END__[]; 340 339 +#endif 341 340 + 342 341 +static void __attribute__((used)) __do_fini() { ··· 377 376 =================================================================== 378 377 --- /dev/null 379 378 +++ compiler-rt/lib/crt/crtend.c 380 - @@ -0,0 +1,23 @@ 379 + @@ -0,0 +1,24 @@ 381 380 +/* ===-- crtend.c - End of constructors and destructors --------------------=== 382 381 + * 383 382 + * The LLVM Compiler Infrastructure ··· 392 391 + 393 392 +// Put 4-byte zero which is the length field in FDE at the end as a terminator. 394 393 +const int32_t __EH_FRAME_LIST_END__[] 395 - + __attribute__((section(".eh_frame"), aligned(sizeof(int32_t)), used)) = {0}; 394 + + __attribute__((section(".eh_frame"), aligned(sizeof(int32_t)), 395 + + visibility("hidden"), used)) = {0}; 396 396 + 397 397 +#ifndef CRT_HAS_INITFINI_ARRAY 398 398 +typedef void (*fp)(void);