[PATCH] D22683: [ELF] Symbol assignment within input section list
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 28 13:14:41 PDT 2016
ruiu added inline comments.
================
Comment at: ELF/LinkerScript.cpp:46
@@ -45,1 +45,3 @@
+template <class T> static inline T *zero(T *val) {
+ return static_cast<T *>(memset(val, 0, sizeof(*val)));
----------------
val -> Val
================
Comment at: ELF/LinkerScript.cpp:47
@@ +46,3 @@
+template <class T> static inline T *zero(T *val) {
+ return static_cast<T *>(memset(val, 0, sizeof(*val)));
+}
----------------
This is more straightforward.
memset(Val, 0, sizeof(*Val);
return Val;
================
Comment at: ELF/LinkerScript.cpp:66
@@ +65,3 @@
+ : InputSection<ELFT>(nullptr, zero(&Hdr)), Cmd(A) {
+
+ // This section should never be written.
----------------
Remove the blank line.
================
Comment at: ELF/LinkerScript.cpp:67
@@ +66,3 @@
+
+ // This section should never be written.
+ Hdr.sh_type = SHT_NOBITS;
----------------
It's a bit misleading. This section is written, but because it is empty, there's nothing to be written in reality.
================
Comment at: ELF/LinkerScript.cpp:179-182
@@ +178,6 @@
+ for (const std::unique_ptr<BaseCommand> &Base2 : Cmd->Commands)
+ if (auto *Assignment = dyn_cast<SymbolAssignment>(Base2.get()))
+ PendingSymbols.push_back(Assignment);
+ else
+ AddMultiple(Cmd->Name, cast<InputSectionDescription>(Base2.get()));
+
----------------
I do not understand why you needed a concept of "pending" here. You can add a SymbolInputSection as soon as you see a new SymbolAssignment, can't you?
================
Comment at: ELF/LinkerScript.cpp:694
@@ -641,2 +693,3 @@
StringRef Tok = next();
+ std::unique_ptr<SymbolAssignment> Assignment;
if (peek() == "=") {
----------------
REmove this variable and directly add to Opt.Commands.
================
Comment at: ELF/LinkerScript.cpp:789
@@ -733,2 +788,3 @@
StringRef Tok = next();
+ std::unique_ptr<SymbolAssignment> Assignment;
if (Tok == "*") {
----------------
Remove this variable and directly add to Cmd->Commands.
================
Comment at: ELF/LinkerScript.h:152-153
@@ -154,1 +151,4 @@
+
+ // Relative symbol sections.
+ std::vector<std::unique_ptr<InputSectionBase<ELFT>>> RSS;
};
----------------
I think we name this kind of thing `OwningSections`.
Repository:
rL LLVM
https://reviews.llvm.org/D22683
More information about the llvm-commits
mailing list