This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Trouble with sections attributes for embedded target
- From: Xavier Ordoquy <xordoquy at meditrans dot fr>
- To: gcc at gcc dot gnu dot org
- Date: 28 Aug 2002 14:47:39 +0200
- Subject: Trouble with sections attributes for embedded target
Hi
I'm working on a cross compiler for embedded 68k target and I've tried
to use gcc instead of the commercial tool.
The cross compilation seems to work but I'm lacking something in the
last steps.
I'm linking some objects files that I've been given and some that I
compiled with gcc and here's the output of gcc:
app.ieee: file format ieee
Sections:
Idx Name Size VMA LMA File off Algn
0 CODE 00001ae4 00000000 00000000 00000000 2**2
CONTENTS, ALLOC, LOAD, DATA
1 zerovars 0000003c 00001ae4 00001ae4 00000000 2**2
CONTENTS, ALLOC, LOAD, DATA
2 .bss 00000214 00001b20 00001b20 00000000 2**2
ALLOC, DATA
3 .debug 00002498 00000000 00000000 00002e2a 2**0
CONTENTS, DEBUGGING
Now here's the output of the commercial compiler for the same sources:
../appli.x: file format ieee
Sections:
Idx Name Size VMA LMA File off Algn
0 CODE 0000182e 00000000 00000000 00000000 2**1
CONTENTS, ALLOC, LOAD, CODE
1 zerovars 0000020c 00000000 00000000 00000000 2**1
ALLOC, DATA
2 .debug 00006a64 00000000 00000000 00002e0c 2**0
CONTENTS, DEBUGGING
As you can see, alignement are differents, CODE section has a DATA flag
for gcc whereas it should be code and I can't get rid of the .bss
section.
I've tried to use attribute((section("CODE"))) but the compiler
complains m68k-aout doesn't support this.
Here's my link script:
OUTPUT_FORMAT("a.out-zero-big", "a.out-zero-big",
"a.out-zero-big")
OUTPUT_ARCH(m68k)
SECTIONS
{
. = 0x00;
CODE :
{
defentry.o
*("0")
*(.text)
*(code)
}
zerovars :
{
*(.dynamic)
*(.got)
*(.plt)
*(.data)
*(.linux-dynamic) /* For Linux dynamic linking. */
}
.bss :
{
*(.bss)
*(COMMON)
}
}
and the commands I use for gcc:
m68k-aout-gcc -mpcrel -mcpu32 -fPIC -c -ansi -pedantic -Iinc entry.c
m68k-aout-ld --verbose -T ld.conf --oformat=ieee -Map app.map -o
app.ieee entry.o defentry.o *.obj *.OBJ
I need to have similar outputs as the last generation step is an
application that changes things in order to meet the embedded OS design.
Has anyone any idea ?
--
Xavier Ordoquy
Chef de projet SESAM-Vitale
Meditrans