[PATCH for-4.17] Build: Drop -no-pie from EMBEDDED_EXTRA_CFLAGS

Andrew Cooper posted 1 patch 1 year, 7 months ago
Test gitlab-ci failed
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20220927154708.15787-1-andrew.cooper3@citrix.com
Config.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH for-4.17] Build: Drop -no-pie from EMBEDDED_EXTRA_CFLAGS
Posted by Andrew Cooper 1 year, 7 months ago
This breaks all Clang builds, as demostrated by Gitlab CI.

Contrary to the description in ecd6b9759919, -no-pie is not even an option
passed to the linker.  GCC's actual behaviour is to inhibit the passing of
-pie to the linker, as well as selecting different cr0 artefacts to be linked.

EMBEDDED_EXTRA_CFLAGS is not used for $(CC)-doing-linking, and not liable to
gain such a usecase.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Fixes: ecd6b9759919 ("Config.mk: correct PIE-related option(s) in EMBEDDED_EXTRA_CFLAGS")
---
CC: George Dunlap <George.Dunlap@eu.citrix.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Jan Beulich <JBeulich@suse.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Wei Liu <wl@xen.org>
CC: Julien Grall <julien@xen.org>
CC: Henry Wang <Henry.Wang@arm.com>

Henry: This bugfix is a blocker for 4.17.
---
 Config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Config.mk b/Config.mk
index 000e57e57b44..69af1e60d4cc 100644
--- a/Config.mk
+++ b/Config.mk
@@ -188,7 +188,7 @@ endif
 APPEND_LDFLAGS += $(foreach i, $(APPEND_LIB), -L$(i))
 APPEND_CFLAGS += $(foreach i, $(APPEND_INCLUDES), -I$(i))
 
-EMBEDDED_EXTRA_CFLAGS := -fno-pie -no-pie -fno-stack-protector -fno-stack-protector-all
+EMBEDDED_EXTRA_CFLAGS := -fno-pie -fno-stack-protector -fno-stack-protector-all
 EMBEDDED_EXTRA_CFLAGS += -fno-exceptions -fno-asynchronous-unwind-tables
 
 XEN_EXTFILES_URL ?= http://xenbits.xen.org/xen-extfiles
-- 
2.11.0


Re: [PATCH for-4.17] Build: Drop -no-pie from EMBEDDED_EXTRA_CFLAGS
Posted by Jan Beulich 1 year, 7 months ago
On 27.09.2022 17:47, Andrew Cooper wrote:
> This breaks all Clang builds, as demostrated by Gitlab CI.
> 
> Contrary to the description in ecd6b9759919, -no-pie is not even an option
> passed to the linker.  GCC's actual behaviour is to inhibit the passing of
> -pie to the linker, as well as selecting different cr0 artefacts to be linked.
> 
> EMBEDDED_EXTRA_CFLAGS is not used for $(CC)-doing-linking, and not liable to
> gain such a usecase.

Since it was largely unavoidable for me to notice this while putting
together the two XTF patches just sent - isn't the current way of using
-no-pie there bogus then as well?

Jan
Re: [PATCH for-4.17] Build: Drop -no-pie from EMBEDDED_EXTRA_CFLAGS
Posted by Andrew Cooper 1 year, 7 months ago
On 29/09/2022 11:07, Jan Beulich wrote:
> On 27.09.2022 17:47, Andrew Cooper wrote:
>> This breaks all Clang builds, as demostrated by Gitlab CI.
>>
>> Contrary to the description in ecd6b9759919, -no-pie is not even an option
>> passed to the linker.  GCC's actual behaviour is to inhibit the passing of
>> -pie to the linker, as well as selecting different cr0 artefacts to be linked.
>>
>> EMBEDDED_EXTRA_CFLAGS is not used for $(CC)-doing-linking, and not liable to
>> gain such a usecase.
> Since it was largely unavoidable for me to notice this while putting
> together the two XTF patches just sent - isn't the current way of using
> -no-pie there bogus then as well?

