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

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



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>
---
v1 - v2:
 Add "-no-pie" to ASFLAGS and CXXFLAGS
v2 - v3:
 Fix a typo in comments.

---
 Makefile.uk | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/Makefile.uk b/Makefile.uk
index 1964563..529bb70 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -4,15 +4,15 @@
 #
 
################################################################################
 
-ASFLAGS     += -U __linux__ -U __FreeBSD__ -U __sun__ -D__ASSEMBLY__
+ASFLAGS     += -U __linux__ -U __FreeBSD__ -U __sun__ -D__ASSEMBLY__ -no-pie
 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
 
-CXXFLAGS    += -U __linux__ -U __FreeBSD__ -U __sun__
+CXXFLAGS    += -U __linux__ -U __FreeBSD__ -U __sun__ -no-pie
 CXXFLAGS    += -fno-stack-protector -fno-omit-frame-pointer -fno-tree-sra
 CXXFLAGS    += -Wall -Wextra
 CXXINCLUDES += -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
-- 
2.17.1


_______________________________________________
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®.