All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] [PATCH] scripts/xeno-config: add -Wl,--no-as-needed
@ 2017-05-16 13:50 Henning Schild
  2017-05-21 16:18 ` Philippe Gerum
  0 siblings, 1 reply; 2+ messages in thread
From: Henning Schild @ 2017-05-16 13:50 UTC (permalink / raw)
  To: xenomai

Linking with "--as-needed" could cause the linker to not list essential
wrapping libraries as needed for a shared library or a dynamically
linked binary. The result would be runtime ld.so errors for the binaries
or linking problems with the .so.
gcc defaults to "--no-as-needed" that is why we never needed to specify
that flag explicitly. But gcc from Ubuntu is patched to default to
"--as-needed".
This patch enforces "--no-as-needed", which will have no effect on most
toolchains. On Ubuntu it will override the default and make sure xenomai
applications get linked as expected.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
 scripts/xeno-config-cobalt.in  | 1 +
 scripts/xeno-config-mercury.in | 1 +
 2 files changed, 2 insertions(+)

diff --git a/scripts/xeno-config-cobalt.in b/scripts/xeno-config-cobalt.in
index 82815e1936..ae313d3897 100644
--- a/scripts/xeno-config-cobalt.in
+++ b/scripts/xeno-config-cobalt.in
@@ -282,6 +282,7 @@ if test x$do_ldflags = xy; then
 	fi
 	bootstrap="${XENO_LIBRARY_DIR}/xenomai/bootstrap${codegen}.o"
     fi
+    ldflags="-Wl,--no-as-needed $ldflags"
     echo "$ldflags $copperplate $bootstrap $wrap_main $XENO_POSIX_LDFLAGS"
 fi
 
diff --git a/scripts/xeno-config-mercury.in b/scripts/xeno-config-mercury.in
index a0aa75b737..2d2842f300 100644
--- a/scripts/xeno-config-mercury.in
+++ b/scripts/xeno-config-mercury.in
@@ -213,6 +213,7 @@ if test x$do_ldflags = xy; then
 	fi
 	bootstrap="${XENO_LIBRARY_DIR}/xenomai/bootstrap${codegen}.o"
     fi
+    ldflags="-Wl,--no-as-needed $ldflags"
     echo "$ldflags $copperplate $bootstrap $wrap_main $XENO_BASE_LDFLAGS"
 fi
 
-- 
2.13.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Xenomai] [PATCH] scripts/xeno-config: add -Wl,--no-as-needed
  2017-05-16 13:50 [Xenomai] [PATCH] scripts/xeno-config: add -Wl,--no-as-needed Henning Schild
@ 2017-05-21 16:18 ` Philippe Gerum
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Gerum @ 2017-05-21 16:18 UTC (permalink / raw)
  To: Henning Schild, xenomai

On 05/16/2017 03:50 PM, Henning Schild wrote:
> Linking with "--as-needed" could cause the linker to not list essential
> wrapping libraries as needed for a shared library or a dynamically
> linked binary. The result would be runtime ld.so errors for the binaries
> or linking problems with the .so.
> gcc defaults to "--no-as-needed" that is why we never needed to specify
> that flag explicitly. But gcc from Ubuntu is patched to default to
> "--as-needed".
> This patch enforces "--no-as-needed", which will have no effect on most
> toolchains. On Ubuntu it will override the default and make sure xenomai
> applications get linked as expected.
> 
> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> ---
>  scripts/xeno-config-cobalt.in  | 1 +
>  scripts/xeno-config-mercury.in | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/scripts/xeno-config-cobalt.in b/scripts/xeno-config-cobalt.in
> index 82815e1936..ae313d3897 100644
> --- a/scripts/xeno-config-cobalt.in
> +++ b/scripts/xeno-config-cobalt.in
> @@ -282,6 +282,7 @@ if test x$do_ldflags = xy; then
>  	fi
>  	bootstrap="${XENO_LIBRARY_DIR}/xenomai/bootstrap${codegen}.o"
>      fi
> +    ldflags="-Wl,--no-as-needed $ldflags"
>      echo "$ldflags $copperplate $bootstrap $wrap_main $XENO_POSIX_LDFLAGS"
>  fi
>  
> diff --git a/scripts/xeno-config-mercury.in b/scripts/xeno-config-mercury.in
> index a0aa75b737..2d2842f300 100644
> --- a/scripts/xeno-config-mercury.in
> +++ b/scripts/xeno-config-mercury.in
> @@ -213,6 +213,7 @@ if test x$do_ldflags = xy; then
>  	fi
>  	bootstrap="${XENO_LIBRARY_DIR}/xenomai/bootstrap${codegen}.o"
>      fi
> +    ldflags="-Wl,--no-as-needed $ldflags"
>      echo "$ldflags $copperplate $bootstrap $wrap_main $XENO_BASE_LDFLAGS"
>  fi
>  
> 

Merged, thanks.

-- 
Philippe.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-05-21 16:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-16 13:50 [Xenomai] [PATCH] scripts/xeno-config: add -Wl,--no-as-needed Henning Schild
2017-05-21 16:18 ` Philippe Gerum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.