GCC Linker - Alignment
Posted: Mon Dec 28, 2015 3:23 pm
EDIT: SOLVED!!
Hi, checking the output file I have noticed nop's inserted.
I have tried to change the linker.ld file but I am having trouble with alignment.
I would like .text to start after .StartKernel aligned to 0x10., but here is the output, with nop's inserted: , these nops continue to here: , here are the sections: .
What I would like is <_ZN6Kernel23tEthernetCardStatistics5Intel6I8259921GetMissedPacketsCountERNS_20tEthernetCardDetailsE>: to start at 0000000000302020, where it is currently 0000000000302400
Any ideas greatly appreciated.
Thanks, Ali
Hi, checking the output file I have noticed nop's inserted.
I have tried to change the linker.ld file but I am having trouble with alignment.
I would like .text to start after .StartKernel aligned to 0x10.
Code: Select all
.StartKernel :
{
*(.StartKernel)
}
.text ALIGN(0x10) :
{
*(.text)
}
Code: Select all
My starting code......
30201d: ff e0 jmp rax
Disassembly of section .text:
0000000000302020 <_ZN6Kernel23tEthernetCardStatistics5Intel6I8259921GetMissedPacketsCountERNS_20tEthernetCardDetailsE-0x3e0>:
302020: 66 2e 0f 1f 84 00 00 nop WORD PTR cs:[rax+rax*1+0x0]
302027: 00 00 00
30202a: 66 2e 0f 1f 84 00 00 nop WORD PTR cs:[rax+rax*1+0x0]
302031: 00 00 00
302034: 66 2e 0f 1f 84 00 00 nop WORD PTR cs:[rax+rax*1+0x0]
30203b: 00 00 00
30203e: 66 2e 0f 1f 84 00 00 nop WORD PTR cs:[rax+rax*1+0x0]
302045: 00 00 00
302048: 66 2e 0f 1f 84 00 00 nop WORD PTR cs:[rax+rax*1+0x0]
30204f: 00 00 00
302052: 66 2e 0f 1f 84 00 00 nop WORD PTR cs:[rax+rax*1+0x0]
Code: Select all
3023fe: 66 90 xchg ax,ax
0000000000302400 <_ZN6Kernel23tEthernetCardStatistics5Intel6I8259921GetMissedPacketsCountERNS_20tEthernetCardDetailsE>:
302400: 8b b7 d8 10 00 00 mov esi,DWORD PTR [rdi+0x10d8]
Code: Select all
6 .StartKernel 0000001f 0000000000302000 0000000000302000 00102000 2**4
CONTENTS, ALLOC, LOAD, READONLY, CODE
7 .text 0000cec6 0000000000302020 0000000000302020 00102020 2**10
CONTENTS, ALLOC, LOAD, READONLY, CODE
What I would like is <_ZN6Kernel23tEthernetCardStatistics5Intel6I8259921GetMissedPacketsCountERNS_20tEthernetCardDetailsE>: to start at 0000000000302020, where it is currently 0000000000302400
Any ideas greatly appreciated.
Thanks, Ali