From ce9b91b4aed22d81fc4e370ef165b371cd79ef30 Mon Sep 17 00:00:00 2001 From: Sebastian Sumpf Date: Mon, 20 Nov 2023 18:16:54 +0100 Subject: [PATCH] libgcc: move gcc library linking to ldlibs_common * move the '-lgcc' from ldlib_so to ldlibs_common and use ldlibs_common also for qmake (as done by the other build systems) * remove unnecessary libgcc locating code for qmake issue #68 --- share/goa/lib/build/qmake.tcl | 12 ++---------- share/goa/lib/flags.tcl | 3 ++- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/share/goa/lib/build/qmake.tcl b/share/goa/lib/build/qmake.tcl index 61d1c5d..64d96a8 100644 --- a/share/goa/lib/build/qmake.tcl +++ b/share/goa/lib/build/qmake.tcl @@ -45,19 +45,11 @@ proc create_or_update_build_dir { } { append qmake_cflags "-I$build_dir/qmake_root/include/QtCore/spec/$qmake_platform" set qmake_ldlibs { } - lappend qmake_ldlibs -nostdlib - lappend qmake_ldlibs -L$abi_dir lappend qmake_ldlibs -l:libc.lib.so lappend qmake_ldlibs -l:libm.lib.so lappend qmake_ldlibs -l:stdcxx.lib.so lappend qmake_ldlibs -l:qt5_component.lib.so - if {$arch == "x86_64"} { - lappend qmake_ldlibs [file normalize [exec $cross_dev_prefix\gcc -m64 -print-libgcc-file-name]] - } else { - lappend qmake_ldlibs [file normalize [exec $cross_dev_prefix\gcc -print-libgcc-file-name]] - } - set ::env(GENODE_QMAKE_CC) "${cross_dev_prefix}gcc" set ::env(GENODE_QMAKE_CXX) "${cross_dev_prefix}g++" set ::env(GENODE_QMAKE_LINK) "${cross_dev_prefix}g++" @@ -66,8 +58,8 @@ proc create_or_update_build_dir { } { set ::env(GENODE_QMAKE_NM) "${cross_dev_prefix}nm" set ::env(GENODE_QMAKE_STRIP) "${cross_dev_prefix}strip" set ::env(GENODE_QMAKE_CFLAGS) "$qmake_cflags" - set ::env(GENODE_QMAKE_LFLAGS_APP) "-nostdlib $ldflags $ldlibs_exe $qmake_ldlibs" - set ::env(GENODE_QMAKE_LFLAGS_SHLIB) "-nostdlib $ldflags_so $ldlibs_common $ldlibs_so $qmake_ldlibs" + set ::env(GENODE_QMAKE_LFLAGS_APP) "$ldflags $ldlibs_common $ldlibs_exe $qmake_ldlibs" + set ::env(GENODE_QMAKE_LFLAGS_SHLIB) "$ldflags_so $ldlibs_common $ldlibs_so $qmake_ldlibs" set qt_conf "qmake_root/mkspecs/$qmake_platform/qt.conf" diff --git a/share/goa/lib/flags.tcl b/share/goa/lib/flags.tcl index ccd979d..5d18afe 100644 --- a/share/goa/lib/flags.tcl +++ b/share/goa/lib/flags.tcl @@ -87,6 +87,7 @@ lappend ldflags -Wl,-Ttext=0x01000000 set ldlibs_common { } lappend ldlibs_common -nostartfiles -nodefaultlibs -static-libgcc lappend ldlibs_common -L$abi_dir +lappend ldlibs_common -Wl,--whole-archive -lgcc -Wl,--no-whole-archive set ldlibs_exe { } lappend ldlibs_exe -Wl,--dynamic-linker=ld.lib.so @@ -99,7 +100,7 @@ lappend ldlibs_exe -T [file join $ld_script_dir genode_dyn.ld] set ldlibs_so { } lappend ldlibs_so -Wl,-shared -lappend ldlibs_so -Wl,--whole-archive -lgcc -l:ldso_so_support.lib.a -Wl,--no-whole-archive +lappend ldlibs_so -Wl,--whole-archive -l:ldso_so_support.lib.a -Wl,--no-whole-archive lappend ldlibs_so -T [file join $ld_script_dir genode_rel.ld] # determine ABIs to link against the executable