[PATCH] D47602: Correct aligment computation for shared object symbols

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 31 15:55:43 PDT 2018


pcc added inline comments.


================
Comment at: ELF/InputFiles.cpp:899
+  // If no available alignment information from either section or
+  // symbol, return 1.
+  if (!(Sym.st_value || (0 < Sym.st_shndx && Sym.st_shndx < Sections.size())))
----------------
Is that correct? If there is a symbol at virtual address 0 in an unknown section, doesn't that mean that we should error out via the `Ret > UINT32_MAX` code path below since we don't know what alignment to use?


================
Comment at: test/ELF/relocation-copy-alignment.s:4
+// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/relocation-copy-alignment.s -o %t2.o
+// RUN: ld.lld -shared %t2.o -o %t.so
+// RUN: ld.lld %t.o %t.so -o %t3
----------------
What are the `st_value`s of the symbols in `%t.so`? I don't think this would result in any of them being 0. You might want to consider using `yaml2obj` to create the .so file.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D47602





More information about the llvm-commits mailing list