summaryrefslogtreecommitdiffhomepage
path: root/sofort
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2021-06-05 10:24:32 +0000
committermidipix <writeonce@midipix.org>2021-06-05 13:00:53 +0000
commitfa4aa340d0ef1147d6d577430c5f98445da6cdf2 (patch)
tree284f6adada0c5de8ad6b7f6a9102407fdfcaa010 /sofort
parent2887fc4f1946b4a69ed75d80b8f5ecc04a6a6a77 (diff)
downloadslibtool-fa4aa340d0ef1147d6d577430c5f98445da6cdf2.tar.bz2
slibtool-fa4aa340d0ef1147d6d577430c5f98445da6cdf2.tar.xz
build system: ccenv: added ccenv_set_cc_linker_switch_vars().
Diffstat (limited to 'sofort')
-rw-r--r--sofort/ccenv/ccenv.sh55
-rw-r--r--sofort/ccenv/ccswitch.strs4
2 files changed, 56 insertions, 3 deletions
diff --git a/sofort/ccenv/ccenv.sh b/sofort/ccenv/ccenv.sh
index baa0790..17656e3 100644
--- a/sofort/ccenv/ccenv.sh
+++ b/sofort/ccenv/ccenv.sh
@@ -1442,12 +1442,12 @@ ccenv_output_defs()
ccenv_set_cc_switch_vars()
{
if [ -f $mb_project_dir/project/config/ccswitch.strs ]; then
- ccenv_switch_vars=$(grep -v '^#' \
+ ccenv_switch_vars=$(grep -v -e '^#' -e '^-Wl,' \
$mb_project_dir/sofort/ccenv/ccswitch.strs \
$mb_project_dir/project/config/ccswitch.strs \
| sort -u)
else
- ccenv_switch_vars=$(grep -v '^#' \
+ ccenv_switch_vars=$(grep -v -e '^#' -e '^-Wl,' \
$mb_project_dir/sofort/ccenv/ccswitch.strs \
| sort -u)
fi
@@ -1488,6 +1488,56 @@ ccenv_set_cc_switch_vars()
done
}
+ccenv_set_cc_linker_switch_vars()
+{
+ printf '\n# %s ldflags: supported compiler switches\n' "$ccenv_cfgtype" \
+ >> "$ccenv_mk"
+
+ if [ -f $mb_project_dir/project/config/ccswitch.strs ]; then
+ ccenv_switch_vars=$(grep -e '^-Wl,' \
+ $mb_project_dir/sofort/ccenv/ccswitch.strs \
+ $mb_project_dir/project/config/ccswitch.strs \
+ | sort -u)
+ else
+ ccenv_switch_vars=$(grep -e '^-Wl,' \
+ $mb_project_dir/sofort/ccenv/ccswitch.strs \
+ | sort -u)
+ fi
+
+ if [ $ccenv_cfgtype = 'host' ]; then
+ ccenv_makevar_prefix='_LDFLAGS_'
+ cfgtest_host_section
+ else
+ ccenv_makevar_prefix='_NATIVE_LDFLAGS_'
+ cfgtest_native_section
+ fi
+
+ for ccenv_switch_var in $(printf '%s' "$ccenv_switch_vars"); do
+ ccenv_make_var=${ccenv_switch_var%=}
+ ccenv_make_var=${ccenv_make_var%,}
+
+ ccenv_make_var=${ccenv_make_var##---}
+ ccenv_make_var=${ccenv_make_var##--}
+ ccenv_make_var=${ccenv_make_var##-}
+
+ ccenv_make_var=$(printf '%s' "$ccenv_make_var" \
+ | sed -e 's/=/_/g' -e 's/-/_/g' -e 's/,/_/g')
+
+ ccenv_make_var="${ccenv_makevar_prefix}${ccenv_make_var}"
+
+ if cfgtest_compiler_switch "$ccenv_switch_var"; then
+ ccenv_switch_var=${ccenv_switch_var%=}
+ ccenv_switch_var=${ccenv_switch_var%,}
+
+ printf '%-40s= %s\n' "${ccenv_make_var}" "${ccenv_switch_var}" \
+ >> "$ccenv_mk"
+ else
+ printf '%-40s=\n' "${ccenv_make_var}" \
+ >> "$ccenv_mk"
+ fi
+ done
+}
+
ccenv_dso_verify()
{
ccenv_str='int foo(int x){return ++x;}'
@@ -1599,6 +1649,7 @@ ccenv_set_toolchain_variables()
ccenv_clean_up
ccenv_set_cc_switch_vars
+ ccenv_set_cc_linker_switch_vars
}
ccenv_set_host_variables()
diff --git a/sofort/ccenv/ccswitch.strs b/sofort/ccenv/ccswitch.strs
index f27fe62..9c4f508 100644
--- a/sofort/ccenv/ccswitch.strs
+++ b/sofort/ccenv/ccswitch.strs
@@ -5,7 +5,8 @@
# ``CFLAGS_foo = -foo'' to the respective ccenv variable file
# (that is, ccenv/host.mk or ccenv/native.mk).
-# the make variable prefix is _CFLAGS_ or _NATIVE_CFLAGS_,
+# the make variable prefix is _CFLAGS_ or _NATIVE_CFLAGS_
+# (_LDFLAGS_ or _NATIVE_LDFLAGS for -Wl, linker options),
# to which the compiler-switch, minus leading dashes and
# trailing equal-sign or comma, is appended; non-leading
# dashes and non-trailing equal-signs and commas are then
@@ -24,6 +25,7 @@
-std=c11
# linker switches
+-Wl,
-Wl,--no-undefined
# errors and warnings