[PATCH] D29453: [ELF] - Allow going over alignment commands in algorithm of placing non-alloc orphans.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 2 10:57:08 PST 2017


ruiu added a comment.

Please update the commit message to not use that many examples. In general, you want to explain the problem you are fixing and how your patch fixes that, instead of giving examples and let readers make a guess what you are doing.

For example, I'd probably start explaining this patch like this: "SECTIONS command in a linker script may not cover all possible input sections. If there are remaining input sections after processing SECTIONS commands, they will be put into the output using default rules. Such sections are called orphan sections. The default rules are not strictly defined -- that is a set of heuristics. This patch tweaks the default rules a bit so that LLD can link the Linux kernel." And then you want to explain the problem and how you fix it.



================
Comment at: ELF/LinkerScript.cpp:701-704
   const auto *Assign = dyn_cast<SymbolAssignment>(&Cmd);
   if (!Assign)
     return true;
+  return !IsAlloc || Assign->Name != ".";
----------------
This is the linker script you are trying to handle.

  . = ALIGN(16);
  .bss            :
  {
    __bss_start = .;
    *(.bss)
    __bss_end = .;
  }
  . = ALIGN(16);
  _end = .;

It doesn't seem to be related to SHF_ALLOC. I wonder if you want to skip a pair of an alignment and an assignment to a symbol instead.


https://reviews.llvm.org/D29453





More information about the llvm-commits mailing list