[PATCH] D79300: [ELF] Demote lazy symbols relative to a discarded section to Undefined

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 13 04:16:04 PDT 2020


psmith added inline comments.


================
Comment at: lld/ELF/InputFiles.cpp:1124
+      // fetch. We should demote the lazy symbol to an Undefined.
+      if ((sym->symbolKind == Symbol::LazyArchiveKind &&
+           !cast<ArchiveFile>(sym->file)->parsed) ||
----------------
It took me a while to understand what was going on here. Some suggestions
```
ArchiveFile::parsed or !LazyObjFile::fetched means that the file containing this object has not finished processing, i.e. this symbol is a result of a lazy symbol fetch. We should demote the lazy symbol to an Undefined so that any relocations to it will trigger a discarded section error.
```



================
Comment at: lld/test/ELF/comdat-discarded-lazy.s:12
+## *before* the symbol fetching the lazy object.
+## The test relies on the symbol table order of llvm-mc, which will need
+## adjustment if llvm-mc changes its behavior.
----------------
Can we mention that the symbols are ordered lexically. Something like
```The test relies on the symbol table order of llvm-mc (lexical), which will need ...```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79300





More information about the llvm-commits mailing list