Bug 28376 - [meta] Build glibc with Clang
Summary: [meta] Build glibc with Clang
Status: UNCONFIRMED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-22 18:23 UTC by Fangrui Song
Modified: 2021-09-22 18:23 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fangrui Song 2021-09-22 18:23:23 UTC
The main issue is nested function usage which Clang doesn't support (BZ #27220).

Other issues include:

* Clang's asm label cannot be added after the declaration is first referenced [1]
* Clang parses inline asm and is stricter than GCC. asm("@@@ ...") trick can cause compile errors.
* LLVM's integrated assembler may not support some directives
* PowerPC64 -mlong-double-128 support may not be on par with GCC

Severe issues may deserve its own bug. This can be used by miscellaneous small fixes.


[1]:
void bar();
void foo() { bar(); }
void bar() asm("bar1");

GCC happily redirects the bar call to bar1.
Clang rejects this 
x.c:5:6: error: cannot apply asm label to function after its first use
void bar() asm("bar1");
     ^         ~~~~~~