[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v3 07/16] x86/boot: create *.lnk files with linker script
>>> On 17.06.16 at 11:06, <daniel.kiper@xxxxxxxxxx> wrote: > On Tue, May 24, 2016 at 06:52:39AM -0600, Jan Beulich wrote: >> >>> On 24.05.16 at 14:28, <daniel.kiper@xxxxxxxxxx> wrote: >> > On Tue, May 24, 2016 at 03:05:06AM -0600, Jan Beulich wrote: >> >> >>> On 15.04.16 at 14:33, <daniel.kiper@xxxxxxxxxx> wrote: >> >> > + /DISCARD/ : { >> >> > + /* >> >> > + * .got.plt section is used only by dynamic linker >> >> > + * and our output is not supposed to be loaded by >> >> > + * dynamic linker. Additionally, it just contains >> >> > + * .PLT0 which is referenced from nowhere. So, we >> >> > + * can safely drop .got.plt here. >> >> > + * >> >> > + * Ha! This should be really discarded here. However, >> >> > + * .got.plt section contains _GLOBAL_OFFSET_TABLE_ >> >> > + * symbol too and it is used as a reference for relative >> >> > + * addressing (and only for that thing). Hence, ld >> >> > + * complains if we remove that section because it >> >> > + * cannot find _GLOBAL_OFFSET_TABLE_. So, drop .got.plt >> >> > + * section during conversion to plain binary format. >> >> > + * Please check build32.mk for more details. >> >> > + */ >> >> > + /* *(.got.plt) */ >> >> > + } >> >> >> >> I'm afraid this needs more investigation: Afaik there should be no >> > >> > I am not sure what else we should look for. >> >> The reason why such an empty .got.plt gets created in the first place. >> If e.g. that turns out to be a bug in (some versions of) binutils, then >> that bug should be named here as the reason. > > If PIC/PIE code is build then .got.plt exists in executable even if it > is not linked with dynamic libraries. Well - then just don't force -fPIC or -fPIE for the compilation of this code? >> >> reason for the linker to create an otherwise empty .got.plt in the >> > >> > As I wrote above. It contains _GLOBAL_OFFSET_TABLE_ which is used >> > as a reference for relative addressing. >> >> But we don't use any such, so without being needed I don't think >> the symbol needs to be created. > > R_386_GOTPC and R_386_GOTOFF relocations use address of > _GLOBAL_OFFSET_TABLE_ > as a reference. So, it is needed during linking phase. However, later it is > not needed. Hence, .got.plt with _GLOBAL_OFFSET_TABLE_ and .PLT0 can safely > be dropped. These two relocation types should not appear for non-PIC/PIE code. Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |