[Xenomai] Won`t build on new Debian Stable

Philippe Gerum rpm at xenomai.org
Thu Oct 19 15:00:59 CEST 2017


On 10/19/2017 01:32 PM, Lange Norbert wrote:
> Hello,
> 
>> 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.
> 
> I understand that differently, you can't use this flag in anything but the
> last partial link. Not that you should do it.

Which is my interpretation as well.

> 
> Further I agree that -Ur is, to my best knowledge, not needed at all.
> It might make sense if you want to do something directly with the
> Resulting object, but if final link to App or Library is some "standard"
> link then the tables are built there.
> It might actually create problems if some symbols (weak, inline)
> would be resolved differently in the final link.
> 
> Further, if I look at this ld switch:
> " --warn-constructors
> Warn if any global constructors are used. This is only useful for a few object file formats.
> For formats like COFF or ELF, the linker can not detect the use of global constructors."
>

Maybe not (although it is not obvious reading the binutils/ld code
populating the linker's hash table), but ld knows about collect2, which
detects such use.

> Then I am not even sure the linker will do ANYTHING differently with -Ur for ELF.> Such constructor functions pointers are placed in a special linker
section ".init_array",
> and the startup-code or the dynamic loader iterates on that array. There is
> nothing C++ specific.

I would assume the opposite. The ld doc says: "When linking C ++
programs, -Ur does resolve references to constructors". Also, the
previous discussion referred to collect2 as the breaking point when -r
and -pie conflict, which confirms it may be a C++ specific issue given
the purpose of collect2, which triggers due to a discrepancy between
gcc, collect2 and ld when it comes to partially linking pie code.

In addition, my understanding is that those references you mention are
not directly handled as ELF constructor routines, but indirectly by an
init handler called by the early C++ runtime code, which iterates over
those tables (over glibc's libc_start_main entry point for the ctor part).

> 
> How about using your supposed change and adding some comments that
> "-Wl,-Ur" was removed as hint?
> 

I asked earlier for C++ users to test that change in wrap-link.sh first,
not to break the stable branch for them. If nobody complains after a
couple of weeks, the change should definitely be merged.

-- 
Philippe.




More information about the Xenomai mailing list