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

r365703 breaks multi_v7_defconfig #598

Closed
nathanchance opened this issue Jul 11, 2019 · 6 comments

Comments

Projects
None yet
2 participants
@nathanchance
Copy link
Member

commented Jul 11, 2019

@nickdesaulniers

This comment has been minimized.

Copy link
Member

commented Jul 12, 2019

For bugs involving cc-option, ld-option, and what looks like here as-option I have https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile bookmarked and set as my homepage 🤡 .

What I typically do to debug these is:

diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index ee58cde8ee3b..ca4ab9b0fcbc 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -102,6 +102,8 @@ try-run = $(shell set -e;           \
 # Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
 
 as-option = $(call try-run,\
+       $(info $$KBUILD_CFLAGS are [${KBUILD_CFLAGS}]) \
+       $(info $$1 is [${1}]) \
        $(CC) $(KBUILD_CFLAGS) $(1) -c -x assembler /dev/null -o "$$TMP",$(1),$(2))
 
 # as-instr

Then I rerun make:

$ ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make CC=clang -j71
$KBUILD_CFLAGS are [-Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Wno-format-security -std=gnu89 --target=arm-linux-gnueabi --prefix=/usr/bin/ --gcc-toolchain=/usr -no-integrated-as -fno-dwarf2-cfi-asm ]
$1 is [-Wa,-mno-warn-deprecated]
  UPD     include/config/kernel.release
  UPD     include/generated/utsrelease.h
  CC      scripts/mod/devicetable-offsets.s
  CC      scripts/mod/empty.o
clang-9: error: unsupported argument '-mno-warn-deprecated' to option 'Wa,'
clang-9: error: unsupported argument '-mno-warn-deprecated' to option 'Wa,'

Then I manually recreate the exact command as-option did:

$ clang -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Wno-format-security -std=gnu89 --target=arm-linux-gnueabi --prefix=/usr/bin/ --gcc-toolchain=/usr -no-integrated-as -fno-dwarf2-cfi-asm -Wa,-mno-warn-deprecated -c -x assembler /dev/null

huh, would've expected that to fail (it does not). Since I can repro w/ make, let's try V=1:

$ clang -Wp,-MD,scripts/mod/.empty.o.d  -nostdinc -isystem /android0/llvm-project/llvm/build/lib/clang/9.0.0/include -I./arch/arm/include -I./arch/arm/include/generated  -I./include -I./arch/arm/include/uapi -I./arch/arm/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -mlittle-endian -Qunused-arguments -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Wno-format-security -std=gnu89 --target=arm-linux-gnueabi --prefix=/usr/bin/ --gcc-toolchain=/usr -no-integrated-as -fno-dwarf2-cfi-asm -mabi=aapcs-linux -mfpu=vfp -funwind-tables -marm -Wa,-mno-warn-deprecated -D__LINUX_ARM_ARCH__=7 -march=armv7-a -msoft-float -Uarm -O2 -fstack-protector-strong -Wno-format-invalid-specifier -Wno-gnu -Wno-tautological-compare -mno-global-merge -fomit-frame-pointer -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-initializer-overrides -Wno-unused-value -Wno-format -Wno-sign-compare -Wno-format-zero-length -Wno-uninitialized    -DKBUILD_BASENAME='"empty"' -DKBUILD_MODNAME='"empty"' -c -o scripts/mod/empty.o scripts/mod/empty.c
clang-9: error: unsupported argument '-mno-warn-deprecated' to option 'Wa,'

changing the input from scripts/mod/empty.c to /dev/null makes the error go away. Reducing the flags and giving it a garbage .c file as input leads to:

$ clang -Wa,-mno-warn-deprecated -c hello.c 
clang-9: error: unsupported argument '-mno-warn-deprecated' to option 'Wa,'
$ clang -Wa,-mno-warn-deprecated -c /dev/null
clang-9: warning: /dev/null: 'linker' input unused [-Wunused-command-line-argument]
clang-9: warning: argument unused during compilation: '-Wa,-mno-warn-deprecated' [-Wunused-command-line-argument]
@nickdesaulniers

This comment has been minimized.

Copy link
Member

commented Jul 12, 2019

$ arm-linux-gnueabi-as -mno-warn-deprecated /dev/null

So I think as-option needs the 055efab treatment.

@nathanchance

This comment has been minimized.

Copy link
Member Author

commented Jul 12, 2019

I don't think we can nuke as-option in the same way as cc-ldoption as we can't use $(AS) like $(CC) or $(LD) according to @masahir0y:

The assembler files in the kernel are *.S instead of *.s, so they must
be preprocessed. Since 'as' of GNU binutils is not able to preprocess,
we always use $(CC) as an assembler driver.

https://lore.kernel.org/lkml/20190706162508.8529-1-yamada.masahiro@socionext.com/

@nickdesaulniers nickdesaulniers self-assigned this Jul 12, 2019

@nickdesaulniers

This comment has been minimized.

Copy link
Member

commented Jul 12, 2019

dtzWill pushed a commit to llvm-mirror/clang that referenced this issue Jul 12, 2019

Revert driver: Don't warn about assembler flags being unused when not…
… assembling

This reverts r365703 (git commit 101c1afdfd1c88f05da94c6fd317b489bb704f40)
and r365714.

This broke some autoconf-style assembler flags checks in the Linux
build:
ClangBuiltLinux/linux#598

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365956 91177308-0d34-0410-b5e6-96231b3b80d8

llvm-git-migration pushed a commit to llvm/llvm-project that referenced this issue Jul 12, 2019

Revert driver: Don't warn about assembler flags being unused when not…
… assembling

This reverts r365703 (git commit 101c1af)
and r365714.

This broke some autoconf-style assembler flags checks in the Linux
build:
ClangBuiltLinux/linux#598

llvm-svn: 365956

chapuni pushed a commit to llvm-project/llvm-project-20170507 that referenced this issue Jul 12, 2019

Revert driver: Don't warn about assembler flags being unused when not…
… assembling

This reverts r365703 (git commit 101c1afdfd1c88f05da94c6fd317b489bb704f40)
and r365714.

This broke some autoconf-style assembler flags checks in the Linux
build:
ClangBuiltLinux/linux#598

chapuni pushed a commit to llvm-project/llvm-project-submodule that referenced this issue Jul 12, 2019

Revert driver: Don't warn about assembler flags being unused when not…
… assembling

This reverts r365703 (git commit 101c1afdfd1c88f05da94c6fd317b489bb704f40)
and r365714.

This broke some autoconf-style assembler flags checks in the Linux
build:
ClangBuiltLinux/linux#598
@nathanchance

This comment has been minimized.

Copy link
Member Author

commented Jul 12, 2019

The problematic commit was reverted: llvm/llvm-project@a3aa67b

spurious pushed a commit to spurious/clang-mirror that referenced this issue Jul 12, 2019

rnk
Revert driver: Don't warn about assembler flags being unused when not…
… assembling

This reverts r365703 (git commit 101c1afdfd1c88f05da94c6fd317b489bb704f40)
and r365714.

This broke some autoconf-style assembler flags checks in the Linux
build:
ClangBuiltLinux/linux#598

git-svn-id: http://llvm.org/svn/llvm-project/cfe/trunk@365956 91177308-0d34-0410-b5e6-96231b3b80d8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.