Skip to contentSkip to conversation

xen: convert lto to Kconfig option

PATCH In review Wei Liu 2 participants 6 messages Dec 5, 2016

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH 1/1 xen: convert lto to Kconfig option

Introduce CONFIG_LTO in Kconfig. Since this is the last option to be converted to Kconfig, delete the preceding comment in Rules.mk as well.

Make it depend on BROKEN because it doesn't work at the moment.

---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>

The option is placed under top level Kconfig because it doesn't fit into any existing category.

Suggestions are welcome.

---
 xen/Kconfig           |  8 ++++++++
 xen/Rules.mk          | 10 ++--------
 xen/arch/arm/Makefile |  2 +-
 xen/arch/x86/Makefile |  2 +-
 4 files changed, 12 insertions(+), 10 deletions(-)
xen/Kconfig +8 -0
index 5515fe9..65d491d 100644
@@ -30,4 +30,12 @@ config EXPERT
 	string
 	option env="XEN_CONFIG_EXPERT"
 
+config LTO
+	bool "Link Time Optimisation"
+	depends on BROKEN
+	---help---
+	  Enable Link Time Optimisation.
+
+	  If unsure, say N.
+
 source "Kconfig.debug"
xen/Rules.mk +2 -8
index 08cc776..24d13dc 100644
@@ -1,10 +1,4 @@
 
-#
-# If you change any of these configuration options then you must
-# 'make clean' before rebuilding.
-#
-lto           ?= n
-
 -include $(BASEDIR)/include/config/auto.conf
 
 include $(XEN_ROOT)/Config.mk
@@ -125,7 +119,7 @@ ifeq ($(CONFIG_GCOV),y)
 $(filter-out %.init.o $(nogcov-y),$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS += -fprofile-arcs -ftest-coverage
 endif
 
-ifeq ($(lto),y)
+ifeq ($(CONFIG_LTO),y)
 # Would like to handle all object files as bitcode, but objects made from
 # pure asm are in a different format and have to be collected separately.
 # Mirror the directory tree, collecting them as built_in_bin.o.
@@ -144,7 +138,7 @@ built_in.o: $(obj-y)
 ifeq ($(obj-y),)
 	$(CC) $(CFLAGS) -c -x c /dev/null -o $@
 else
-ifeq ($(lto),y)
+ifeq ($(CONFIG_LTO),y)
 	$(LD_LTO) -r -o $@ $^
 else
 	$(LD) $(LDFLAGS) -r -o $@ $^
xen/arch/arm/Makefile +1 -1
index da39d39..f165178 100644
@@ -81,7 +81,7 @@ $(TARGET).axf: $(TARGET)-syms
 	$(OBJCOPY) --change-addresses +0x80000000 $< $@
 	$(STRIP) $@
 
-ifeq ($(lto),y)
+ifeq ($(CONFIG_LTO),y)
 # Gather all LTO objects together
 prelink_lto.o: $(ALL_OBJS)
 	$(LD_LTO) -r -o $@ $^
xen/arch/x86/Makefile +1 -1
index 931917d..fdcf977 100644
@@ -95,7 +95,7 @@ $(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32
 
 ALL_OBJS := $(BASEDIR)/arch/x86/boot/built_in.o $(BASEDIR)/arch/x86/efi/built_in.o $(ALL_OBJS)
 
-ifeq ($(lto),y)
+ifeq ($(CONFIG_LTO),y)
 # Gather all LTO objects together
 prelink_lto.o: $(ALL_OBJS)
 	$(LD_LTO) -r -o $@ $^
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 05.12.16 at 15:39, <[email protected]> wrote:

Introduce CONFIG_LTO in Kconfig. Since this is the last option to be converted to Kconfig, delete the preceding comment in Rules.mk as well.

Make it depend on BROKEN because it doesn't work at the moment.

Looks fine except for this one aspect: Is that brokenness with gcc, clang, or both? I wouldn't be surprised if it was broken with gcc (in fact I would be surprised it has ever worked), but I would have hoped that the clang variant (which iirc this was introduced for) would work (also e.g. in 4.8).

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#2 lore raw
Quoted 8 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 05.12.16 at 15:39, <[email protected]> wrote:

Introduce CONFIG_LTO in Kconfig. Since this is the last option to be converted to Kconfig, delete the preceding comment in Rules.mk as well.

Make it depend on BROKEN because it doesn't work at the moment.

Looks fine except for this one aspect: Is that brokenness with gcc, clang, or both? I wouldn't be surprised if it was broken with gcc (in

It's going to be both.

Its build rune is broken.

I got:

head.S:212:0: fatal error: opening dependency file /..d: Permission denied

That is, this rule

  CFLAGS-y += -MMD -MF $(@D)/.$(@F).d                                             

is evaluated too early outside of prerequisite list, which results in empty string.

Also I'm sure gcc can't deal with lto because at one point I tried to fix lto but gcc toolchain can't cope with that.

Quoted 4 lines

fact I would be surprised it has ever worked), but I would have hoped that the clang variant (which iirc this was introduced for) would work (also e.g. in 4.8).

I haven't tried clang, because the brokenness is somewhere else.

Wei.

Quoted 2 lines

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#3 lore raw
Quoted 16 lines · Wei Liu
Quoted 8 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 05.12.16 at 15:39, <[email protected]> wrote:

Introduce CONFIG_LTO in Kconfig. Since this is the last option to be converted to Kconfig, delete the preceding comment in Rules.mk as well.

Make it depend on BROKEN because it doesn't work at the moment.

Looks fine except for this one aspect: Is that brokenness with gcc, clang, or both? I wouldn't be surprised if it was broken with gcc (in

It's going to be both.

Its build rune is broken.

I got:

Quoted 9 lines

head.S:212:0: fatal error: opening dependency file /..d: Permission denied

That is, this rule

  CFLAGS-y += -MMD -MF $(@D)/.$(@F).d                                             

is evaluated too early outside of prerequisite list, which results in empty string.

Sorry, "evaluated too early outside ..." is non-sense. I will just copy the manpage for automatic variables from Make:

"In particular, you cannot use them anywhere within the target list of a rule; they have no value there and will expand to the empty string. Also, they cannot be accessed directly within the prerequisite list of a rule. A common mistake is attempting to use $@ within the prerequisites list; this will not work."

The "empty string" part in my description is accurate though.

Quoted 14 lines

Also I'm sure gcc can't deal with lto because at one point I tried to fix lto but gcc toolchain can't cope with that.

Quoted 4 lines

fact I would be surprised it has ever worked), but I would have hoped that the clang variant (which iirc this was introduced for) would work (also e.g. in 4.8).

