This is based on D39348, but adds a new kind of input file JustSymbolsFile which is derived from ELFFileBase. The argument is treated as a normal input file so the case where it is the sole input works and we get to reuse some of code from ELFFileBase.
Details
Diff Detail
Event Timeline
Sorry I missed this one.
ELF/Driver.cpp | ||
---|---|---|
183 | You can just call Files.push_back(createJustSymbolsFile(MBRef)) instead of calling addFile. | |
ELF/Driver.h | ||
30 ↗ | (On Diff #127076) | I don't like an optional argument in general. Please avoid using it in lld. |
ELF/InputFiles.h | ||
337 | Remove InputFile::. | |
ELF/SymbolTable.cpp | ||
77 | Obviously you need a comment just like other code blocks. |
Added a check to only allow ET_EXEC and the corresponding test.
On Tue, Dec 19, 2017 at 9:54 AM, Rafael Avila de Espindola <rafael.espindola@gmail.com> wrote:
This patch allows --just-symbols to be a ET_DYN, ET_REL or ET_EXEC. Do
you need all 3? ET_REL in particular seems problematic since st_value
has a different meaning in relocatable files.If you don't need ET_DYN or ET_REL, please reject them. If you need
them, please add a test.
ld.bfd accepts ET_EXEC and ET_REL but not ET_DYN. However I don't think this option makes much sense for ET_REL inputs so I'm restricting it to ET_EXEC for now.
Implement the -R option as an alias to either --rpath or --just-symbols. It is treated as latter if the argument file exists and is not a directory.
This works fine for me. Perhaps Rui should land D39348 first and then you can rebase this in terms of that to discuss the remaining features (-R alias, no input files case).
You can just call Files.push_back(createJustSymbolsFile(MBRef)) instead of calling addFile.