[PATCH] D27200: [ELF] - Do not create 4gb output when -obinary -Ttext and -omagic used together.
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 30 13:51:19 PST 2016
ruiu 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) {
----------------
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.
https://reviews.llvm.org/D27200
More information about the llvm-commits
mailing list