-
Notifications
You must be signed in to change notification settings - Fork 12k
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
[clang] clang -mpopcnt hello.c <link flag>
fails to generate warning when file precedes link flag
#116278
Comments
@llvm/issue-subscribers-clang-driver Author: Reno Dakota (paparodeo)
on aarch64 darwin using the `-mpopcnt` flag will result in a warning on clang 16 and error on clang 19.1.3. however, if a linker flag trails the file name no warning / error is generated. eg:
$ clang -mpopcnt hello.c -lc
$ ./a.out
hello world however, re-ordering the command line so the file name comes after $ clang -mpopcnt -lc hello.c
clang: error: unsupported option '-mpopcnt' for target 'aarch64-apple-darwin' this behavior is not seen with all link flags, eg $ clang -mpopcnt -flat_namespace hello.c
clang: error: unsupported option '-mpopcnt' for target 'aarch64-apple-darwin'
$ clang -mpopcnt hello.c -flat_namespace
clang: error: unsupported option '-mpopcnt' for target 'aarch64-apple-darwin'
$ clang -mpopcnt -Wl,-flat_namespace hello.c
clang: error: unsupported option '-mpopcnt' for target 'aarch64-apple-darwin'
$ clang -mpopcnt hello.c -Wl,-flat_namespace
$ ./a.out
hello world $ clang -v
clang version 19.1.3
Target: aarch64-apple-darwin24.1.0
Thread model: posix
InstalledDir: /nix/store/6b4vxqc16xq1nq8jhdsylfml244vah22-clang-19.1.3/bin |
this can be reproduce on x64 linux by finding some other unsupported option: eg $ clang -mno-mma -mhtm hello.c
clang: error: unsupported option '-mno-mma' for target 'x86_64-unknown-linux-gnu'
clang: error: unsupported option '-mhtm' for target 'x86_64-unknown-linux-gnu'
$ clang -mno-mma -mhtm hello.c -lc
$ ./a.out
hello world |
seems to be this block which is swallowing the errors: llvm-project/clang/lib/Driver/Driver.cpp Lines 4132 to 4139 in 47928ab
|
on aarch64 darwin using the
-mpopcnt
flag will result in a warning on clang 16 and error on clang 19.1.3. however, if a linker flag trails the file name no warning / error is generated. eg:however, re-ordering the command line so the file name comes after
-lc
will generate the expected errorthis behavior is not seen with all link flags, eg
-flat_namespace
always will generate an error, but when used in conjunction with-Wl
will generate an error (as do other flags, like-v
)The text was updated successfully, but these errors were encountered: