[PATCH] D30851: [ELF] Support ABSOLUTE on the right hand side in linkerscripts

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 13 02:49:35 PDT 2017


grimar added inline comments.


================
Comment at: ELF/LinkerScript.cpp:764
+  }
+}
+
----------------
That can be shorter:

```
  for (const std::unique_ptr<BaseCommand> &Base : Opt.Commands) {
    if (auto *Cmd = dyn_cast<SymbolAssignment>(Base.get()))
      assignSymbol(Cmd);
    else if (auto *Cmd = dyn_cast<AssertCommand>(Base.get()))
      Cmd->Expression();
  }

```

Also name of method doesn't really corresponds to what it do, it also processes AssertCommand, not just
assign symbols.


================
Comment at: ELF/LinkerScript.cpp:1839
+    expect(")");
+    return [=]() { return E(); };
+  }
----------------
I think you could just

```
    expect(")");
    return E;
```


================
Comment at: test/ELF/linkerscript/absolute.s:8
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
+# RUN: echo "PROVIDE(foo = 1 + ABSOLUTE(ADDR(.text)));" > %t.script
----------------
you don't need to add "requires x86" and to run llvm-mc again.


Repository:
  rL LLVM

https://reviews.llvm.org/D30851





More information about the llvm-commits mailing list