Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

-fsemantic-interposition breaks extern inline #49446

Open Quuxplusone opened 3 years ago

Quuxplusone commented 3 years ago
Bugzilla Link PR50477
Status NEW
Importance P enhancement
Reported by Szabolcs Nagy (szabolcs.nagy@arm.com)
Reported on 2021-05-26 02:09:52 -0700
Last modified on 2021-06-01 00:41:41 -0700
Version trunk
Hardware All Linux
CC htmldeveloper@gmail.com, i@maskray.me, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
consider

void foo_good();
extern inline void foo()
{
    foo_good();
}
void bar()
{
    foo();
}

using: -fsemantic-interposition -fPIC -O2
expected: no reference to foo, only to foo_good.
got: interposable call to foo.

with -O0 i expect a local call to foo that is not interposable.

(i don't think iso c requires either way, but
gcc implements it the described way on elf
platforms and existing software relies on it.
at least on linux targets clang should follow.)
Quuxplusone commented 3 years ago

what software relies on the gcc behavior?

software needing -fsemantic-interposition is rare. clang has always been allowing interprocedural optimizations in ELF -fpic mode.

Quuxplusone commented 3 years ago
i spotted this in glibc code (which also uses -fgnu89-inline)

but glibc is probably not the only affected software:
in gcc -fsemantic-interposition is the default.