[PATCH] D23716: [ELF] Linkerscript: allow adding start/end symbols to arbitrary section

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 29 14:01:07 PDT 2016


ruiu added inline comments.

================
Comment at: ELF/LinkerScript.cpp:321
@@ +320,3 @@
+                        OutputSectionBase<ELFT> *Sec) {
+  bool Start = true, LastSymType = Start;
+  for (std::unique_ptr<BaseCommand> &Base : Cmd->Commands) {
----------------
It seems unnecessarily complicated to me. Why don't you do something like this?

  // Add start symbols.
  for (int I = 0, E = Cmd->Commands.size(); I < E; ++I) {
    if (!isa<SymbolAssignment>(Cmd->Commands[I]))
      break;
    ....
  }

  // Add end symbols.
  for (int I = Cmd->Commands.size() - 1; I >= 0; --I) {
    if (!isa<SymbolAssignment>(Cmd->Commands[I]))
      break;
    ....
  }



https://reviews.llvm.org/D23716





More information about the llvm-commits mailing list