I haven't tried clang, because the brokenness is somewhere else.

Wei.

Quoted 2 lines

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#4 lore raw
Quoted 32 lines
Quoted 1 line
Quoted 1 line · On 05.12.16 at 16:27, <[email protected]> wrote:
Quoted 18 lines · Wei Liu
Quoted 8 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 05.12.16 at 15:39, <[email protected]> wrote:

Introduce CONFIG_LTO in Kconfig. Since this is the last option to be converted to Kconfig, delete the preceding comment in Rules.mk as well.

Make it depend on BROKEN because it doesn't work at the moment.

Looks fine except for this one aspect: Is that brokenness with gcc, clang, or both? I wouldn't be surprised if it was broken with gcc (in

It's going to be both.

Its build rune is broken.

I got:

head.S:212:0: fatal error: opening dependency file /..d: Permission denied

Quoted 8 lines

That is, this rule

  CFLAGS-y += -MMD -MF $(@D)/.$(@F).d                                           

is evaluated too early outside of prerequisite list, which results in empty string.

Sorry, "evaluated too early outside ..." is non-sense. I will just copy the manpage for automatic variables from Make:

Quoted 7 lines

"In particular, you cannot use them anywhere within the target list of a rule; they have no value there and will expand to the empty string. Also, they cannot be accessed directly within the prerequisite list of a rule. A common mistake is attempting to use $@ within the prerequisites list; this will not work."

The "empty string" part in my description is accurate though.

And iirc we've run into the issue (in a less destructive way) before (even more than once), and do some filtering of CFLAGS in a few places. Apparently we've missed one (or more) ...

Anyway - feel free to put in the patch with my ack, as it certainly doesn't really alter the status quo here.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#5 lore raw
Quoted 38 lines · Jan Beulich
Quoted 38 lines
Quoted 1 line
Quoted 1 line · On 05.12.16 at 16:27, <[email protected]> wrote:
Quoted 18 lines · Wei Liu
Quoted 8 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 05.12.16 at 15:39, <[email protected]> wrote:

Introduce CONFIG_LTO in Kconfig. Since this is the last option to be converted to Kconfig, delete the preceding comment in Rules.mk as well.

Make it depend on BROKEN because it doesn't work at the moment.

Looks fine except for this one aspect: Is that brokenness with gcc, clang, or both? I wouldn't be surprised if it was broken with gcc (in

It's going to be both.

Its build rune is broken.

I got:

head.S:212:0: fatal error: opening dependency file /..d: Permission denied

Quoted 8 lines

That is, this rule

  CFLAGS-y += -MMD -MF $(@D)/.$(@F).d                                           

is evaluated too early outside of prerequisite list, which results in empty string.

Sorry, "evaluated too early outside ..." is non-sense. I will just copy the manpage for automatic variables from Make:

"In particular, you cannot use them anywhere within the target list of a rule; they have no value there and will expand to the empty string. Also, they cannot be accessed directly within the prerequisite list of a rule. A common mistake is attempting to use $@ within the prerequisites list; this will not work."

Quoted 9 lines
Quoted 1 line

The "empty string" part in my description is accurate though.

And iirc we've run into the issue (in a less destructive way) before (even more than once), and do some filtering of CFLAGS in a few places. Apparently we've missed one (or more) ...

Anyway - feel free to put in the patch with my ack, as it certainly doesn't really alter the status quo here.

Thanks!

Quoted 2 lines

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel