[PATCH] D30627: [ELF] Properly handle .eh_frame in linker scripts

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 7 18:05:27 PST 2017


ruiu accepted this revision.
ruiu added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: ELF/SyntheticSections.cpp:507-508
   Sections.push_back(Sec);
+  std::move(Sec->DependentSections.begin(), Sec->DependentSections.end(),
+            std::back_inserter(DependentSections));
 
----------------
phosek wrote:
> ruiu wrote:
> > phosek wrote:
> > > ruiu wrote:
> > > > What is this for?
> > > `.eh_frame` can have relocations, so we need to ensure that if the `EhFrameSection` gets GC'ed, `.rel.eh_frame`/`.rela.eh_frame` gets GC'ed as well.
> > But when the control reached Writer::run function, all garbage has already been gc'ed, no?
> Not necessarily, for example you can have `/DISCARD/ : { *(.eh_frame) }` in the linker script which only gets processed in `LinkerScript::processCommands`.
Ah, that's right.

Somewhat orthogonal, but can you avoid using std::move and just copy? I don't think we need memory here.


Repository:
  rL LLVM

https://reviews.llvm.org/D30627





More information about the llvm-commits mailing list