[PATCH] D72197: [MC][ELF] Emit a relocation if target is defined in the same section and is non-local

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 9 14:56:20 PST 2020


MaskRay added a comment.

I think I've got weak approvals from @jyknight, @peter.smith and @sfertile .

I built clang+lld at f937b43fdb30b67facf616ad394976b08001ee89 <https://reviews.llvm.org/rGf937b43fdb30b67facf616ad394976b08001ee89> and this patch (b352577b4967e2cb5bffce5aec55e5fbdc291bb1). Use that to build clang at f937b43fdb30b67facf616ad394976b08001ee89 <https://reviews.llvm.org/rGf937b43fdb30b67facf616ad394976b08001ee89>.

I then compare the executables and shared objects

`for i in Play/bin/clang-10 Play/lib/lib*.so.10git; do cmp -l $i /tmp/$i | wc -l; done`. Everything except `.comment` is byte identical. `.comment` are different because the two `clang`s have different VCS information.

  % readelf -p.comment Play/bin/clang-10 /tmp/Play/bin/clang-10
  
  File: Play/bin/clang-10
  
  String dump of section '.comment':
    [     0]  GCC: (Debian 8.3.0-6) 8.3.0
    [    1c]  clang version 10.0.0 (git at github.com:MaskRay/llvm-project.git f937b43fdb30b67facf616ad394976b08001ee89)
    [    84]  Linker: LLD 10.0.0 (git at github.com:MaskRay/llvm-project.git f937b43fdb30b67facf616ad394976b08001ee89)
  
  
  File: /tmp/Play/bin/clang-10
  
  String dump of section '.comment':
    [     0]  GCC: (Debian 8.3.0-6) 8.3.0
    [    1c]  clang version 10.0.0 (git at github.com:MaskRay/llvm-project.git b352577b4967e2cb5bffce5aec55e5fbdc291bb1)
    [    84]  Linker: LLD 10.0.0 (git at github.com:MaskRay/llvm-project.git b352577b4967e2cb5bffce5aec55e5fbdc291bb1)

Does the result look good enough?

> There is a chance this patch affects some users negatively despite being correct.

I don't think this is more dangerous than some other MC or linker changes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72197





More information about the llvm-commits mailing list