llvm / llvm/llvm-project

[Clang] [[gnu::weak, gnu::ifunc]] isn't diagnosed

Open
#220,923 1 comment 0 reactions 0 assignees View on GitHub
accepts-invalid clang:frontend
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Using both `[[gnu::weak]]` and `[[gnu::ifunc]]` is not supported. However, Clang silently drops the `[[gnu::weak]]` part instead of diagnosing the issue like GCC does.
For completeness, here is a simple reproducer:
```c++
extern "C" void* resolver() {
return nullptr;
}

[[gnu::weak, gnu::ifunc("resolver")]] void selector();
```

Contributor guide

Open the contributing guide

Research direction

Start by compiling the provided C++ reproducer in Clang and tracing how the [[gnu::weak]] and [[gnu::ifunc]] attributes are handled. Done means Clang diagnoses their unsupported combination instead of silently dropping [[gnu::weak]], matching GCC's behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.