I am attempting to compile an elf file using a linker script at an address other than zero.
I understand the normal SECTION method .text ADDRESS : AT (ADDRESS), however, this has been padding my file by the amount I ask as a logical address. Without virtual addresses, my file size is about 3.3K. Adding them swells it to barely over 1Meg.
Please note this is elf64-x86-64, if that should change anything.
An example of the one I am using right now is as follows:
/* console.ld */
ENTRY (main)
PHDRS
{
headers PT_PHDR PHDRS;
text PT_LOAD FILEHDR PHDRS;
data PT_LOAD;
}
SECTIONS
{
. = SIZEOF_HEADERS;
.text 0x1000 : { *(.text) *(.rodata) PROVIDE(_etext = .); } :text
.data : { *(.data) PROVIDE(_edata = .); } :data
.bss : { PROVIDE(_sbss = .); *(.bss COMMON) PROVIDE(_ebss = .); } :bss
}
Doing this automatically gives a virtual address of 0x1000, but automatically pads the file to 0x1000 before starting the text section. Adding an AT (...) after it doesn't affect it...
Any ideas?