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

Re: [Xen-devel] [XTF PATCH] build: disable PIE during linking if necessary



>>> On 01.02.17 at 17:21, <wei.liu2@xxxxxxxxxx> wrote:
> --- a/build/common.mk
> +++ b/build/common.mk
> @@ -50,6 +50,15 @@ obj-perarch :=
>  obj-perenv  :=
>  include $(ROOT)/build/files.mk
>  
> +
> +cc-option = $(shell if [ -z "`echo 'int p=1;' | $(CC) $(1) -S -o /dev/null 
> -x c - 2>&1`" ]; \
> +                     then echo y; else echo n; fi)
> +
> +# Disable PIE, but need to check if compiler supports it
> +ifeq ($(call cc-option,-no-pie),y)
> +DISABLE_PIE_LDFLAGS := -no-pie
> +endif

How about

LDFLAGS-$(call cc-option,-no-pie) += -no-pie

and ...

> @@ -61,7 +70,7 @@ CFLAGS_$(1) := $$(CFLAGS_$($(1)_arch)) 
> $$(COMMON_CFLAGS-$(1)) -DCONFIG_ENV_$(1)
>  
>  link-$(1) := $(ROOT)/arch/x86/link-$(1).lds
>  
> -LDFLAGS_$(1) := -Wl,-T,$$(link-$(1)) -nostdlib
> +LDFLAGS_$(1) := -Wl,-T,$$(link-$(1)) -nostdlib $(DISABLE_PIE_LDFLAGS)

LDFLAGS_$(1) := -Wl,-T,$$(link-$(1)) -nostdlib $(LDFLAGS-y)

(or something along those lines)?

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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