[prev in list] [next in list] [prev in thread] [next in thread]
List: binutils
Subject: Gold linker: specify alignment of sections
From: Martin Richtarsky <ml () martinien ! de>
Date: 2013-07-31 17:30:53
Message-ID: 87db65a7811b691ba6a24ff862fb1efe-EhVcX1dJRwNeRwQRAQsKVxcwfgFLV15YQUBGAEFbWkA3VFEKQV51CUtUWF9BSCoDXF1cQlFUUA1c-webmailer2 () server05 ! webmailer ! hosteurope ! de
[Download RAW message or body]
Hi,
I want to specify alignment for some sections. For ld 2.20.0
the following approach works:
- create a linker script containing only the sections that
should be aligned, e.g.:
SECTIONS
{
.data ALIGN(0x40): { *(.data) }
.text ALIGN(0x40): { *(.text) }
.plt ALIGN(0x10): { *(.plt) }
}
then link with:
-rpath-link=/path/to/LinkerScript.ld /path/to/LinkerScript.ld
E.g. include the script in rpath-link and also pass it as one of
the object files. This is an implicit linker script as described here:
http://sourceware.org/binutils/docs-2.23.1/ld/Implicit-Linker-Scripts.html#Implicit-Linker-Scripts
Now, when linking in the same way using gold 2.23.1, the
script is rejected with this error:
" LinkerScript.ld: SECTIONS seen after other input files;
try -T/--script"
So gold wants me to specify a complete linker script, however I
only want to change a couple attributes. Is this possible?
I have already tried:
- Passing the script with the -T option. This produces a broken
executable that fails to start. As I understand this is because
-T only accepts complete linker scripts, while the above is
just an implicit linker script.
- In the same vein, when passing the script with the -T option to
ld 2.20.0 it fails to link since some sections are unspecified.
It is not a "complete" linker script for my use case.
- So I have tried obtaining a complete linker script. "ld --verbose"
will print the default linker script. I had to remove a couple
of symbols that were not understood by gold, afterwards the
executable
produced with the "-T/path/to/LinkerScript.ld" option didn't work
anymore.
- Unfortunately gold has no option to show its default linker script
(it doesn't use any). The man pages do not specify how to change
alignment for the case above with a parameter.
Any help would be greatly appreciated!
Best regards,
Martin Richtarsky
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic