This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
New @ linker scripts
- From: Reinhard Kager <reinhard dot kager at wtw-electronic dot at>
- To: binutils at sourceware dot org
- Date: Thu, 12 Jun 2014 12:08:28 +0200
- Subject: New @ linker scripts
- Authentication-results: sourceware.org; auth=none
- References: <53997BB8 dot 2030304 at wtw-electronic dot at>
Hello mailing list,
i am pretty new in linker scripts so i went through the documentation.
Til now my IDE (HEW for Renesas Micros) was handling this but for a new
project I might need a linker script, but unfortunately it seems not
that easy at it looks like in the doc:
SECTIONS {
outputa 0x10000 :
{
all.o
foo.o (.input1)
}
outputb :
{
foo.o (.input2)
foo1.o (.input1)
}
outputc :
{
*(.input1)
*(.input2)
}
}
This is the description of putting files and parts of files into a
specific section. If I do so, i get a "multiple
definition of" error from the linker for my function which is in the uart.o
mySection 0x07800000 : AT (0x07800000)
{
uart.o
*(mySectionFunctions)
}
.text 0xFFFF0100 : AT (0xFFFF0100)
{
*(.text)
*(.text.*)
*(P)
etext = .;
}
Another question is about archive files. Can i map this at once in a
section or do I have to get the .o files and map all of them?
I thought gcc is using .text for function code and .rodata for read only
const data. But there is also data which is marked as C in the map file.
Bizarrely if i map a function via an attribute into a section, the C
data for this function (I guess this are jumpTables for example of
switch statements) stay in the C section. So I have to map this again
manually, like this?
mySection 0x07800000 : AT (0x07800000)
{
uart.o
uart.o (C)
*(mySectionFunctions)
}
.rodata :
{
*(.rodata)
*(.rodata.*)
*(C_1)
*(C_2)
*(C)
_erodata = .;
}
Thanks a lot for your help, as I cannot find a solutions in the internet
for this.
Reinhard