This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Replace ROUND with ALIGN_UP by p_align [BZ #22370]
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Andreas Schwab <schwab at linux-m68k dot org>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Tue, 31 Oct 2017 06:57:28 -0700
- Subject: Re: [PATCH] Replace ROUND with ALIGN_UP by p_align [BZ #22370]
- Authentication-results: sourceware.org; auth=none
- References: <20171031125622.GA18905@gmail.com> <87shdzxw8z.fsf@linux-m68k.org>
On Tue, Oct 31, 2017 at 6:49 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> On Okt 31 2017, "H.J. Lu" <hjl.tools@gmail.com> wrote:
>
>> Alignment of notes in PT_NOTE segment is specified by the p_align field
>> in the PT_NOTE segment header.
>
> I don't think it makes sense to alter the note contents due to p_align,
> it should only control the padding between each note.
>
Isn't padding between each note determined by alignment of note?
Linker creates one PT_NOTE segment for notes with the same alignment:
There are 38 section headers, starting at offset 0x493f30:
Section Headers:
[Nr] Name Type Address Off Size
ES Flg Lk Inf Al
[ 0] NULL 0000000000000000 000000
000000 00 0 0 0
[ 1] .note.gnu.property NOTE 00000000004001c8 0001c8
000020 00 A 0 0 8
[ 2] .note.ABI-tag NOTE 00000000004001e8 0001e8
000020 00 A 0 0 4
[ 3] .note.gnu.build-id NOTE 0000000000400208 000208
000024 00 A 0 0 4
readelf: Warning: [ 4]: Link field (0) should index a symtab section.
[ 4] .rela.plt RELA 0000000000400230 000230
000210 18 AI 0 23 8
[ 5] .init PROGBITS 0000000000400440 000440
000017 00 AX 0 0 4
[ 6] .plt PROGBITS 0000000000400460 000460
000160 00 AX 0 0 16
[ 7] .text PROGBITS 00000000004005c0 0005c0
0730e0 00 AX 0 0 16
[ 8] __libc_freeres_fn PROGBITS 00000000004736a0 0736a0
000aa7 00 AX 0 0 16
[ 9] __libc_thread_freeres_fn PROGBITS 0000000000474150
074150 00015d 00 AX 0 0 16
[10] .fini PROGBITS 00000000004742b0 0742b0
000009 00 AX 0 0 4
[11] .rodata PROGBITS 00000000004742c0 0742c0
01c138 00 A 0 0 32
[12] __libc_subfreeres PROGBITS 00000000004903f8 0903f8
000048 00 A 0 0 8
[13] __libc_IO_vtables PROGBITS 0000000000490440 090440
0006a8 00 A 0 0 32
[14] __libc_atexit PROGBITS 0000000000490ae8 090ae8
000008 00 A 0 0 8
[15] __libc_thread_subfreeres PROGBITS 0000000000490af0
090af0 000010 00 A 0 0 8
[16] .eh_frame PROGBITS 0000000000490b00 090b00
009cd0 00 A 0 0 8
[17] .gcc_except_table PROGBITS 000000000049a7d0 09a7d0
0000a1 00 A 0 0 1
[18] .tdata PROGBITS 000000000069ab40 09ab40
000020 00 WAT 0 0 8
[19] .tbss NOBITS 000000000069ab60 09ab60
000040 00 WAT 0 0 8
[20] .init_array INIT_ARRAY 000000000069ab60 09ab60
000010 08 WA 0 0 8
[21] .fini_array FINI_ARRAY 000000000069ab70 09ab70
000010 08 WA 0 0 8
[22] .data.rel.ro PROGBITS 000000000069ab80 09ab80
000464 00 WA 0 0 32
[23] .got.plt PROGBITS 000000000069b000 09b000
0000c8 08 WA 0 0 8
[24] .data PROGBITS 000000000069b0e0 09b0e0
001ae8 00 WA 0 0 32
[25] .bss NOBITS 000000000069cbe0 09cbc8
0014e8 00 WA 0 0 32
[26] __libc_freeres_ptrs NOBITS 000000000069e0c8 09cbc8
000028 00 WA 0 0 8
[27] .comment PROGBITS 0000000000000000 09cbc8
000029 01 MS 0 0 1
[28] .debug_aranges PROGBITS 0000000000000000 09cc00
004450 00 0 0 16
[29] .debug_info PROGBITS 0000000000000000 0a1050
261a05 00 0 0 1
[30] .debug_abbrev PROGBITS 0000000000000000 302a55
039aa2 00 0 0 1
[31] .debug_line PROGBITS 0000000000000000 33c4f7
0680f6 00 0 0 1
[32] .debug_str PROGBITS 0000000000000000 3a45ed
011e67 01 MS 0 0 1
[33] .debug_loc PROGBITS 0000000000000000 3b6454
0b41e9 00 0 0 1
[34] .debug_ranges PROGBITS 0000000000000000 46a640
016d00 00 0 0 16
[35] .symtab SYMTAB 0000000000000000 481340
00ba30 18 36 880 8
[36] .strtab STRTAB 0000000000000000 48cd70
006ffc 00 0 0 1
[37] .shstrtab STRTAB 0000000000000000 493d6c
0001c1 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 EXEC (Executable file)
Entry point 0x4015a0
There are 7 program headers, starting at offset 64
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flg Align
LOAD 0x000000 0x0000000000400000 0x0000000000400000
0x09a871 0x09a871 R E 0x200000
LOAD 0x09ab40 0x000000000069ab40 0x000000000069ab40
0x002088 0x0035b0 RW 0x200000
NOTE 0x0001c8 0x00000000004001c8 0x00000000004001c8
0x000020 0x000020 R 0x8
NOTE 0x0001e8 0x00000000004001e8 0x00000000004001e8
0x000044 0x000044 R 0x4
TLS 0x09ab40 0x000000000069ab40 0x000000000069ab40
0x000020 0x000060 R 0x8
GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000
0x000000 0x000000 RW 0x10
GNU_RELRO 0x09ab40 0x000000000069ab40 0x000000000069ab40
0x0004c0 0x0004c0 R 0x1
Section to Segment mapping:
Segment Sections...
00 .note.gnu.property .note.ABI-tag .note.gnu.build-id
.rela.plt .init .plt .text __libc_freeres_fn __libc_thread_freeres_fn
.fini .rodata __libc_subfreeres __libc_IO_vtables __libc_atexit
__libc_thread_subfreeres .eh_frame .gcc_except_table
01 .tdata .init_array .fini_array .data.rel.ro .got.plt .data
.bss __libc_freeres_ptrs
02 .note.gnu.property
03 .note.ABI-tag .note.gnu.build-id
04 .tdata .tbss
05
06 .tdata .init_array .fini_array .data.rel.ro
--
H.J.