[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
Tue Nov 29 06:55:16 PST 2016
emaste added a comment.
For me at least this approach (avoiding adding an empty `PT_LOAD`) seems to be nicer than https://reviews.llvm.org/D27201, although I find the ternary operator and different condition on the following line somewhat puzzling. I'm curious what @ruiu or @rafael think.
================
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) {
----------------
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);
}
```
https://reviews.llvm.org/D27200
More information about the llvm-commits
mailing list