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

llvmPackages_{7,8}.compiler-rt: update crtbegin-and-end.patch
This commit is contained in:
Will Dietz 2019-03-21 17:47:51 -05:00 committed by GitHub
commit baa62d9ac6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 30 deletions

View File

@ -156,7 +156,7 @@ Index: compiler-rt/lib/crt/CMakeLists.txt
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ compiler-rt/lib/crt/CMakeLists.txt +++ compiler-rt/lib/crt/CMakeLists.txt
@@ -0,0 +1,101 @@ @@ -0,0 +1,102 @@
+add_compiler_rt_component(crt) +add_compiler_rt_component(crt)
+ +
+function(check_cxx_section_exists section output) +function(check_cxx_section_exists section output)
@ -216,7 +216,7 @@ Index: compiler-rt/lib/crt/CMakeLists.txt
+ OUTPUT_VARIABLE CHECK_OUTPUT + OUTPUT_VARIABLE CHECK_OUTPUT
+ ERROR_VARIABLE CHECK_ERROR + ERROR_VARIABLE CHECK_ERROR
+ ) + )
+ string(FIND ${CHECK_OUTPUT} ${section} SECTION_FOUND) + string(FIND "${CHECK_OUTPUT}" "${section}" SECTION_FOUND)
+ +
+ if(NOT SECTION_FOUND EQUAL -1) + if(NOT SECTION_FOUND EQUAL -1)
+ set(${output} TRUE PARENT_SCOPE) + set(${output} TRUE PARENT_SCOPE)
@ -231,6 +231,7 @@ Index: compiler-rt/lib/crt/CMakeLists.txt
+ SOURCE "__attribute__((constructor)) void f() {}\nint main() { return 0; }\n") + SOURCE "__attribute__((constructor)) void f() {}\nint main() { return 0; }\n")
+ +
+append_list_if(COMPILER_RT_HAS_INITFINI_ARRAY -DCRT_HAS_INITFINI_ARRAY CRT_CFLAGS) +append_list_if(COMPILER_RT_HAS_INITFINI_ARRAY -DCRT_HAS_INITFINI_ARRAY CRT_CFLAGS)
+append_list_if(COMPILER_RT_HAS_FPIC_FLAG -fPIC CRT_CFLAGS)
+ +
+foreach(arch ${CRT_SUPPORTED_ARCH}) +foreach(arch ${CRT_SUPPORTED_ARCH})
+ add_compiler_rt_runtime(clang_rt.crtbegin + add_compiler_rt_runtime(clang_rt.crtbegin
@ -243,7 +244,7 @@ Index: compiler-rt/lib/crt/CMakeLists.txt
+ OBJECT + OBJECT
+ ARCHS ${arch} + ARCHS ${arch}
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/crtbegin.c + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/crtbegin.c
+ CFLAGS ${CRT_CFLAGS} -DCRT_SHARED -fPIC + CFLAGS ${CRT_CFLAGS} -DCRT_SHARED
+ PARENT_TARGET crt) + PARENT_TARGET crt)
+ add_compiler_rt_runtime(clang_rt.crtend + add_compiler_rt_runtime(clang_rt.crtend
+ OBJECT + OBJECT
@ -255,14 +256,14 @@ Index: compiler-rt/lib/crt/CMakeLists.txt
+ OBJECT + OBJECT
+ ARCHS ${arch} + ARCHS ${arch}
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/crtend.c + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/crtend.c
+ CFLAGS ${CRT_CFLAGS} -DCRT_SHARED -fPIC + CFLAGS ${CRT_CFLAGS} -DCRT_SHARED
+ PARENT_TARGET crt) + PARENT_TARGET crt)
+endforeach() +endforeach()
Index: compiler-rt/lib/crt/crtbegin.c Index: compiler-rt/lib/crt/crtbegin.c
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ compiler-rt/lib/crt/crtbegin.c +++ compiler-rt/lib/crt/crtbegin.c
@@ -0,0 +1,110 @@ @@ -0,0 +1,108 @@
+/* ===-- crtbegin.c - Start of constructors and destructors ----------------=== +/* ===-- crtbegin.c - Start of constructors and destructors ----------------===
+ * + *
+ * The LLVM Compiler Infrastructure + * The LLVM Compiler Infrastructure
@ -282,8 +283,8 @@ Index: compiler-rt/lib/crt/crtbegin.c
+void *__dso_handle = (void *)0; +void *__dso_handle = (void *)0;
+#endif +#endif
+ +
+static long __EH_FRAME_LIST__[] __attribute__(( +static long __EH_FRAME_LIST__[]
+ section(".eh_frame"), aligned(sizeof(void *)), visibility("hidden"))) = {}; + __attribute__((section(".eh_frame"), aligned(sizeof(void *)))) = {};
+ +
+extern void __register_frame_info(const void *, void *) __attribute__((weak)); +extern void __register_frame_info(const void *, void *) __attribute__((weak));
+extern void *__deregister_frame_info(const void *) __attribute__((weak)); +extern void *__deregister_frame_info(const void *) __attribute__((weak));
@ -292,9 +293,8 @@ Index: compiler-rt/lib/crt/crtbegin.c
+typedef void (*fp)(void); +typedef void (*fp)(void);
+ +
+static fp __CTOR_LIST__[] +static fp __CTOR_LIST__[]
+ __attribute__((section(".ctors"), aligned(sizeof(fp)), visibility("hidden"), + __attribute__((section(".ctors"), aligned(sizeof(fp)), used)) = {(fp)-1};
+ used)) = {(fp)-1}; +extern fp __CTOR_LIST_END__[];
+extern fp __CTOR_LIST_END__[] __attribute__((visibility("hidden")));
+#endif +#endif
+ +
+#ifdef CRT_SHARED +#ifdef CRT_SHARED
@ -334,9 +334,8 @@ Index: compiler-rt/lib/crt/crtbegin.c
+ +
+#ifndef CRT_HAS_INITFINI_ARRAY +#ifndef CRT_HAS_INITFINI_ARRAY
+static fp __DTOR_LIST__[] +static fp __DTOR_LIST__[]
+ __attribute__((section(".dtors"), aligned(sizeof(fp)), visibility("hidden"), + __attribute__((section(".dtors"), aligned(sizeof(fp)), used)) = {(fp)-1};
+ used)) = {(fp)-1}; +extern fp __DTOR_LIST_END__[];
+extern fp __DTOR_LIST_END__[] __attribute__((visibility("hidden")));
+#endif +#endif
+ +
+static void __attribute__((used)) __do_fini() { +static void __attribute__((used)) __do_fini() {
@ -377,7 +376,7 @@ Index: compiler-rt/lib/crt/crtend.c
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ compiler-rt/lib/crt/crtend.c +++ compiler-rt/lib/crt/crtend.c
@@ -0,0 +1,23 @@ @@ -0,0 +1,24 @@
+/* ===-- crtend.c - End of constructors and destructors --------------------=== +/* ===-- crtend.c - End of constructors and destructors --------------------===
+ * + *
+ * The LLVM Compiler Infrastructure + * The LLVM Compiler Infrastructure
@ -392,7 +391,8 @@ Index: compiler-rt/lib/crt/crtend.c
+ +
+// Put 4-byte zero which is the length field in FDE at the end as a terminator. +// Put 4-byte zero which is the length field in FDE at the end as a terminator.
+const int32_t __EH_FRAME_LIST_END__[] +const int32_t __EH_FRAME_LIST_END__[]
+ __attribute__((section(".eh_frame"), aligned(sizeof(int32_t)), used)) = {0}; + __attribute__((section(".eh_frame"), aligned(sizeof(int32_t)),
+ visibility("hidden"), used)) = {0};
+ +
+#ifndef CRT_HAS_INITFINI_ARRAY +#ifndef CRT_HAS_INITFINI_ARRAY
+typedef void (*fp)(void); +typedef void (*fp)(void);

View File

@ -156,7 +156,7 @@ Index: compiler-rt/lib/crt/CMakeLists.txt
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ compiler-rt/lib/crt/CMakeLists.txt +++ compiler-rt/lib/crt/CMakeLists.txt
@@ -0,0 +1,101 @@ @@ -0,0 +1,102 @@
+add_compiler_rt_component(crt) +add_compiler_rt_component(crt)
+ +
+function(check_cxx_section_exists section output) +function(check_cxx_section_exists section output)
@ -216,7 +216,7 @@ Index: compiler-rt/lib/crt/CMakeLists.txt
+ OUTPUT_VARIABLE CHECK_OUTPUT + OUTPUT_VARIABLE CHECK_OUTPUT
+ ERROR_VARIABLE CHECK_ERROR + ERROR_VARIABLE CHECK_ERROR
+ ) + )
+ string(FIND ${CHECK_OUTPUT} ${section} SECTION_FOUND) + string(FIND "${CHECK_OUTPUT}" "${section}" SECTION_FOUND)
+ +
+ if(NOT SECTION_FOUND EQUAL -1) + if(NOT SECTION_FOUND EQUAL -1)
+ set(${output} TRUE PARENT_SCOPE) + set(${output} TRUE PARENT_SCOPE)
@ -231,6 +231,7 @@ Index: compiler-rt/lib/crt/CMakeLists.txt
+ SOURCE "__attribute__((constructor)) void f() {}\nint main() { return 0; }\n") + SOURCE "__attribute__((constructor)) void f() {}\nint main() { return 0; }\n")
+ +
+append_list_if(COMPILER_RT_HAS_INITFINI_ARRAY -DCRT_HAS_INITFINI_ARRAY CRT_CFLAGS) +append_list_if(COMPILER_RT_HAS_INITFINI_ARRAY -DCRT_HAS_INITFINI_ARRAY CRT_CFLAGS)
+append_list_if(COMPILER_RT_HAS_FPIC_FLAG -fPIC CRT_CFLAGS)
+ +
+foreach(arch ${CRT_SUPPORTED_ARCH}) +foreach(arch ${CRT_SUPPORTED_ARCH})
+ add_compiler_rt_runtime(clang_rt.crtbegin + add_compiler_rt_runtime(clang_rt.crtbegin
@ -243,7 +244,7 @@ Index: compiler-rt/lib/crt/CMakeLists.txt
+ OBJECT + OBJECT
+ ARCHS ${arch} + ARCHS ${arch}
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/crtbegin.c + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/crtbegin.c
+ CFLAGS ${CRT_CFLAGS} -DCRT_SHARED -fPIC + CFLAGS ${CRT_CFLAGS} -DCRT_SHARED
+ PARENT_TARGET crt) + PARENT_TARGET crt)
+ add_compiler_rt_runtime(clang_rt.crtend + add_compiler_rt_runtime(clang_rt.crtend
+ OBJECT + OBJECT
@ -255,14 +256,14 @@ Index: compiler-rt/lib/crt/CMakeLists.txt
+ OBJECT + OBJECT
+ ARCHS ${arch} + ARCHS ${arch}
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/crtend.c + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/crtend.c
+ CFLAGS ${CRT_CFLAGS} -DCRT_SHARED -fPIC + CFLAGS ${CRT_CFLAGS} -DCRT_SHARED
+ PARENT_TARGET crt) + PARENT_TARGET crt)
+endforeach() +endforeach()
Index: compiler-rt/lib/crt/crtbegin.c Index: compiler-rt/lib/crt/crtbegin.c
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ compiler-rt/lib/crt/crtbegin.c +++ compiler-rt/lib/crt/crtbegin.c
@@ -0,0 +1,110 @@ @@ -0,0 +1,108 @@
+/* ===-- crtbegin.c - Start of constructors and destructors ----------------=== +/* ===-- crtbegin.c - Start of constructors and destructors ----------------===
+ * + *
+ * The LLVM Compiler Infrastructure + * The LLVM Compiler Infrastructure
@ -282,8 +283,8 @@ Index: compiler-rt/lib/crt/crtbegin.c
+void *__dso_handle = (void *)0; +void *__dso_handle = (void *)0;
+#endif +#endif
+ +
+static long __EH_FRAME_LIST__[] __attribute__(( +static long __EH_FRAME_LIST__[]
+ section(".eh_frame"), aligned(sizeof(void *)), visibility("hidden"))) = {}; + __attribute__((section(".eh_frame"), aligned(sizeof(void *)))) = {};
+ +
+extern void __register_frame_info(const void *, void *) __attribute__((weak)); +extern void __register_frame_info(const void *, void *) __attribute__((weak));
+extern void *__deregister_frame_info(const void *) __attribute__((weak)); +extern void *__deregister_frame_info(const void *) __attribute__((weak));
@ -292,9 +293,8 @@ Index: compiler-rt/lib/crt/crtbegin.c
+typedef void (*fp)(void); +typedef void (*fp)(void);
+ +
+static fp __CTOR_LIST__[] +static fp __CTOR_LIST__[]
+ __attribute__((section(".ctors"), aligned(sizeof(fp)), visibility("hidden"), + __attribute__((section(".ctors"), aligned(sizeof(fp)), used)) = {(fp)-1};
+ used)) = {(fp)-1}; +extern fp __CTOR_LIST_END__[];
+extern fp __CTOR_LIST_END__[] __attribute__((visibility("hidden")));
+#endif +#endif
+ +
+#ifdef CRT_SHARED +#ifdef CRT_SHARED
@ -334,9 +334,8 @@ Index: compiler-rt/lib/crt/crtbegin.c
+ +
+#ifndef CRT_HAS_INITFINI_ARRAY +#ifndef CRT_HAS_INITFINI_ARRAY
+static fp __DTOR_LIST__[] +static fp __DTOR_LIST__[]
+ __attribute__((section(".dtors"), aligned(sizeof(fp)), visibility("hidden"), + __attribute__((section(".dtors"), aligned(sizeof(fp)), used)) = {(fp)-1};
+ used)) = {(fp)-1}; +extern fp __DTOR_LIST_END__[];
+extern fp __DTOR_LIST_END__[] __attribute__((visibility("hidden")));
+#endif +#endif
+ +
+static void __attribute__((used)) __do_fini() { +static void __attribute__((used)) __do_fini() {
@ -377,7 +376,7 @@ Index: compiler-rt/lib/crt/crtend.c
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ compiler-rt/lib/crt/crtend.c +++ compiler-rt/lib/crt/crtend.c
@@ -0,0 +1,23 @@ @@ -0,0 +1,24 @@
+/* ===-- crtend.c - End of constructors and destructors --------------------=== +/* ===-- crtend.c - End of constructors and destructors --------------------===
+ * + *
+ * The LLVM Compiler Infrastructure + * The LLVM Compiler Infrastructure
@ -392,7 +391,8 @@ Index: compiler-rt/lib/crt/crtend.c
+ +
+// Put 4-byte zero which is the length field in FDE at the end as a terminator. +// Put 4-byte zero which is the length field in FDE at the end as a terminator.
+const int32_t __EH_FRAME_LIST_END__[] +const int32_t __EH_FRAME_LIST_END__[]
+ __attribute__((section(".eh_frame"), aligned(sizeof(int32_t)), used)) = {0}; + __attribute__((section(".eh_frame"), aligned(sizeof(int32_t)),
+ visibility("hidden"), used)) = {0};
+ +
+#ifndef CRT_HAS_INITFINI_ARRAY +#ifndef CRT_HAS_INITFINI_ARRAY
+typedef void (*fp)(void); +typedef void (*fp)(void);