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

Re: [Minios-devel] [UNIKRAFT PATCH] build: Add no-pie to GCC flags to avoid building failed on debian distributions



Hi Simon,

> -----Original Message-----
> From: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
> Sent: 2018年6月6日 20:39
> To: Wei Chen <Wei.Chen@xxxxxxx>; minios-devel@xxxxxxxxxxxxxxxxxxxx
> Cc: yuri.volchkov@xxxxxxxxx; sharan.santhanam@xxxxxxxxx; Kaly Xin
> <Kaly.Xin@xxxxxxx>; nd <nd@xxxxxxx>
> Subject: Re: [Minios-devel] [UNIKRAFT PATCH] build: Add no-pie to GCC flags to
> avoid building failed on debian distributions
> 
> Hey Wei,
> 
> thanks for investigating. Should -no-pie be also part of CXXFLAGS and
> ASFLAGS since we are using gcc for all compilation units?
> 

I think yes, I will send a v2 patch to fix it.

> Thanks,
> 
> Simon
> 
> On 06.06.2018 11:18, Wei Chen wrote:
> > On debian distributions (Debian/Ubuntu), the GCC will enable the
> > "-pie" flag by default. In this case, after this patch series
> > "Introduce LTO build option"(1) had been merged, we will get
> > following error:
> >
> > X86_64 xen platform error:
> > /usr/bin/x86_64-linux-gnu-ld: -r and -pie may not be used together
> > collect2: error: ld returned 1 exit status
> > make: *** [_all] Error 2
> >
> > arm64 kvm platform error:
> >    CC      libkvmplat: shutdown.o
> >    CC      libkvmplat: memory.o
> >    LD      libkvmplat.ld.o
> > /usr/bin/aarch64-linux-gnu-ld: -r and -pie may not be used together
> > make: *** [/root/UF/unikraft/build/libkvmplat.ld.o] Error 1
> >
> > So, we need to add "-no-pie" explicitly in CFLAGS to avoid such
> > errors.
> >
> > Notes:
> > [1] https://lists.xenproject.org/archives/html/minios-devel/2018-
> 05/msg00053.html
> >
> > Signed-off-by: Wei Chen <Wei.Chen@xxxxxxx>
> > ---
> >   Makefile.uk | 6 +++---
> >   1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/Makefile.uk b/Makefile.uk
> > index 1964563..d3609b5 100644
> > --- a/Makefile.uk
> > +++ b/Makefile.uk
> > @@ -7,7 +7,7 @@
> >   ASFLAGS     += -U __linux__ -U __FreeBSD__ -U __sun__ -D__ASSEMBLY__
> >   ASINCLUDES  += -nostdinc -nostdlib -I$(UK_BASE)/include
> >
> > -CFLAGS      += -U __linux__ -U __FreeBSD__ -U __sun__
> > +CFLAGS      += -U __linux__ -U __FreeBSD__ -U __sun__ -no-pie
> >   CFLAGS      += -fno-stack-protector -fno-omit-frame-pointer -fno-tree-sra
> >   CFLAGS      += -Wall -Wextra
> >   CINCLUDES   += -nostdinc -nostdlib -I$(UK_BASE)/include
> > @@ -20,8 +20,8 @@ CXXINCLUDES += -nostdinc -nostdlib -I$(UK_BASE)/include
> >   # Set the text and data sections to be readable and writable. Also,
> >   # do not page-align the data segment. If the output format supports
> >   # Unix style magic numbers, mark the output as OMAGIC.
> > -LIBLDFLAGS  += -nostdinc -nostdlib -Wl,--omagic -Wl,-r
> > -LDFLAGS     += -nostdinc -nostdlib -Wl,--omagic -Wl,--build-id=none
> > +LIBLDFLAGS  += -nostdinc -nostdlib -Wl,--omagic -Wl,-r -no-pie
> > +LDFLAGS     += -nostdinc -nostdlib -Wl,--omagic -Wl,--build-id=none -no-pie
> >
> >   CFLAGS-$(OPTIMIZE_NONE)            += -O0 -fno-optimize-sibling-calls -
> fno-tree-vectorize
> >   CXXFLAGS-$(OPTIMIZE_NONE)          += -O0 -fno-optimize-sibling-calls -
> fno-tree-vectorize
> >
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

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