[PATCH] D74479: [llvm-readobj] - Report a warning when an unexpected DT_SYMENT tag value is met.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 13 10:33:43 PST 2020


MaskRay accepted this revision.
MaskRay added a comment.

> LLD has the code that does: "addInt(DT_SYMENT, sizeof(Elf_Sym));" and I guess other linkers has the same logic.

Confirmed. GNU ld, gold and MCLinker emit DT_SYMENT.

> It is a bit unclear to me why the DT_SYMENT tag exist.

Probably for extensibility. Many rtld assert it to be equal to sizeof(Elf*_Sym) though...

musl ignores DT_SYMENT.
FreeBSD (usr.sbin/kldxref/ef.c libexec/rtld-elf/rtld.c sys/kern/link_elf.c), elftools/elf/dynamic.py, and android/bionic_loader/linker.cpp  take it as an assertion.
glibc pa-risc reads DT_SYMENT but it seems unnecessary.

An assertion is fine.


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

https://reviews.llvm.org/D74479





More information about the llvm-commits mailing list