Aligning .text segments
K Jski
bielsk1@vt.edu
Wed Dec 10 00:12:00 GMT 2014
this is like a stack overflow question but I need help:
I am trying to align functions for multiple binary files on different
ISAs configuring GOLD with a linker script
(i.e. I have a program with functions foo with size= 0xc9,bar
size=0x18, and a main. Assume .text addr starts at 0x400000000
suppose the original layout of the file is
foo at 0x40000010
bar at 0x400000c9
main in at 0x40000400
so I just would want the following to happen
foo to be aligned at 0x40000050
bar to be aligned at 0x40000100
main stays at 0x40000400
I have an attempt at a linker script (I never worked on linkers in my
life) that I feed gold as an arg "myscript.x". (source below) what
happens when gold produces a binary is that it creates another .text
section and inserts them at the designated addresses. running the
program results in "Killed"
myscript.x
SECTIONS{
.text:
{
. = ALIGN(0x50);
*(.text.foo)
. = ALIGN(0x50);
*(.text.bar)
}
}
(I have tried to use INSERT AFTER .text after the sections declaration
but then it gives a unexpected STRING fatal error)
Sincerely,
C Jelesnianski
More information about the Binutils
mailing list