This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Hi all,
What I'm looking for is a way to create a PHDR whose memsz is larger than
filesz such that the bytes beyond filesz are 0-padded (similar to how .bss
is handled). However, I do not have a .bss section and creating one just
for the purpose of padding seems weird. The linker script is as follows:
OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
OUTPUT_ARCH(i386)
ENTRY(__start)
PHDRS
{
image PT_LOAD;
}
SECTIONS
{
. = 0x1000;
.text :
{
*(.text .text.* .gnu.linkonce.t.*)
} : image
.rodata :
{
*(.rodata .rodata.* .gnu.linkonce.r.*)
} : image
}
This results in the following ELF headers:
Program Header:
LOAD off 0x00000058 vaddr 0x00001000 paddr 0x00001000 align 2**3
filesz 0x000000b6 memsz 0x000000b6 flags r-x
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00000080 00001000 00001000 00000058 2**3
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .rodata 00000036 00001080 00001080 000000d8 2**0
CONTENTS, ALLOC, LOAD, READONLY, DATA
I would like filesz to remain at 0xb6 and memsz to be page-aligned (0x1000).
Is there an easy way to do this?
Cheers,
- Udo
Attachment:
signature.asc
Description: PGP signature
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |