Skip to content

Commit

Permalink
libgcc: move gcc library linking to ldlibs_common
Browse files Browse the repository at this point in the history
* 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 genodelabs#68
  • Loading branch information
ssumpf committed Nov 20, 2023
1 parent ecf9052 commit ce9b91b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
12 changes: 2 additions & 10 deletions share/goa/lib/build/qmake.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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++"
Expand All @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion share/goa/lib/flags.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit ce9b91b

Please sign in to comment.