mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-15 20:33:10 +00:00
Toolchain+LibC: Don't link LibC against crt0
Instead GCC should be used to automatically link against crt0 and crt0_shared depending on the type of object file that is being built. Unfortunately this requires a rebuild of the toolchain as well as everything that has been built with the old GCC.
This commit is contained in:
parent
67516fa555
commit
50e4cad4a0
|
@ -115,7 +115,7 @@ diff -ruN a/gcc/config/serenity.h b/gcc/config/serenity.h
|
|||
+/* Files that are linked before user code.
|
||||
+ The %s tells GCC to look for these files in the library directory. */
|
||||
+#undef STARTFILE_SPEC
|
||||
+#define STARTFILE_SPEC "%{static:crt0.o%s} crti.o%s %{!static: %{!fbuilding-libgcc:crt0_shared.o%s}} %{shared|pie:crtbeginS.o%s; :crtbegin.o%s}"
|
||||
+#define STARTFILE_SPEC "%{!shared:crt0.o%s} crti.o%s %{shared: %{!fbuilding-libgcc:crt0_shared.o%s}} %{shared|pie:crtbeginS.o%s; :crtbegin.o%s}"
|
||||
+
|
||||
+/* Files that are linked after user code. */
|
||||
+#undef ENDFILE_SPEC
|
||||
|
|
|
@ -87,7 +87,7 @@ set(SOURCES ${LIBC_SOURCES} ${AK_SOURCES} ${ELF_SOURCES} ${ASM_SOURCES})
|
|||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++")
|
||||
add_library(LibCStaticWithoutDeps STATIC ${SOURCES})
|
||||
target_link_libraries(LibCStaticWithoutDeps crt0 ssp)
|
||||
target_link_libraries(LibCStaticWithoutDeps ssp)
|
||||
add_dependencies(LibCStaticWithoutDeps LibM LibSystem)
|
||||
|
||||
add_custom_target(LibCStatic
|
||||
|
@ -109,7 +109,7 @@ set_property(
|
|||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++")
|
||||
serenity_libc(LibC c)
|
||||
target_link_libraries(LibC crt0 ssp system)
|
||||
target_link_libraries(LibC ssp system)
|
||||
|
||||
# We mark LibCStatic as a dependency of LibC because this triggers the build of the LibCStatic target
|
||||
add_dependencies(LibC LibM LibSystem LibCStatic)
|
||||
|
|
Loading…
Reference in a new issue