[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [PATCH 37/40] arm64: add the makefile



On Tue, Nov 07, 2017 at 11:56:16AM +0000, Julien Grall wrote:
> Hi Steve,
> 
> On 07/11/17 09:34, Steve Capper wrote:
> > On Tue, Nov 07, 2017 at 04:32:36PM +0800, Huang Shijie wrote:
> > > On Mon, Nov 06, 2017 at 06:00:30PM +0000, Julien Grall wrote:
> > > > Hi Shijie,
> > > > 
> > > > On 03/11/17 03:12, Huang Shijie wrote:

[...]

> > > > > +ifeq ($(MINIOS_TARGET_ARCH),arm64)
> > > > > +ARCH_CFLAGS  := -D__aarch64__ -DXEN_HAVE_PV_GUEST_ENTRY 
> > > > > -mgeneral-regs-only -fno-PIE
> > > > 
> > > > Why do you need to define __aarch64__? The compiler should to it for 
> > > > you.
> > > Yes. we can remove it.
> > > > 
> > > > Why do you define XEN_HAVE_PV_GUEST_ENTRY? Arm does not have any 
> > > > start_info
> > > > page.
> > > okay, I will remove.
> > > 
> > > > 
> > > > Lastly, why -fno-PIE?
> > > Steve tested a platform which compile very slowly, and need the -fno-PIE
> > > for it.
> > 
> > Hi,
> > 
> > -fno-PIE is needed when building with a Debian Stretch or newer toolchain,
> > as these are configured with: --enable-default-pie
> > 
> > If we omit -fno-PIE then a global object table is used where we are not
> > expecting it and this results in crashes in the early code as uninitialised
> > pointers are dereferenced.
> 
> Thank you for the explanation! But I am slightly confused, I tried to build
> Xen for Arm64 (AFAICT we don't set fno-pie) the GCC from Stretch. I see no
> issue to boot it.
> 
> So how is that different with Mini-OS?
> 

Hi Julien,
This was tricky to find :-), I think the following in Xen accomplishes the same
result in include/xen/compiler.h:

#ifdef GCC_HAS_VISIBILITY_ATTRIBUTE
/* Results in more efficient PIC code (no indirections through GOT or PLT). */
#pragma GCC visibility push(hidden)
#endif

One can see if global object table relocations are present in a .o file via:
objdump -dr built-in.o

I can't see these in Xen binaries I build for arm64. If we omit the -fno-PIE
in Mini-OS, we get something like:
45e4:       90000000        adrp    x0, 8 <_start-0x38>
45e4: R_AARCH64_ADR_GOT_PAGE    physical_address_offset

I think we may need a similar fix for x86 in mini-os too.

Cheers,
-- 
Steve

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/cgi-bin/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.