[PATCH] D67689: [llvm-objcopy] Add support for --gap-fill and --pad-to options

Hui Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 23 14:52:08 PDT 2019


Hui added inline comments.


================
Comment at: llvm/test/tools/llvm-objcopy/ELF/gap-fill.test:4
+#
+# clang-7 gapfillpadto.cpp -o gapfillpadto.elf
+# void swap(int *a, int *b) {
----------------
jhenderson wrote:
> Hui wrote:
> > asmith wrote:
> > > seiya wrote:
> > > > Is it possible to use yaml2obj instead of adding a binary file? I think we just need few sections to make sure that this patch works well. For example (not tested):
> > > > 
> > > > ```
> > > > !ELF
> > > > FileHeader:
> > > >   Class:           ELFCLASS64
> > > >   Data:            ELFDATA2LSB
> > > >   Type:            ET_EXEC
> > > >   Machine:         EM_X86_64
> > > > Sections:
> > > >   - Name:            .text
> > > >     Type:            SHT_PROGBITS
> > > >     Content:         "AABBCCDD"
> > > >   - Name:            .foo
> > > >     Type:            SHT_PROGBITS
> > > >     Content:         "EEFF"
> > > >   - Name:            .bar
> > > >     Type:            SHT_NOBITS
> > > > ```
> > > That's a good suggestion. Will look into that.
> > This patch resizes the section and its containing segments. (Parent or child segment). One main part of the test is to check the section to segment mapping from PHDR. However yam2obj can't keep program headers.  
> > This patch resizes the section and its containing segments. (Parent or child segment). One main part of the test is to check the section to segment mapping from PHDR. However yam2obj can't keep program headers.
> 
> I'm not sure I understand what you mean here? yaml2obj supports program headers (it has done for a couple of years now I think). See for example llvm/test/tools/yaml2obj/program-header.yaml etc as well as various llvm-objcopy tests using program headers (e.g. llvm/test/tools/llvm-objcopy/segment-test-remove-section.test).
You are right. Actually I was then thinking about using obj2yaml to get yaml file and operate it with yaml2obj in the test.  Unfortunately obj2yaml hasn't supported dumping the program headers (A plausible easy feature to have but not in position yet). So no output about PHDR by yam2obj.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67689/new/

https://reviews.llvm.org/D67689





More information about the llvm-commits mailing list