dblaikie added a comment.
In D143803#4120000 <https://reviews.llvm.org/D143803#4120000>, @0xdc03 wrote:
> Note that as it stands currently, this patch cannot be committed because the
> test `clang/test/SemaCXX/externc-ifunc-resolver.cpp` fails to run. The
> contents of the test are as follows:
>
> // RUN: %clang_cc1 -emit-llvm-only -triple x86_64-linux-gnu -verify %s
>
> extern "C" {
> __attribute__((used)) static void *resolve_foo() { return 0; }
> namespace NS {
> __attribute__((used)) static void *resolve_foo() { return 0; }
> } // namespace NS
>
> // FIXME: This diagnostic is pretty confusing, the issue is that the
> existence
> // of the two functions suppresses the 'alias' creation, and thus the ifunc
> // resolution via the alias as well. In the future we should probably find
> // some way to improve this diagnostic (likely by diagnosing when we decide
> // this case suppresses alias creation).
> __attribute__((ifunc("resolve_foo"))) void foo(); // expected-error{{ifunc
> must point to a defined function}}
> }
>
> The error that I get is as follows:
>
> Command Output (stderr):
> --
> + : 'RUN: at line 1'
> + /mnt/entschuldigung/LLVM/llvm-main/build-release/bin/clang -cc1
> -internal-isystem
> /mnt/entschuldigung/LLVM/llvm-main/build-release/lib/clang/17/include
> -nostdsysteminc -emit-llvm-only -triple x86_64-linux-gnu -verify
> /mnt/entschuldigung/LLVM/llvm-main/clang/test/SemaCXX/externc-ifunc-resolver.cpp
> error: 'note' diagnostics seen but not expected:
> File
> /mnt/entschuldigung/LLVM/llvm-main/clang/test/SemaCXX/externc-ifunc-resolver.cpp
> Line 14: 'resolve_foo' exists as a mangled name, did you mean to use
> '_ZL11resolve_foov'?
> File
> /mnt/entschuldigung/LLVM/llvm-main/clang/test/SemaCXX/externc-ifunc-resolver.cpp
> Line 14: 'resolve_foo' exists as a mangled name, did you mean to use
> '_ZN2NSL11resolve_fooEv'?
> 2 errors generated.
>
> --
>
> which confuses me because an `extern "C"` block is not supposed to mangle any
> names, right? Appreciate any inputs on this.
Looks like maybe a Clang feature, that since they're "static"/internal linkage,
Clang decides it can still mangle them: https://godbolt.org/z/6oMfjced1 - GCC
doesn't do this, and fails if you try to overload them, whereas clang doesn't.
That does surprise me - if only for GCC/Clang compatibility, regardless of what
the spec says, exactly...
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143803/new/
https://reviews.llvm.org/D143803
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits