| Issue |
177757
|
| Summary |
[libc] poll alias conflict: system sys/poll.h is leaked into src/poll/linux/poll.cpp on Ubuntu 24.04
|
| Labels |
libc
|
| Assignees |
|
| Reporter |
Iasonaskrpr
|
When building libc on Ubuntu 24.04 with GCC 13.3.0, the build fails in poll.cpp. The preprocessor output reveals that the system header /usr/include/x86_64-linux-gnu/sys/poll.h is being included, which declares extern int poll.
When LLVM_LIBC_FUNCTION subsequently tries to define poll with a [[gnu::alias]] attribute, the compiler rejects it because the name poll is already occupied by the external system declaration.
Preprocessor Output:
extern "C" {
54 "/usr/include/x86_64-linux-gnu/sys/poll.h" 3 4
extern int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout)
This leads to the following error during compilation:
llvm-project/libc/src/poll/linux/poll.cpp:23:25: error: ‘int __llvm_libc_23_0_0_git::poll(pollfd*, nfds_t, int)’ aliased to external symbol ‘poll’
23 | LLVM_LIBC_FUNCTION(int, poll, (pollfd * fds, nfds_t nfds, int timeout)) {
Environment
OS: Ubuntu 24.04 LTS (Noble Numbat)
Compiler: g++ (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
Build Command: cmake -G Ninja ../llvm -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS=libc
Steps to reproduce:
Clean build of llvm-project/libc on Ubuntu 24.04 using the system GCC.
Build will fail when building poll.cpp
This issue does not happen when compiling on Clang
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs