Skip to content

Commit da4471b

Browse files
authored
Merge pull request #264 from nathanchance/add-patches-for-llvm-main-breakage
Add patches to fix performing PGO with current LLVM main
2 parents ad4370e + 1c8abe1 commit da4471b

3 files changed

+163
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
From git@z Thu Jan 1 00:00:00 1970
2+
Subject: [PATCH] hexagon: vmlinux.lds.S: Handle attributes section
3+
From: Nathan Chancellor <[email protected]>
4+
Date: Tue, 19 Mar 2024 17:37:46 -0700
5+
Message-Id: <20240319-hexagon-handle-attributes-section-vmlinux-lds-s-v1-1-59855dab8872@kernel.org>
6+
MIME-Version: 1.0
7+
Content-Type: text/plain; charset="utf-8"
8+
Content-Transfer-Encoding: 7bit
9+
10+
After the linked LLVM change, the build fails with
11+
CONFIG_LD_ORPHAN_WARN_LEVEL="error", which happens with allmodconfig:
12+
13+
ld.lld: error: vmlinux.a(init/main.o):(.hexagon.attributes) is being placed in '.hexagon.attributes'
14+
15+
Handle the attributes section in a similar manner as arm and riscv by
16+
adding it after the primary ELF_DETAILS grouping in vmlinux.lds.S, which
17+
fixes the error.
18+
19+
20+
Fixes: 113616ec5b64 ("hexagon: select ARCH_WANT_LD_ORPHAN_WARN")
21+
Link: https://github.com/llvm/llvm-project/commit/31f4b329c8234fab9afa59494d7f8bdaeaefeaad
22+
Reviewed-by: Brian Cain <[email protected]>
23+
Link: https://lore.kernel.org/r/20240319-hexagon-handle-attributes-section-vmlinux-lds-s-v1-1-59855dab8872@kernel.org
24+
Signed-off-by: Nathan Chancellor <[email protected]>
25+
---
26+
arch/hexagon/kernel/vmlinux.lds.S | 1 +
27+
1 file changed, 1 insertion(+)
28+
29+
diff --git a/arch/hexagon/kernel/vmlinux.lds.S b/arch/hexagon/kernel/vmlinux.lds.S
30+
index 1140051a0c45..1150b77fa281 100644
31+
--- a/arch/hexagon/kernel/vmlinux.lds.S
32+
+++ b/arch/hexagon/kernel/vmlinux.lds.S
33+
@@ -63,6 +63,7 @@ SECTIONS
34+
STABS_DEBUG
35+
DWARF_DEBUG
36+
ELF_DETAILS
37+
+ .hexagon.attributes 0 : { *(.hexagon.attributes) }
38+
39+
DISCARDS
40+
}
41+
42+
---
43+
base-commit: e8f897f4afef0031fe618a8e94127a0934896aba
44+
change-id: 20240319-hexagon-handle-attributes-section-vmlinux-lds-s-2a14b14799c0
45+
46+
Best regards,
47+
--
48+
Nathan Chancellor <[email protected]>
49+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
From 35f20786c481d5ced9283ff42de5c69b65e5ed13 Mon Sep 17 00:00:00 2001
2+
From: Nathan Chancellor <[email protected]>
3+
Date: Sat, 27 Jan 2024 11:07:43 -0700
4+
Subject: powerpc: xor_vmx: Add '-mhard-float' to CFLAGS
5+
6+
arch/powerpc/lib/xor_vmx.o is built with '-msoft-float' (from the main
7+
powerpc Makefile) and '-maltivec' (from its CFLAGS), which causes an
8+
error when building with clang after a recent change in main:
9+
10+
error: option '-msoft-float' cannot be specified with '-maltivec'
11+
make[6]: *** [scripts/Makefile.build:243: arch/powerpc/lib/xor_vmx.o] Error 1
12+
13+
Explicitly add '-mhard-float' before '-maltivec' in xor_vmx.o's CFLAGS
14+
to override the previous inclusion of '-msoft-float' (as the last option
15+
wins), which matches how other areas of the kernel use '-maltivec', such
16+
as AMDGPU.
17+
18+
19+
Closes: https://github.com/ClangBuiltLinux/linux/issues/1986
20+
Link: https://github.com/llvm/llvm-project/commit/4792f912b232141ecba4cbae538873be3c28556c
21+
Signed-off-by: Nathan Chancellor <[email protected]>
22+
Signed-off-by: Michael Ellerman <[email protected]>
23+
Link: https://msgid.link/20240127-ppc-xor_vmx-drop-msoft-float-v1-1-f24140e81376@kernel.org
24+
---
25+
Link: https://git.kernel.org/powerpc/c/35f20786c481d5ced9283ff42de5c69b65e5ed13
26+
---
27+
arch/powerpc/lib/Makefile | 2 +-
28+
1 file changed, 1 insertion(+), 1 deletion(-)
29+
30+
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
31+
index 6eac63e79a8995..0ab65eeb93ee3a 100644
32+
--- a/arch/powerpc/lib/Makefile
33+
+++ b/arch/powerpc/lib/Makefile
34+
@@ -76,7 +76,7 @@ obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o
35+
obj-$(CONFIG_FTR_FIXUP_SELFTEST) += feature-fixups-test.o
36+
37+
obj-$(CONFIG_ALTIVEC) += xor_vmx.o xor_vmx_glue.o
38+
-CFLAGS_xor_vmx.o += -maltivec $(call cc-option,-mabi=altivec)
39+
+CFLAGS_xor_vmx.o += -mhard-float -maltivec $(call cc-option,-mabi=altivec)
40+
# Enable <altivec.h>
41+
CFLAGS_xor_vmx.o += -isystem $(shell $(CC) -print-file-name=include)
42+
43+
--
44+
cgit 1.2.3-korg
45+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
From 75b5ab134bb5f657ef7979a59106dce0657e8d87 Mon Sep 17 00:00:00 2001
2+
From: Nathan Chancellor <[email protected]>
3+
Date: Tue, 5 Mar 2024 15:12:47 -0700
4+
Subject: kbuild: Move -Wenum-{compare-conditional,enum-conversion} into W=1
5+
6+
Clang enables -Wenum-enum-conversion and -Wenum-compare-conditional
7+
under -Wenum-conversion. A recent change in Clang strengthened these
8+
warnings and they appear frequently in common builds, primarily due to
9+
several instances in common headers but there are quite a few drivers
10+
that have individual instances as well.
11+
12+
include/linux/vmstat.h:508:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
13+
508 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
14+
| ~~~~~~~~~~~~~~~~~~~~~ ^
15+
509 | item];
16+
| ~~~~
17+
18+
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c:955:24: warning: conditional expression between different enumeration types ('enum iwl_mac_beacon_flags' and 'enum iwl_mac_beacon_flags_v1') [-Wenum-compare-conditional]
19+
955 | flags |= is_new_rate ? IWL_MAC_BEACON_CCK
20+
| ^ ~~~~~~~~~~~~~~~~~~
21+
956 | : IWL_MAC_BEACON_CCK_V1;
22+
| ~~~~~~~~~~~~~~~~~~~~~
23+
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c:1120:21: warning: conditional expression between different enumeration types ('enum iwl_mac_beacon_flags' and 'enum iwl_mac_beacon_flags_v1') [-Wenum-compare-conditional]
24+
1120 | 0) > 10 ?
25+
| ^
26+
1121 | IWL_MAC_BEACON_FILS :
27+
| ~~~~~~~~~~~~~~~~~~~
28+
1122 | IWL_MAC_BEACON_FILS_V1;
29+
| ~~~~~~~~~~~~~~~~~~~~~~
30+
31+
Doing arithmetic between or returning two different types of enums could
32+
be a bug, so each of the instance of the warning needs to be evaluated.
33+
Unfortunately, as mentioned above, there are many instances of this
34+
warning in many different configurations, which can break the build when
35+
CONFIG_WERROR is enabled.
36+
37+
To avoid introducing new instances of the warnings while cleaning up the
38+
disruption for the majority of users, disable these warnings for the
39+
default build while leaving them on for W=1 builds.
40+
41+
42+
Closes: https://github.com/ClangBuiltLinux/linux/issues/2002
43+
Link: https://github.com/llvm/llvm-project/commit/8c2ae42b3e1c6aa7c18f873edcebff7c0b45a37e
44+
Acked-by: Yonghong Song <[email protected]>
45+
Signed-off-by: Nathan Chancellor <[email protected]>
46+
Acked-by: Arnd Bergmann <[email protected]>
47+
Signed-off-by: Masahiro Yamada <[email protected]>
48+
---
49+
Link: https://git.kernel.org/masahiroy/linux-kbuild/c/75b5ab134bb5f657ef7979a59106dce0657e8d87
50+
---
51+
scripts/Makefile.extrawarn | 2 ++
52+
1 file changed, 2 insertions(+)
53+
54+
diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
55+
index a9e552a1e9105b..2f25a1de129d10 100644
56+
--- a/scripts/Makefile.extrawarn
57+
+++ b/scripts/Makefile.extrawarn
58+
@@ -132,6 +132,8 @@ KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast)
59+
KBUILD_CFLAGS += -Wno-tautological-constant-out-of-range-compare
60+
KBUILD_CFLAGS += $(call cc-disable-warning, unaligned-access)
61+
KBUILD_CFLAGS += $(call cc-disable-warning, cast-function-type-strict)
62+
+KBUILD_CFLAGS += -Wno-enum-compare-conditional
63+
+KBUILD_CFLAGS += -Wno-enum-enum-conversion
64+
endif
65+
66+
endif
67+
--
68+
cgit 1.2.3-korg
69+

0 commit comments

Comments
 (0)