[PATCH] D27200: [ELF] - Do not create 4gb output when -obinary -Ttext and -omagic used together.

Ed Maste via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 30 14:00:36 PST 2016


emaste added inline comments.


================
Comment at: ELF/Writer.cpp:1130
+  // have file or program headers.
+  Phdr *Load = Config->OFormatBinary ? nullptr : AddHdr(PT_LOAD, Flags);
+  if (!ScriptConfig->HasSections && !Config->OFormatBinary) {
----------------
ruiu wrote:
> emaste wrote:
> > Ah. Why do we add Load for the `!ScriptConfig->HasSections` case?
> > 
> > For me at least this seems to make it more clear:
> > ```
> > Phdr *Load = nullptr;
> > if (!ScriptConfig->HasSections && !Config->OFormatBinary) {
> >     Load = AddHdr(PT_LOAD, Flags);
> >     Load->add(Out<ELFT>::ElfHeader);
> >     Load->add(Out<ELFT>::ProgramHeaders);
> > }
> > ```
> > 
> Agreed. But furthermore, can we avoid calling createPhdrs() at all if OFormatBinary is true? If it's true, all data created in this function will be just ignored later.
That would be even more clear :)


https://reviews.llvm.org/D27200





More information about the llvm-commits mailing list