[PATCH] D36986: [ELF] Handle assignments outside SECTIONS command separately

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 22 14:55:55 PDT 2017


phosek added inline comments.


================
Comment at: ELF/LinkerScript.h:78
+  // Whether the command is within SECTIONS command.
+  bool Sections = true;
 };
----------------
ruiu wrote:
> I think I'd name this `InSections`.
> 
> But do you actually need this? This is I believe virtually a flag indicating whether an element is a direct child of the top element or not. But we can distinguish BaseCommands enclosed in an OutputSections from BaseCommands that are top-level elements, no?
That's what I tried initially, the problem is that `Opt.Commands` would also contain synthetic symbol assignments created by `fabricateDefaultCommands` and those have to be processed  in `assignAddresses` because they modify `.`, so we would need some way to distinguish those commands from other top level symbol assignments. One option would be to create a new subclass e.g. `SyntheticSymbolAssignment` or even `DotAssignment` which would then allow distinguishing the two types of assignments in `assignAddresses`. The other option would be to just add an attribute to `SymbolAssignment`. Any opinion/preference?


Repository:
  rL LLVM

https://reviews.llvm.org/D36986





More information about the llvm-commits mailing list