[PATCH] D23769: [ELF] - Implemented --oformat binary option.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 24 03:48:53 PDT 2016


grimar added inline comments.

================
Comment at: ELF/Writer.cpp:267-268
@@ -263,2 +266,4 @@
                                                 : createPhdrs();
-    fixHeaders();
+    if (Config->OFormat == OutputFormat::Elf)
+      fixHeaders();
+
----------------
ruiu wrote:
> Do you have to not call this function?  I don't like to sprinkle OFormatBinary check everywhere. If it works with this function call, remove this check.
I have to call it because it sets size for Out<ELFT>::ProgramHeaders:

```
 Out<ELFT>::ProgramHeaders->setSize(sizeof(Elf_Phdr) * Phdrs.size());
```

What affects on:
```
template <class ELFT> void Writer<ELFT>::assignAddresses() {
  uintX_t VA = Config->ImageBase + Out<ELFT>::ElfHeader->getSize() +
               Out<ELFT>::ProgramHeaders->getSize();
```

I think this minimal change is better then add code to avoid using these 2 special sections at all ?


https://reviews.llvm.org/D23769





More information about the llvm-commits mailing list