Hmm, it is now.  In the past, XTF did use $(CC) for linking, but that is
not the case now.  I'll drop it.

~Andrew
Re: [PATCH for-4.17] Build: Drop -no-pie from EMBEDDED_EXTRA_CFLAGS
Posted by Jan Beulich 1 year, 7 months ago
On 03.10.2022 13:20, Andrew Cooper wrote:
> On 29/09/2022 11:07, Jan Beulich wrote:
>> On 27.09.2022 17:47, Andrew Cooper wrote:
>>> This breaks all Clang builds, as demostrated by Gitlab CI.
>>>
>>> Contrary to the description in ecd6b9759919, -no-pie is not even an option
>>> passed to the linker.  GCC's actual behaviour is to inhibit the passing of
>>> -pie to the linker, as well as selecting different cr0 artefacts to be linked.
>>>
>>> EMBEDDED_EXTRA_CFLAGS is not used for $(CC)-doing-linking, and not liable to
>>> gain such a usecase.
>> Since it was largely unavoidable for me to notice this while putting
>> together the two XTF patches just sent - isn't the current way of using
>> -no-pie there bogus then as well?
> 
> Hmm, it is now.  In the past, XTF did use $(CC) for linking, but that is
> not the case now.  I'll drop it.

I notice you've dropped it without replacement - don't you want -fno-pie in
its place?

Jan


Re: [PATCH for-4.17] Build: Drop -no-pie from EMBEDDED_EXTRA_CFLAGS
Posted by Jan Beulich 1 year, 7 months ago
On 27.09.2022 17:47, Andrew Cooper wrote:
> This breaks all Clang builds, as demostrated by Gitlab CI.
> 
> Contrary to the description in ecd6b9759919, -no-pie is not even an option
> passed to the linker.  GCC's actual behaviour is to inhibit the passing of
> -pie to the linker, as well as selecting different cr0 artefacts to be linked.
> 
> EMBEDDED_EXTRA_CFLAGS is not used for $(CC)-doing-linking, and not liable to
> gain such a usecase.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Fixes: ecd6b9759919 ("Config.mk: correct PIE-related option(s) in EMBEDDED_EXTRA_CFLAGS")

Acked-by: Jan Beulich <jbeulich@suse.com>

Perhaps the Reported-by: Stefano should be kept, even if you noticed
the issue as well?

I would have preferred a mention of the questionable origin of the
earlier misspelled -nopie, but I guess I'm not going to insist.

Jan
Re: [PATCH for-4.17] Build: Drop -no-pie from EMBEDDED_EXTRA_CFLAGS
Posted by Stefano Stabellini 1 year, 7 months ago
On Tue, 27 Sep 2022, Jan Beulich wrote:
> On 27.09.2022 17:47, Andrew Cooper wrote:
> > This breaks all Clang builds, as demostrated by Gitlab CI.
> > 
> > Contrary to the description in ecd6b9759919, -no-pie is not even an option
> > passed to the linker.  GCC's actual behaviour is to inhibit the passing of
> > -pie to the linker, as well as selecting different cr0 artefacts to be linked.
> > 
> > EMBEDDED_EXTRA_CFLAGS is not used for $(CC)-doing-linking, and not liable to
> > gain such a usecase.
> > 
> > Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> > Fixes: ecd6b9759919 ("Config.mk: correct PIE-related option(s) in EMBEDDED_EXTRA_CFLAGS")
> 
> Acked-by: Jan Beulich <jbeulich@suse.com>
> 
> Perhaps the Reported-by: Stefano should be kept, even if you noticed
> the issue as well?
> 
> I would have preferred a mention of the questionable origin of the
> earlier misspelled -nopie, but I guess I'm not going to insist.


Tested-by: Stefano Stabellini <sstabellini@kernel.org>

and committed