[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT PATCHv5 11/46] build: Override default pie option of GCC if possible
Hey Wei,I accepted this patch but please help me reminding ;-) - is the check for '--enable-default-pie' necessary or can we always hand-over the '-no-pie' compile flag as soon we know GCC supports it? It probably won't hurt. We could maybe get rid of the console command. We could do this with a separate patch later. Thanks, Simon On 06.09.2018 11:37, Simon Kuenzer wrote: Reviewed-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx> On 10.08.2018 09:08, Wei Chen wrote:From: Wei Chen <Wei.Chen@xxxxxxx> On recent debian distributions (Debian/Ubuntu), the GCC enabled "--enable-default-pie" configuration option by default. This will case Unikraft link failed on debian/ubuntu platforms. In commit: "build: Add -no-pie to GCC flags" "cc7eb555080775cf2cb4a595a07b6121ff0f7361" I have added -no-pie to GCC flags directly to override the default pie option. But as Wei Liu reminded, old version GCC doesn't support -no-pie option. So in this patch, I checked the enbale-default-pie option and GCC version, and then added -no-pie to override it. Signed-off-by: Wei Chen <Wei.Chen@xxxxxxx> --- Makefile.uk | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/Makefile.uk b/Makefile.uk index b3938d0..0cc6690 100644 --- a/Makefile.uk +++ b/Makefile.uk @@ -4,15 +4,15 @@ ################################################################################# -ASFLAGS += -U __linux__ -U __FreeBSD__ -U __sun__ -D__ASSEMBLY__ -no-pie+ASFLAGS += -U __linux__ -U __FreeBSD__ -U __sun__ -D__ASSEMBLY__ ASINCLUDES += -nostdinc -nostdlib -I$(CONFIG_UK_BASE)/include -CFLAGS += -U __linux__ -U __FreeBSD__ -U __sun__ -no-pie +CFLAGS += -U __linux__ -U __FreeBSD__ -U __sun__CFLAGS += -fno-stack-protector -fno-omit-frame-pointer -fno-tree-sraCFLAGS += -Wall -Wextra CINCLUDES += -nostdinc -nostdlib -I$(CONFIG_UK_BASE)/include -CXXFLAGS += -U __linux__ -U __FreeBSD__ -U __sun__ -no-pie +CXXFLAGS += -U __linux__ -U __FreeBSD__ -U __sun__CXXFLAGS += -fno-stack-protector -fno-omit-frame-pointer -fno-tree-sraCXXFLAGS += -Wall -Wextra CXXINCLUDES += -nostdinc -nostdlib -I$(CONFIG_UK_BASE)/include@@ -20,8 +20,8 @@ CXXINCLUDES += -nostdinc -nostdlib -I$(CONFIG_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 -no-pie-LDFLAGS += -nostdinc -nostdlib -Wl,--omagic -Wl,--build-id=none -no-pie+LIBLDFLAGS += -nostdinc -nostdlib -Wl,--omagic -Wl,-r +LDFLAGS += -nostdinc -nostdlib -Wl,--omagic -Wl,--build-id=noneCFLAGS-$(CONFIG_OPTIMIZE_NONE) += -O0 -fno-optimize-sibling-calls -fno-tree-vectorize CXXFLAGS-$(CONFIG_OPTIMIZE_NONE) += -O0 -fno-optimize-sibling-calls -fno-tree-vectorize@@ -56,3 +56,14 @@ endifASFLAGS += -DUK_VERSION=$(UK_VERSION).$(UK_SUBVERSION) -DUK_FULLVERSION=$(UK_FULLVERSION) -DUK_CODENAME="$(UK_CODENAME)" CFLAGS += -DUK_VERSION=$(UK_VERSION).$(UK_SUBVERSION) -DUK_FULLVERSION=$(UK_FULLVERSION) -DUK_CODENAME="$(UK_CODENAME)" CXXFLAGS += -DUK_VERSION=$(UK_VERSION).$(UK_SUBVERSION) -DUK_FULLVERSION=$(UK_FULLVERSION) -DUK_CODENAME="$(UK_CODENAME)"+ +# Check whether the pie option is enabled by default. If possible, +# add -no-pie to link flags to override default pie option. +PIE_ON = $(shell $(CC) -v 2>&1 | grep -Fo "enable-default-pie") +ifneq ($(PIE_ON),) +ASFLAGS-$(call gcc_version_ge,6,1) += -no-pie +CFLAGS-$(call gcc_version_ge,6,1) += -no-pie +CXXFLAGS-$(call gcc_version_ge,6,1) += -no-pie +LIBLDFLAGS-$(call gcc_version_ge,6,1) += -no-pie +LDFLAGS-$(call gcc_version_ge,6,1) += -no-pie +endif_______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |