[Xenomai] Won`t build on new Debian Stable

Philippe Gerum rpm at xenomai.org
Thu Oct 19 12:03:33 CEST 2017

On 10/13/2017 01:36 PM, Norbert Lange wrote:
> I works, because collect2 (the "compiler driver", which documents the
> -r option) now knows about the -r flag, using -Wl,-[U]r would mean the
> flags aren't even looked at.
> It can then disable functionality that is not supposed to be done at
> this point (see gcc/collect2.c, search for 'early_exit'). It might
> actually be in conflict with the -Ur option from the comments, but I
> don't know what this is trying to solve (the constructor tables would
> then be built in the second step?)
> I would prefer the compiler driver knowing about the flags and
> correctly dealing with them, instead of replicating this logic in
> scripts (and keeping it up to date with this internal logic).


> Might be that your wrapper script is doing something similarly by
> filtering out the arguments for the first step, which might be the
> same functionally that is skipped when adding '-r'
> I dont know what the -Ur flag is trying to solve, and the first patch
> adding -no-pie is way less likely to change something (given that I
> would not have compiled with -pie before).
> The new patch would however leave more of the magic to the toolchain
> and seems more "correct" to me, for whatever that's worth. But it
> might have some subtle differences to before, got some testcase where
> lacking the -Ur flag made a difference?

I don't know the original intent about passing -Ur to the linker, except
maybe to stick to the ld manpage which states that the last partial link
command should be given such option.

However my understanding is that we don't need it in wrap-link.sh, since
the script eventually completes the link stage to produce a fully
resolved executable. That implies collecting the ctors/dtors and
resolving all references from the partially linked object file anyway.

Some testing only passing -r here seems to confirm this assumption with
C++ apps; C++ users may want to check this too:

diff --git a/scripts/wrap-link.sh b/scripts/wrap-link.sh
index aab7899..fa83bd5 100755
--- a/scripts/wrap-link.sh
+++ b/scripts/wrap-link.sh
@@ -204,7 +204,7 @@ done

 if $stage2; then
     $verbose && set -x
-    $dryrun $cc -o "$output.tmp" -Wl,-Ur -nostdlib $stage1_args
+    $dryrun $cc -o "$output.tmp" -r -nostdlib $stage1_args
     $dryrun $cc -o "$output" "$output.tmp" $stage2_args
     $dryrun rm -f $output.tmp


More information about the Xenomai mailing list