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