[PATCH] D28791: [compiler-rt][crt] Simple crtbegin and crtend implementation

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 28 23:40:40 PST 2019


phosek added inline comments.


================
Comment at: compiler-rt/lib/crt/CMakeLists.txt:81
+    SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/crtbegin.c
+    CFLAGS ${CRT_CFLAGS}
+    PARENT_TARGET crt)
----------------
MaskRay wrote:
> Just to ask if my understanding is correct.
> 
> clang_rt.crtbegin.o: replacement of crtbegin.o
> (-fno-PIC can be used here as some toolchains default to -fPIC or -fPIE, but it doesn't matter much here)
> 
> clang_rt.crtbegin_shared.o: replacement of crtbeginS.o crtbeginT.o
> 
Correct, `crtbeginS.o` and `crtbeginT.o` don't match the naming conventions of other compiler-rt artifacts, so I came up with this scheme which should be a better fit for compiler-rt. I'm open to other suggestions though.


================
Comment at: compiler-rt/lib/crt/crtbegin.c:17
+#else
+void *__dso_handle = (void *)0;
+#endif
----------------
MaskRay wrote:
> Should there be a `#ifdef` macro to exclude `__dso_handle`? glibc libc.a also provides `__dso_handle`.
I don't think this should be conditional, other `crtbegin.o` implementations also define this symbol unconditionally. It should be also usable independently of the C library being use (i.e. it should work with both glibc and musl).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D28791/new/

https://reviews.llvm.org/D28791





More information about the llvm-commits mailing list