[PATCH] D22961: [ELF] - Linkerscript: restrict moving location counter backwards.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 8 10:35:39 PDT 2016


davide added a comment.

In https://reviews.llvm.org/D22961#508592, @grimar wrote:

> In https://reviews.llvm.org/D22961#508415, @emaste wrote:
>
> > > Problem here that BSD script is not full, there are orphan sections. gold and ld use heuristic to place orphan sections
> >
> > >  somewhere in the middle. LLD does not do that and we produce broken output here:
> >
> >
> > 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.
>
>
> Just in case - I had to add next sections explicitly to BSD script.
>
>   set_sysctl_set             : { *(set_sysctl_set) }
>   set_sysinit_set            : { *(set_sysinit_set) }
>   set_sysuninit_set          : { *(set_sysuninit_set) }
>   set_modmetadata_set        : { *(set_modmetadata_set) } 
>   set_ah_chips               : { *(set_ah_chips) } 
>   set_ah_rfs                 : { *(set_ah_rfs) } 
>   set_kbddriver_set          : { *(set_kbddriver_set) } 
>   set_cons_set               : { *(set_cons_set) }   
>   usb_host_id                : { *(usb_host_id) }
>   set_vt_drv_set             : { *(set_vt_drv_set) } 
>   set_sdt_providers_set      : { *(set_sdt_providers_set) }   
>   set_sdt_probes_set         : { *(set_sdt_probes_set) } 
>   set_sdt_argtypes_set       : { *(set_sdt_argtypes_set) } 
>   set_kdb_dbbe_set           : { *(set_kdb_dbbe_set) } 
>   set_ratectl_set            : { *(set_ratectl_set) } 
>   set_crypto_set             : { *(set_crypto_set) } 
>   set_ieee80211_ioctl_getset : { *(set_ieee80211_ioctl_getset) } 
>   set_ieee80211_ioctl_setset : { *(set_ieee80211_ioctl_setset) } 
>   set_scanner_set            : { *(set_scanner_set) } 
>   set_videodriver_set        : { *(set_videodriver_set) } 
>   set_scterm_set             : { *(set_scterm_set) } 
>   set_scrndr_set             : { *(set_scrndr_set) } 
>   set_vga_set                : { *(set_vga_set) } 
>   kern_conf                  : { *(kern_conf) } 
>   set_pcpu                   : { *(set_pcpu) } 
>
>
> + 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.


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. 
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.
If FreeBSD can change his linker script, fine, great for them. But not everybody has the same luxury.


https://reviews.llvm.org/D22961





More information about the llvm-commits mailing list