[Xenomai] Won`t build on new Debian Stable

Norbert Lange nolange79 at gmail.com
Fri Oct 13 13:36:25 CEST 2017


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?



2017-10-13 12:26 GMT+02:00 Henning Schild <henning.schild at siemens.com>:
> Am Fri, 13 Oct 2017 11:37:30 +0200
> schrieb Norbert Lange <nolange79 at gmail.com>:
>
>> Actually your idea of just adding -r would work aswell, and looks
>> cleaner and more robust to me.
>
> Ok, in that case it would still be nice to understand why it works and
> what "-r" does to gcc.
>
> If you like that better send another patch and we will see what
> Philippe says.
>
> Henning
>
>> I started with the wrong ideas because of the usual POSIX argument
>> parsing like "tar -xzf file.tar.gz" being interpreted as  "tar -x -z
>> -f file.tar.gz".
>>
>> 2017-10-13 11:31 GMT+02:00 Henning Schild
>> <henning.schild at siemens.com>:
>> > That looks good to me.
>> >
>> > Henning
>> >
>> > Am Fri, 13 Oct 2017 10:38:26 +0200
>> > schrieb Norbert Lange <nolange79 at gmail.com>:
>> >
>> >> Second attempt at fixing it, you could surely make this more
>> >> complex using autohell but I am not going there.
>> >>
>> >> If I understood correctly this script is only necessary if the
>> >> application is linked -static?
>> >> Means I would try to avoid using it, aslong I dont explicitly want
>> >> to do that.
>> >>
>> >> Kind regards,
>> >> Norbert
>> >>
>> >> 2017-10-13 9:40 GMT+02:00 Norbert Lange <nolange79 at gmail.com>:
>> >> > Ok I just realized there is a "-Ur" option, aside from "-U -r".
>> >> >
>> >> > You get alot otherwise undocumented flags with "gcc --help -v"
>> >> > BTW
>> >> >
>> >> > 2017-10-13 9:13 GMT+02:00 Norbert Lange <nolange79 at gmail.com>:
>> >> >> Hello,
>> >> >>
>> >> >> I tracked down the source of information to this:
>> >> >> https://wiki.ubuntu.com/SecurityTeam/PIE
>> >> >>
>> >> >> I changed the flags from "-Wl,-Ur" to "-Wl,-U -r", so you wont
>> >> >> get an explanation from me, why -U has to be passed for the
>> >> >> linker. And by the way, gcc accepts -U aswell, so this might be
>> >> >> preferable to be used directly too.
>> >> >>
>> >> >> I don`t know why those flags aren' t documented, bug in gcc
>> >> >> documentation? As far as I understand is that gcc is smart
>> >> >> enough to correctly deal with the flags gcc directly received,
>> >> >> but the linker lacks that information.
>> >> >>
>> >> >> I don' t know what the issue is with the C++ Constructors, in
>> >> >> the context of this change?
>> >> >> (I heard about the issues if those reside in a shared library,
>> >> >> use function from libcobald and don't depend on libcobald.
>> >> >> Which is more of a broken build to me if you don't add the
>> >> >> depended libs, and will bite you the same way if you use GCCs
>> >> >> constructor attribute)
>> >> >>
>> >> >> Kind regards,
>> >> >> Norbert.
>> >> >>
>> >> >> 2017-10-12 10:33 GMT+02:00 Henning Schild
>> >> >> <henning.schild at siemens.com>:
>> >> >>> Hey Norbert,
>> >> >>>
>> >> >>> thanks for looking into that again! Could you please explain
>> >> >>> how and why that works, or point out what to look at in flint?
>> >> >>> Mailing list thread, commit, something like that.
>> >> >>>
>> >> >>> As far as i can see gcc now gets a "-r" which i do not find in
>> >> >>> the manpage. And ld gets a "-U" which i do not find in its
>> >> >>> manpage. And there is something about c++ constructors which
>> >> >>> might change the behaviour of xenomai.
>> >> >>>
>> >> >>> Henning
>> >> >>>
>> >> >>> Am Tue, 10 Oct 2017 16:38:50 +0200
>> >> >>> schrieb Norbert Lange <nolange79 at gmail.com>:
>> >> >>>
>> >> >>>> Some highly trivial fix attached!
>> >> >>>> Its strange that this flag is not documented in the manual (I
>> >> >>>> found out abaout this fix from
>> >> >>>> https://launchpad.net/ubuntu/+source/flint)
>> >> >>>>
>> >> >>>> Norbert Lange
>> >> >>>>
>> >> >>>> 2017-08-10 11:49 GMT+02:00 Henning Schild
>> >> >>>> <henning.schild at siemens.com>:
>> >> >>>> > Hi Norbert,
>> >> >>>> >
>> >> >>>> > Thanks! In fact that issue has come up before and a similar
>> >> >>>> > workaround was described. It should be fixed, patches
>> >> >>>> > welcome!
>> >> >>>> >
>> >> >>>> > Henning
>> >> >>>> >
>> >> >>>> > Am Wed, 9 Aug 2017 16:21:02 +0200
>> >> >>>> > schrieb Norbert Lange <nolange79 at gmail.com>:
>> >> >>>> >
>> >> >>>> >> Hello,
>> >> >>>> >>
>> >> >>>> >> Building the xenomai package won`t work because debian now
>> >> >>>> >> defaults to using pie, and the linker will complain with
>> >> >>>> >> "ld: -r and -pie may not be used together"
>> >> >>>> >>
>> >> >>>> >> A workaround for now is to add the flags manually:
>> >> >>>> >> ../xenomai-3.0.5/configure LDFLAGS=-no-pie CFLAGS="-fno-PIE
>> >> >>>> >> -fno-pie -no-pie"
>> >> >>>> >>
>> >> >>>> >> A real fix would be similar to
>> >> >>>> >> http://lists.gnu.org/archive/html/bug-grub/2016-11/msg00011.html
>> >> >>>> >> (no-pie is not supported on old and other compilers)
>> >> >>>> >>
>> >> >>>> >> Kind regards,
>> >> >>>> >> Norbert
>> >> >>>> >>
>> >> >>>> >> _______________________________________________
>> >> >>>> >> Xenomai mailing list
>> >> >>>> >> Xenomai at xenomai.org
>> >> >>>> >> https://xenomai.org/mailman/listinfo/xenomai
>> >> >>>> >
>> >> >>>
>> >
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-build-with-gcc-using-default-PIE.patch
Type: text/x-patch
Size: 742 bytes
Desc: not available
URL: <http://xenomai.org/pipermail/xenomai/attachments/20171013/0b3aaf80/attachment.bin>


More information about the Xenomai mailing list