New @ linker scripts

Reinhard Kager reinhard.kager@wtw-electronic.at
Thu Jun 12 10:08:00 GMT 2014


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



More information about the Binutils mailing list