[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] rules.mak: Force CFLAGS for all objects in DSO
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH] rules.mak: Force CFLAGS for all objects in DSO |
Date: |
Wed, 06 May 2015 16:07:14 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 |
On 06/05/2015 15:46, Fam Zheng wrote:
> Because of the trick of process-archive-undefs, all .mo objects, even
> with --enable-modules, are dependencies of executables.
>
> This breaks CFLAGS propogation because the compiling of module object
> will happen too early before building for DSO.
>
> With GCC 5, the linking would fail because .o doesn't have -fPIC. Also,
> BUILD_DSO will be missed. (module-common.o will have it, so the stamp
> symbol was still liked in .so).
>
> Fix the problem by forcing the CFLAGS during unnest-vars.
>
> Reported-by: Alexander Graf <address@hidden>
> Signed-off-by: Fam Zheng <address@hidden>
> ---
> rules.mak | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/rules.mak b/rules.mak
> index 3a05627..6c0caf3 100644
> --- a/rules.mak
> +++ b/rules.mak
> @@ -102,7 +102,6 @@ endif
> %.o: %.dtrace
> $(call quiet-command,dtrace -o $@ -G -s $<, " GEN $(TARGET_DIR)$@")
>
> -%$(DSOSUF): CFLAGS += -fPIC -DBUILD_DSO
> %$(DSOSUF): LDFLAGS += $(LDFLAGS_SHARED)
> %$(DSOSUF): %.mo
> $(call LINK,$^)
> @@ -353,6 +352,7 @@ define unnest-vars
> $(foreach o,$($v),
> $(eval $o: $($o-objs)))
> $(eval $(patsubst %-m,%-y,$v) += $($v))
> + $(eval $($v:%.mo=%$(DSOSUF)) $($v) $(foreach
> o,$($v),$($o-objs)) .PHONY: CFLAGS += -fPIC -DBUILD_DSO)
Can you explain the various parts to the left of the colon?
Thanks,
Paolo
> $(eval modules: $($v:%.mo=%$(DSOSUF))),
> $(eval $(patsubst %-m,%-y,$v) += $(call expand-objs, $($v)))))
>
>
Re: [Qemu-devel] [PATCH] rules.mak: Force CFLAGS for all objects in DSO, Alexander Graf, 2015/05/06