Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unsupported argument '-m405' to option 'Wa,' #675

Closed
tpimh opened this issue Sep 23, 2019 · 14 comments
Closed

unsupported argument '-m405' to option 'Wa,' #675

tpimh opened this issue Sep 23, 2019 · 14 comments
Labels
[ARCH] powerpc This bug impacts ARCH=powerpc [FIXED][LINUX] 6.3 This bug was fixed in Linux 6.3 [TOOL] integrated-as The issue is relevant to LLVM integrated assembler

Comments

@tpimh
Copy link

tpimh commented Sep 23, 2019

I'm trying to compile ppc32 kernel using AS=clang (integrated-as in being used). The following error messages are produced when compiling scripts/mod/empty.o:

clang: error: unsupported argument '-m405' to option 'Wa,'

This arguments are added here:

cpu-as-$(CONFIG_4xx) += -Wa,-m405

The compilation continues without error if the option is removed:

--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -244,7 +244,6 @@ KBUILD_CFLAGS	+= $(call cc-option,-fno-dwarf2-cfi-asm)
 # often slow when they are implemented at all
 KBUILD_CFLAGS		+= $(call cc-option,-mno-string)
 
-cpu-as-$(CONFIG_4xx)		+= -Wa,-m405
 cpu-as-$(CONFIG_ALTIVEC)	+= $(call as-option,-Wa$(comma)-maltivec)
 cpu-as-$(CONFIG_E200)		+= -Wa,-me200
 cpu-as-$(CONFIG_E500)		+= -Wa,-me500
@tpimh tpimh added [TOOL] integrated-as The issue is relevant to LLVM integrated assembler [ARCH] powerpc This bug impacts ARCH=powerpc labels Sep 23, 2019
@nickdesaulniers
Copy link
Member

Is this important to have in Clang?

@tpimh
Copy link
Author

tpimh commented Sep 24, 2019

In my opinion just changing this line to $(call as-option,-Wa$(comma)-m405) should be okay, but it should be tested on real hardware.

@nickdesaulniers
Copy link
Member

altivec has that option, so I guess it's ok. If anyone has the hardware to test on, or cares, and this results in a bug, we can fix this then. Otherwise please send the diff you describe.

@nickdesaulniers nickdesaulniers added the [PATCH] Exists There is a patch that fixes this issue label Sep 24, 2019
@nickdesaulniers nickdesaulniers added the low priority This bug is not critical and not a priority label Sep 24, 2019
@tpimh
Copy link
Author

tpimh commented Sep 28, 2019

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 83522c9fc..1efa99f6c 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -244,15 +244,16 @@ KBUILD_CFLAGS	+= $(call cc-option,-fno-dwarf2-cfi-asm)
 # often slow when they are implemented at all
 KBUILD_CFLAGS		+= $(call cc-option,-mno-string)
 
-cpu-as-$(CONFIG_4xx)		+= -Wa,-m405
+cpu-as-$(CONFIG_4xx)		+= $(call as-option,-Wa$(comma)-m405)
 cpu-as-$(CONFIG_ALTIVEC)	+= $(call as-option,-Wa$(comma)-maltivec)
-cpu-as-$(CONFIG_E200)		+= -Wa,-me200
-cpu-as-$(CONFIG_E500)		+= -Wa,-me500
+cpu-as-$(CONFIG_E200)		+= $(call as-option,-Wa$(comma)-me200)
+cpu-as-$(CONFIG_E500)		+= $(call as-option,-Wa$(comma)-me500)
 
 # When using '-many -mpower4' gas will first try and find a matching power4
 # mnemonic and failing that it will allow any valid mnemonic that GAS knows
 # about. GCC will pass -many to GAS when assembling, clang does not.
-cpu-as-$(CONFIG_PPC_BOOK3S_64)	+= -Wa,-mpower4 -Wa,-many
+cpu-as-$(CONFIG_PPC_BOOK3S_64)	+= $(call as-option,-Wa$(comma)-mpower4) \
+					$(call as-option,-Wa$(comma)-many)
 cpu-as-$(CONFIG_PPC_E500MC)	+= $(call as-option,-Wa$(comma)-me500mc)
 
 KBUILD_AFLAGS += $(cpu-as-y)

This patch also addresses #672 as it's a very similar issue with ppc64. Not sure if my padding and newlines are okay.

@tpimh tpimh removed the low priority This bug is not critical and not a priority label Feb 9, 2020
@nickdesaulniers
Copy link
Member

still reproducible with:
ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- make CC=clang LLVM_IAS=1 -j71 ppc44x_defconfig all

@nickdesaulniers
Copy link
Member

perhaps we can wrap all -m<machine name> flags in LLVM_IAS test block?

@nickdesaulniers
Copy link
Member

We should also test if this flag produces changes in the resulting disassembly of the object files that are created with this flag.

@nickdesaulniers
Copy link
Member

@nickdesaulniers
Copy link
Member

cc @aik

@nickdesaulniers
Copy link
Member

Reminiscent of #1771 but not fixed by llvm/llvm-project@de8deb5.

cc @qiongsiwu @nemanjai

@qiongsiwu
Copy link

qiongsiwu commented Jan 3, 2023

Sorry about the delay! I was mostly offline during the Christmas break. Thanks for relaying the issue!

I took a quick look at how clang parses the integrated assembler option (https://github.com/llvm/llvm-project/blob/fa715e2dad4adfe7f8922c299250b4463e1253c9/clang/lib/Driver/ToolChains/Clang.cpp#L2428), and experimented a bit myself. It seems that clang does not support the -Wa,-mxxx style options for the CPU model.

For example,

$ clang -Wa,-m405 test.c                                                                            
clang-16: error: unsupported argument '-m405' to option '-Wa,'
$ clang -Wa,-mppc64 test.c                                                                        
clang-16: error: unsupported argument '-mppc64' to option '-Wa,'
$ clang -Wa,-me200 test.c                                                                   
clang-16: error: unsupported argument '-me200' to option '-Wa,'

However, clang does support the -Wa,-mcpu= options. The following can compile without errors.

$ clang -Wa,-mcpu=405 test.c
$ clang -Wa,-mcpu=ppc64 test.c
$ clang -Wa,-mcpu=e200 test.c

So it seems to me that we will need to add support to the -Wa,-mxxx style option to clang to fix this issue. I am not sure if that is something we'd like to add to clang. @nemanjai what do you think?

@nickdesaulniers
Copy link
Member

bump

@nemanjai
Copy link

nemanjai commented Feb 6, 2023

The -Wa,-mxxx options are used because GCC does not produce object code and rather uses an assembler to assemble the asm output it produces. I think any attempt to wrench the handling of -Wa options to the integrated assembler that is part of Clang would be awkward at best.
Would it be feasible for builds that use Clang to specify the CPU simply with -mcpu=... on the compiler command line?

@mpe
Copy link

mpe commented Mar 1, 2023

This should be fixed in v6.3-rc as of torvalds/linux@bfb03af.

@nathanchance nathanchance added [FIXED][LINUX] 6.3 This bug was fixed in Linux 6.3 and removed [PATCH] Exists There is a patch that fixes this issue labels Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[ARCH] powerpc This bug impacts ARCH=powerpc [FIXED][LINUX] 6.3 This bug was fixed in Linux 6.3 [TOOL] integrated-as The issue is relevant to LLVM integrated assembler
Projects
None yet
Development

No branches or pull requests

6 participants