[all-commits] [llvm/llvm-project] 43b133: [ELF] Add internal InputFile (#78944)
Fangrui Song via All-commits
all-commits at lists.llvm.org
Mon Jan 22 09:09:58 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 43b13341fbbb718223484a79a539a3c13062f39f
https://github.com/llvm/llvm-project/commit/43b13341fbbb718223484a79a539a3c13062f39f
Author: Fangrui Song <i at maskray.me>
Date: 2024-01-22 (Mon, 22 Jan 2024)
Changed paths:
M lld/ELF/Arch/ARM.cpp
M lld/ELF/Arch/Mips.cpp
M lld/ELF/Arch/PPC64.cpp
M lld/ELF/Config.h
M lld/ELF/Driver.cpp
M lld/ELF/InputFiles.cpp
M lld/ELF/InputFiles.h
M lld/ELF/InputSection.cpp
M lld/ELF/InputSection.h
M lld/ELF/LTO.cpp
M lld/ELF/LinkerScript.cpp
M lld/ELF/Relocations.cpp
M lld/ELF/ScriptLexer.h
M lld/ELF/ScriptParser.cpp
M lld/ELF/SyntheticSections.cpp
M lld/ELF/Target.cpp
M lld/ELF/Writer.cpp
M lld/test/ELF/cref.s
M lld/test/ELF/linkerscript/symbol-ordering-file2.s
M lld/test/ELF/x86-64-gotpc-no-relax-err.s
Log Message:
-----------
[ELF] Add internal InputFile (#78944)
Based on https://reviews.llvm.org/D45375 . Introduce a new InputFile
kind `InternalKind`, use it for
* `ctx.internalFile`: for linker-defined symbols and some synthesized
`Undefined`
* `createInternalFile`: for symbol assignments and --defsym
I picked "internal" instead of "synthetic" to avoid confusion with
SyntheticSection.
Currently a symbol's file is one of: nullptr, ObjKind, SharedKind,
BitcodeKind, BinaryKind. Now it's non-null (I plan to add an
`assert(file)` to Symbol::Symbol and change `toString(const InputFile
*)`
separately).
Debugging and error reporting gets improved. The immediate user-facing
difference is more descriptive "File" column in the --cref output. This
patch may unlock further simplification.
Currently each symbol assignment gets its own
`createInternalFile(cmd->location)`. Two symbol assignments in a linker
script do not share the same file. Making the file the same would be
nice, but would require non trivial code.
More information about the All-commits
mailing list