[PATCH] D78005: [yaml2obj] - Reimplement how tool calculates file and memory sizes of segments.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 24 07:32:11 PDT 2020


grimar added a comment.

Sharing my experiments just in case. A possible example from real life is:

`test.s`:

  .section .foo.nobits, "aw", @nobits
  .quad 0
  
  .section .bar1.nobits, "aw", @nobits
  .quad 0
  .quad 0
  
  .section .bar2.nobits, "aw", @nobits
  .quad 0
  
  .section .zed, "aw"
  .quad 0
  .quad 0
  .quad 0

`test.script:`

  SECTIONS { 
   . = 0x1000;
   .foo.nobits : { *(.foo.nobits) }
   . = 0x1100;
   .zed : { *(.zed) }
   .bar1.nobits : { *(.bar.nobits) }
   .bar2.nobits : { *(.bar.nobits) }
  }

The output from bfd:

  Section Headers:
    [Nr] Name              Type             Address           Offset
         Size              EntSize          Flags  Link  Info  Align
    [ 0]                   NULL             0000000000000000  00000000
         0000000000000000  0000000000000000           0     0     0
    [ 1] .foo.nobits       NOBITS           0000000000001000  00001000
         0000000000000008  0000000000000000  WA       0     0     1
    [ 2] .zed              PROGBITS         0000000000001100  00001100
         0000000000000018  0000000000000000  WA       0     0     1
    [ 3] .bar1.nobits      NOBITS           0000000000001118  00001118
         0000000000000010  0000000000000000  WA       0     0     1
    [ 4] .bar2.nobits      NOBITS           0000000000001128  00001118
         0000000000000008  0000000000000000  WA       0     0     1
  
  Program Headers:
    Type           Offset             VirtAddr           PhysAddr
                   FileSiz            MemSiz              Flags  Align
    LOAD           0x0000000000001000 0x0000000000001000 0x0000000000001000
                   0x0000000000000118 0x0000000000000130  RW     0x1000

With this patch we should be able to describe such objects properly.


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

https://reviews.llvm.org/D78005





More information about the llvm-commits mailing list