[PATCH] D102570: [ELF] Add -Bsymbolic-non-weak-functions

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 29 15:34:09 PDT 2021


MaskRay added a comment.

In D102570#2914940 <https://reviews.llvm.org/D102570#2914940>, @smeenai wrote:

> Android is considering this as their default behavior: https://github.com/android/ndk/issues/1552
>
> Do you think it's worth cherry-picking this to LLVM 13, to get it more exposure? CC @tstellar

LGTM. This is a very safe patch.

> On our end, we build with full `-Bsymbolic` right now. Once we're testing with LLVM 13, I'll try `-Bsymbolic-functions` and `-Bsymbolic-non-weak-functions` and see if they make any meaningful performance or size differences for our apps (and how a hypothetical `-Bsymbolic-non-weak`, which would match default Mach-O behavior, might perform as well).

I also tested some internal server side applications. Some applications break with -Bsymbolic-functions but work with -Bsymbolic-non-weak-functions,  so they do leverage function address pointer equality.

Adding `-Bsymbolic-non-weak` is also fine. I am always of the view that global variable accesses should not be in the performance bottleneck. Most applications should not observe any difference.
If an application sees improvement, it suggests some code problems. They can consider making the variable hidden (or protected if they don't use -fno-pic)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102570/new/

https://reviews.llvm.org/D102570



More information about the llvm-commits mailing list