<div dir="ltr">Looks like we should do something for them, but can you describe what we should do? I can't find a simple rule to describe the behavior of GNU linkers.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 8, 2016 at 10:35 AM, Davide Italiano <span dir="ltr"><<a href="mailto:dccitaliano@gmail.com" target="_blank">dccitaliano@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">davide added a comment.<br>
<span class=""><br>
In <a href="https://reviews.llvm.org/D22961#508592" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D22961#508592</a>, @grimar wrote:<br>
<br>
> In <a href="https://reviews.llvm.org/D22961#508415" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D22961#508415</a>, @emaste wrote:<br>
><br>
> > > Problem here that BSD script is not full, there are orphan sections. gold and ld use heuristic to place orphan sections<br>
> ><br>
> > >  somewhere in the middle. LLD does not do that and we produce broken output here:<br>
> ><br>
> ><br>
> > We'll want to address this in FreeBSD's linker script in general so that we don't have the orphan sections. I agree that a warning/error would be desirable here to aid in identifying and correcting these cases. I'm not sure off hand how to handle the __start_<section> symbol generation when including these sections in the linker script though.<br>
><br>
><br>
> Just in case - I had to add next sections explicitly to BSD script.<br>
><br>
</span>>   set_sysctl_set             : { *(set_sysctl_set) }<br>
>   set_sysinit_set            : { *(set_sysinit_set) }<br>
>   set_sysuninit_set          : { *(set_sysuninit_set) }<br>
>   set_modmetadata_set        : { *(set_modmetadata_set) }<br>
>   set_ah_chips               : { *(set_ah_chips) }<br>
>   set_ah_rfs                 : { *(set_ah_rfs) }<br>
>   set_kbddriver_set          : { *(set_kbddriver_set) }<br>
>   set_cons_set               : { *(set_cons_set) }<br>
>   usb_host_id                : { *(usb_host_id) }<br>
>   set_vt_drv_set             : { *(set_vt_drv_set) }<br>
>   set_sdt_providers_set      : { *(set_sdt_providers_set) }<br>
>   set_sdt_probes_set         : { *(set_sdt_probes_set) }<br>
>   set_sdt_argtypes_set       : { *(set_sdt_argtypes_set) }<br>
>   set_kdb_dbbe_set           : { *(set_kdb_dbbe_set) }<br>
>   set_ratectl_set            : { *(set_ratectl_set) }<br>
>   set_crypto_set             : { *(set_crypto_set) }<br>
>   set_ieee80211_ioctl_getset : { *(set_ieee80211_ioctl_getset) }<br>
>   set_ieee80211_ioctl_setset : { *(set_ieee80211_ioctl_setset) }<br>
>   set_scanner_set            : { *(set_scanner_set) }<br>
>   set_videodriver_set        : { *(set_videodriver_set) }<br>
>   set_scterm_set             : { *(set_scterm_set) }<br>
>   set_scrndr_set             : { *(set_scrndr_set) }<br>
>   set_vga_set                : { *(set_vga_set) }<br>
>   kern_conf                  : { *(kern_conf) }<br>
>   set_pcpu                   : { *(set_pcpu) }<br>
<span class="">><br>
><br>
> + Also there one more unprocessed: .SUNW_ctf but it is not allocatable so I am fine it is added as orphan for me now. Generally for non allocatable sections it is probably ok to be orphans I think.<br>
<br>
<br>
</span>I hit the same problem internally, on a codebase I don't own but I have to support. Sorry, I can't share it, but it's a kernel and it's very similar to the linker script provided by FreeBSD.<br>
Setting the wrong VA causes the loader to be very confused. I think we should support this particular feature of ld.bfd in a bug-by-bug compatible fashion.<br>
If FreeBSD can change his linker script, fine, great for them. But not everybody has the same luxury.<br>
<br>
<br>
<a href="https://reviews.llvm.org/D22961" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D22961</a><br>
<br>
<br>
<br>
</blockquote></div><br></div>