[PATCH] D63869: [ELF] Do not produce DT_JMPREL and DT_PLTGOT if .rela.plt is empty.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 27 07:18:33 PDT 2019


MaskRay added inline comments.


================
Comment at: test/ELF/empty-relaplt-dyntags.test:10
+## produce DT_JMPREL and DT_PLTGOT tags because this can cause a dynamic loader
+## to write into memory it considers reserved. In fact, as .got.plt is also
+## empty, that memory might be allocated for something else.
----------------
I think you need a readelf -S test to check that .rela.plt exists.

Then, for this comment, you may just say that we should not write a DT_JMPREL of 0, because otherwise the first few slots of the entries pointed to by DT_PLTGOT may be unexpected accessed at runtime.

The test doesn't add .got.plt (actually in glibc DT_PLTGOT will not be used if DT_JMPREL does not exist).


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

https://reviews.llvm.org/D63869





More information about the llvm-commits mailing list