-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillac++clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"extension:gnu
Description
| Bugzilla Link | 17775 |
| Version | trunk |
| OS | Linux |
| Blocks | #44654 |
| Attachments | Minimal reproducer for weak-alias problem |
| Reporter | LLVM Bugzilla Contributor |
| CC | @DougGregor,@slacka,@tstellar |
Extended Description
Weak aliases to unused static functions fail with an error message. It looks like the compiler is first removing the unused static function then complaining that it can't create a weak alias to a function that no longer exists:
$ clang++ --version | head -1
clang version 3.4 (trunk)
$ clang++ -c aliasing.cpp
aliasing.cpp:8:56: error: alias must point to a defined variable or function
const char* do_something (void) __attribute__((weak, alias("do_somethi...
^
1 error generated.
$ g++ --version | head -1
g++ (GCC) 4.7.2
$ g++ -c aliasing.cpp
I'm seeing this problem with r193799, but I recall it working in r190315. This seems to be a C++ issue; analogous C code made it through clang with no problems.
Defining do_something_original() as non-static in the attached file makes the problem go away, but in my real code I'd prefer to have the function declared static.
-- Scott
Metadata
Metadata
Assignees
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillac++clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"extension:gnu