[PATCH] D137620: [BOLT] Don't align .text to pageAlign

Denis Revunov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 8 03:01:37 PST 2022


treapster added a comment.

Full readelf before:

  There are 34 section headers, starting at offset 0x400f40:
  
  Section Headers:
    [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
    [ 0]                   NULL            0000000000000000 000000 000000 00      0   0  0
    [ 1] .interp           PROGBITS        00000000000002a8 0002a8 00001c 00   A  0   0  1
    [ 2] .note.ABI-tag     NOTE            00000000000002c4 0002c4 000020 00   A  0   0  4
    [ 3] .gnu.hash         GNU_HASH        00000000000002e8 0002e8 000024 00   A  4   0  8
    [ 4] .dynsym           DYNSYM          0000000000000310 000310 0000a8 18   A  5   1  8
    [ 5] .dynstr           STRTAB          00000000000003b8 0003b8 000084 00   A  0   0  1
    [ 6] .gnu.version      VERSYM          000000000000043c 00043c 00000e 02   A  4   0  2
    [ 7] .gnu.version_r    VERNEED         0000000000000450 000450 000020 00   A  5   1  8
    [ 8] .rela.dyn         RELA            0000000000000470 000470 0000c0 18   A  4   0  8
    [ 9] .rela.plt         RELA            0000000000000530 000530 000018 18  AI  4  22  8
    [10] .init             PROGBITS        0000000000001000 001000 00001b 00  AX  0   0  4
    [11] .plt              PROGBITS        0000000000001020 001020 000020 10  AX  0   0 16
    [12] .plt.got          PROGBITS        0000000000001040 001040 000008 08  AX  0   0  8
    [13] .bolt.org.text    PROGBITS        0000000000001050 001050 0001a5 00  AX  0   0 16
    [14] .fini             PROGBITS        00000000000011f8 0011f8 00000d 00  AX  0   0  4
    [15] .rodata           PROGBITS        0000000000002000 002000 000012 00   A  0   0  4
    [16] .bolt.org.eh_frame_hdr PROGBITS        0000000000002014 002014 000044 00   A  0   0  4
    [17] .bolt.org.eh_frame PROGBITS        0000000000002058 002058 000110 00   A  0   0  8
    [18] .init_array       INIT_ARRAY      0000000000003de8 002de8 000008 08  WA  0   0  8
    [19] .fini_array       FINI_ARRAY      0000000000003df0 002df0 000008 08  WA  0   0  8
    [20] .dynamic          DYNAMIC         0000000000003df8 002df8 0001e0 10  WA  5   0  8
    [21] .got              PROGBITS        0000000000003fd8 002fd8 000028 08  WA  0   0  8
    [22] .got.plt          PROGBITS        0000000000004000 003000 000020 08  WA  0   0  8
    [23] .data             PROGBITS        0000000000004020 003020 000010 00  WA  0   0  8
    [24] .tm_clone_table   PROGBITS        0000000000004030 003030 000000 00  WA  0   0  8
    [25] .bss              NOBITS          0000000000004030 003030 000008 00  WA  0   0  1
    [26] .text             PROGBITS        0000000000400000 400000 0001b1 00  AX  0   0 2097152
    [27] .eh_frame         PROGBITS        00000000004001b8 4001b8 0001e0 00   A  0   0  8
    [28] .eh_frame_hdr     PROGBITS        0000000000400398 400398 00006c 00   A  0   0  1
    [29] .comment          PROGBITS        0000000000000000 400404 0000a2 01  MS  0   0  1
    [30] .symtab           SYMTAB          0000000000000000 4004a8 000648 18     31  47  8
    [31] .strtab           STRTAB          0000000000000000 400af0 000220 00      0   0  1
    [32] .shstrtab         STRTAB          0000000000000000 400d10 00015d 00      0   0  1
    [33] .note.bolt_info   NOTE            0000000000000000 400e6d 0000a8 00      0   0  1
  Key to Flags:
    W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
    L (link order), O (extra OS processing required), G (group), T (TLS),
    C (compressed), x (unknown), o (OS specific), E (exclude),
    l (large), p (processor specific)
  
  Elf file type is DYN (Shared object file)
  Entry point 0x40001c
  There are 12 program headers, starting at offset 2097152
  
  Program Headers:
    Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
    PHDR           0x200000 0x0000000000200000 0x0000000000200000 0x0002a0 0x0002a0 R   0x8
    INTERP         0x0002a8 0x00000000000002a8 0x00000000000002a8 0x00001c 0x00001c R   0x1
        [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
    LOAD           0x000000 0x0000000000000000 0x0000000000000000 0x000548 0x000548 R   0x1000
    LOAD           0x001000 0x0000000000001000 0x0000000000001000 0x000205 0x000205 R E 0x1000
    LOAD           0x002000 0x0000000000002000 0x0000000000002000 0x000168 0x000168 R   0x1000
    LOAD           0x002de8 0x0000000000003de8 0x0000000000003de8 0x000248 0x000250 RW  0x1000
    LOAD           0x200000 0x0000000000200000 0x0000000000200000 0x200404 0x200404 R E 0x200000
    DYNAMIC        0x002df8 0x0000000000003df8 0x0000000000003df8 0x0001e0 0x0001e0 RW  0x8
    NOTE           0x0002c4 0x00000000000002c4 0x00000000000002c4 0x000020 0x000020 R   0x4
    GNU_EH_FRAME   0x400398 0x0000000000400398 0x0000000000400398 0x00006c 0x00006c R   0x4
    GNU_STACK      0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW  0x10
    GNU_RELRO      0x002de8 0x0000000000003de8 0x0000000000003de8 0x000218 0x000218 R   0x1
  
   Section to Segment mapping:
    Segment Sections...
     00     
     01     .interp 
     02     .interp .note.ABI-tag .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt 
     03     .init .plt .plt.got .bolt.org.text .fini 
     04     .rodata .bolt.org.eh_frame_hdr .bolt.org.eh_frame 
     05     .init_array .fini_array .dynamic .got .got.plt .data .bss 
     06     .text .eh_frame .eh_frame_hdr 
     07     .dynamic 
     08     .note.ABI-tag 
     09     .eh_frame_hdr 
     10     
     11     .init_array .fini_array .dynamic .got 

Full readelf after:

  There are 34 section headers, starting at offset 0x201280:
  
  Section Headers:
    [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
    [ 0]                   NULL            0000000000000000 000000 000000 00      0   0  0
    [ 1] .interp           PROGBITS        00000000000002a8 0002a8 00001c 00   A  0   0  1
    [ 2] .note.ABI-tag     NOTE            00000000000002c4 0002c4 000020 00   A  0   0  4
    [ 3] .gnu.hash         GNU_HASH        00000000000002e8 0002e8 000024 00   A  4   0  8
    [ 4] .dynsym           DYNSYM          0000000000000310 000310 0000a8 18   A  5   1  8
    [ 5] .dynstr           STRTAB          00000000000003b8 0003b8 000084 00   A  0   0  1
    [ 6] .gnu.version      VERSYM          000000000000043c 00043c 00000e 02   A  4   0  2
    [ 7] .gnu.version_r    VERNEED         0000000000000450 000450 000020 00   A  5   1  8
    [ 8] .rela.dyn         RELA            0000000000000470 000470 0000c0 18   A  4   0  8
    [ 9] .rela.plt         RELA            0000000000000530 000530 000018 18  AI  4  22  8
    [10] .init             PROGBITS        0000000000001000 001000 00001b 00  AX  0   0  4
    [11] .plt              PROGBITS        0000000000001020 001020 000020 10  AX  0   0 16
    [12] .plt.got          PROGBITS        0000000000001040 001040 000008 08  AX  0   0  8
    [13] .bolt.org.text    PROGBITS        0000000000001050 001050 0001a5 00  AX  0   0 16
    [14] .fini             PROGBITS        00000000000011f8 0011f8 00000d 00  AX  0   0  4
    [15] .rodata           PROGBITS        0000000000002000 002000 000012 00   A  0   0  4
    [16] .bolt.org.eh_frame_hdr PROGBITS        0000000000002014 002014 000044 00   A  0   0  4
    [17] .bolt.org.eh_frame PROGBITS        0000000000002058 002058 000110 00   A  0   0  8
    [18] .init_array       INIT_ARRAY      0000000000003de8 002de8 000008 08  WA  0   0  8
    [19] .fini_array       FINI_ARRAY      0000000000003df0 002df0 000008 08  WA  0   0  8
    [20] .dynamic          DYNAMIC         0000000000003df8 002df8 0001e0 10  WA  5   0  8
    [21] .got              PROGBITS        0000000000003fd8 002fd8 000028 08  WA  0   0  8
    [22] .got.plt          PROGBITS        0000000000004000 003000 000020 08  WA  0   0  8
    [23] .data             PROGBITS        0000000000004020 003020 000010 00  WA  0   0  8
    [24] .tm_clone_table   PROGBITS        0000000000004030 003030 000000 00  WA  0   0  8
    [25] .bss              NOBITS          0000000000004030 003030 000008 00  WA  0   0  1
    [26] .text             PROGBITS        0000000000200340 200340 0001b1 00  AX  0   0 64
    [27] .eh_frame         PROGBITS        00000000002004f8 2004f8 0001e0 00   A  0   0  8
    [28] .eh_frame_hdr     PROGBITS        00000000002006d8 2006d8 00006c 00   A  0   0  1
    [29] .comment          PROGBITS        0000000000000000 200744 0000a2 01  MS  0   0  1
    [30] .symtab           SYMTAB          0000000000000000 2007e8 000648 18     31  47  8
    [31] .strtab           STRTAB          0000000000000000 200e30 000220 00      0   0  1
    [32] .shstrtab         STRTAB          0000000000000000 201050 00015d 00      0   0  1
    [33] .note.bolt_info   NOTE            0000000000000000 2011ad 0000a8 00      0   0  1
  Key to Flags:
    W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
    L (link order), O (extra OS processing required), G (group), T (TLS),
    C (compressed), x (unknown), o (OS specific), E (exclude),
    l (large), p (processor specific)
  
  Elf file type is DYN (Shared object file)
  Entry point 0x20035c
  There are 12 program headers, starting at offset 2097152
  
  Program Headers:
    Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
    PHDR           0x200000 0x0000000000200000 0x0000000000200000 0x0002a0 0x0002a0 R   0x8
    INTERP         0x0002a8 0x00000000000002a8 0x00000000000002a8 0x00001c 0x00001c R   0x1
        [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
    LOAD           0x000000 0x0000000000000000 0x0000000000000000 0x000548 0x000548 R   0x1000
    LOAD           0x001000 0x0000000000001000 0x0000000000001000 0x000205 0x000205 R E 0x1000
    LOAD           0x002000 0x0000000000002000 0x0000000000002000 0x000168 0x000168 R   0x1000
    LOAD           0x002de8 0x0000000000003de8 0x0000000000003de8 0x000248 0x000250 RW  0x1000
    LOAD           0x200000 0x0000000000200000 0x0000000000200000 0x000744 0x000744 R E 0x200000
    DYNAMIC        0x002df8 0x0000000000003df8 0x0000000000003df8 0x0001e0 0x0001e0 RW  0x8
    NOTE           0x0002c4 0x00000000000002c4 0x00000000000002c4 0x000020 0x000020 R   0x4
    GNU_EH_FRAME   0x2006d8 0x00000000002006d8 0x00000000002006d8 0x00006c 0x00006c R   0x4
    GNU_STACK      0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW  0x10
    GNU_RELRO      0x002de8 0x0000000000003de8 0x0000000000003de8 0x000218 0x000218 R   0x1
  
   Section to Segment mapping:
    Segment Sections...
     00     
     01     .interp 
     02     .interp .note.ABI-tag .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt 
     03     .init .plt .plt.got .bolt.org.text .fini 
     04     .rodata .bolt.org.eh_frame_hdr .bolt.org.eh_frame 
     05     .init_array .fini_array .dynamic .got .got.plt .data .bss 
     06     .text .eh_frame .eh_frame_hdr 
     07     .dynamic 
     08     .note.ABI-tag 
     09     .eh_frame_hdr 
     10     
     11     .init_array .fini_array .dynamic .got 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137620



More information about the llvm-commits mailing list