Permalink
Browse files

Add suport for _WRAP_EXTRA_LIBS.

This allows specifying additional libraries in the output phase, and is
a special case compared to _WRAP_EXTRA_ARGS as we need to ensure that
these libaries are not applied when using Sun ld in -r mode.
  • Loading branch information...
1 parent cc7823e commit 65074af3924bfe2be224f1dba2cd140f3181eda7 @jperkin jperkin committed Jul 8, 2013
Showing with 25 additions and 0 deletions.
  1. +2 −0 mk/wrapper/bsd.wrapper.mk
  2. +3 −0 mk/wrapper/scan
  3. +20 −0 mk/wrapper/wrapper.sh
View
2 mk/wrapper/bsd.wrapper.mk
@@ -220,6 +220,7 @@ _UNWRAP_SED= -f ${_WRAP_UNTRANSFORM_SEDFILE}
_WRAPPER_SH.${_wrappee_}= ${WRAPPER_SRCDIR}/wrapper.sh
_WRAP_ENV.${_wrappee_}?= ${_WRAP_ENV}
_WRAP_EXTRA_ARGS.${_wrappee_}?= # empty
+_WRAP_EXTRA_LIBS.${_wrappee_}?= # empty
_WRAP_ARG_PP.${_wrappee_}?= ${_WRAP_ARG_PP}
_WRAP_ARG_PP_MAIN.${_wrappee_}?= ${_WRAP_ARG_PP_MAIN}
_WRAP_ARG_SOURCE.${_wrappee_}?= ${_WRAP_ARG_SOURCE}
@@ -403,6 +404,7 @@ _WRAP_SUBST_SED.${_wrappee_}= \
-e "s|@_WRAP_EMPTY_FILE@|${_WRAP_EMPTY_FILEQ}|g" \
-e "s|@_WRAP_ENV@|${_WRAP_ENV.${_wrappee_}:Q}|g" \
-e "s|@_WRAP_EXTRA_ARGS@|${_WRAP_EXTRA_ARGS.${_wrappee_}:Q}|g" \
+ -e "s|@_WRAP_EXTRA_LIBS@|${_WRAP_EXTRA_LIBS.${_wrappee_}:Q}|g" \
-e "s|@_WRAP_ARG_PP@|${_WRAP_ARG_PP.${_wrappee_}:Q}|g" \
-e "s|@_WRAP_ARG_PP_MAIN@|${_WRAP_ARG_PP_MAIN.${_wrappee_}:Q}|g" \
-e "s|@_WRAP_ARG_SOURCE@|${_WRAP_ARG_SOURCE.${_wrappee_}:Q}|g" \
View
3 mk/wrapper/scan
@@ -38,6 +38,9 @@
# Optional argument processing.
for arg do
case $arg in
+ # Append extra libs to output objects, but not when using 'ld -r'.
+ -o) append_extra_libs=yes ;;
+ -r) rflag=yes ;;
*) ;;
esac
done
View
20 mk/wrapper/wrapper.sh
@@ -101,8 +101,19 @@ init_queue argbuf
init_queue cmdbuf
append_extra_args=yes
+append_extra_libs=no
+rflag=no
. $scan
+case $append_extra_libs in
+yes)
+ # ld -r -o should not append extra libraries
+ if [ "$wrapper_type" = "LD" -a "$rflag" = "yes" ]; then
+ append_extra_libs=no
+ fi
+ ;;
+esac
+
case $append_extra_args in
yes)
$debug_log $wrapperlog " (wrapper.sh) append args: @_WRAP_EXTRA_ARGS@"
@@ -112,6 +123,15 @@ yes)
;;
esac
+case $append_extra_libs in
+yes)
+ $debug_log $wrapperlog " (wrapper.sh) append libs: @_WRAP_EXTRA_LIBS@"
+ set -- "$@" @_WRAP_EXTRA_LIBS@
+ ;;
+*)
+ ;;
+esac
+
. $arg_source
. $logic
. $cmd_sink

0 comments on commit 65074af

Please sign in to comment.