[PATCH] D47602: Correct aligment computation for shared object symbols
Han Shen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 31 13:32:12 PDT 2018
shenhan added inline comments.
================
Comment at: ELF/InputFiles.cpp:901
+ // alignment information.
+ if (Sym.st_shndx == SHN_COMMON && Sym.st_value)
Ret = 1ULL << countTrailingZeros((uint64_t)Sym.st_value);
----------------
pcc wrote:
> ruiu wrote:
> > Are you sure if this is correct?
> It doesn't look right to me -- a dynamic symbol table should not contain symbols in `SHN_COMMON`.
>From ELF specification:
If a symbol’s value refers to a specific location within a section, its section index member, st_shndx,
holds an index into the section header table. (shenhan: if st_shndx contains a valid section index, then st_value is a specific location)
Some special section index values give other semantics.
SHN_COMMON The symbol labels a common block that has not yet been allocated. The symbol’s value
gives alignment constraints, similar to a section’s sh_addralign member. That is, the
link editor will allocate the storage for the symbol at an address that is a multiple of
st_value. (shenhan: if st_shndx equals SHN_COMMON, then st_value is the alignment requirement).
I put my understandings in the (shenhan: ...)
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D47602
More information about the llvm-commits
mailing list