[PATCH] D102383: [ELF] Add -Bno-symbolic

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 14 09:36:59 PDT 2021


MaskRay added a comment.

In D102383#2759061 <https://reviews.llvm.org/D102383#2759061>, @peter.smith wrote:

> LGTM too.
>
> As an aside, is it worth attempting something like "-warn-backrefs", say "-warn-interposition" for executables. In that case we know the definitions of the executable and all the shared libraries as well as the DT_NEEDED order. We could do something like:
> "Warning symbol S of type STT_FUNC is defined in executable A and shared objects B and C, using definition in A.". There would be limitations within LLD as we don't keep much more than the symbol table of shared objects, and it might not know all the shared objects being loaded. There is a possibility of optionally doing more such as loading the dynamic section to check if DF_SYMBOLIC is set, this would permit "Warning symbol S is defined in executable A and shared object B with DF_SYMBOLIC flag. A and B will use different definitions."
>
> Nothing stopping this being an external tool although having it built into the linker makes it easier to use.

This is a good idea. Similar to archive shadowing, if the linker command line contains `... a.so b.so ...` and we know that not all b.so definitions are provided by previous DSOs or the executable, there is a potential interposition risk.

(As of `DF_SYMBOLIC`, it would be really difficult to eliminate copy relocations so `-Bsymbolic` might be impractical for a long time.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102383



More information about the llvm-commits mailing list