* Strange additional data in text section of arm-coff object files
@ 2001-05-28 18:37 David Lin
2001-05-29 0:49 ` Anders Norlander
2001-05-29 1:16 ` Nick Clifton
0 siblings, 2 replies; 3+ messages in thread
From: David Lin @ 2001-05-28 18:37 UTC (permalink / raw)
To: binutils
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1490 bytes --]
Hi, everybody
Â
There is something strange about the COFF file
generated by arm-coff tools
I built an environment for building COFF files on
target machine with ARM processor
As the manual of ld descriped, executable object
codes could be generated
and relocatable object files could also be created
with additional flag '-r'
Â
for example:
Â
arm-coff-gcc -c init.c
arm-coff-gcc -c hello.c
arm-coff-ld -e _hello -o hello_cof.o hello.o
init.o
arm-coff-ld -r -e _hello -o hello_rel.o hello.o
init.o
Â
Â
By observing the executable COFF file
hello_cof.o and relocatable file hello_rel.o,
there is surely something different
Â
Concerning the text section only,
I found size of text in hello_cof.o is
16-byte more than size in hello_rel.o
content of these 16 bytes of data is "FFFFFFFF
00000000 FFFFFFFF 00000000"
Â
On the experience of prevous work, it is similiar to
the m68k case, the cross-platform tools for Motorola 68k processors
size of text section in executable object files is
also 16 byte more than in relocatable ones
content of these 16 bytes of data, however, is
"00000000 00000000 00000000 00000000"
Â
does this circumstance imply something?
I am interested in it :)
Â
Here is my experimental environment
Â
CPU: Intel Pentium 755
OS: MS Windows 98
Environment: cygwin 1.3.3-1
version of binutils: 2.11.90 (with BFD
2.11.90)
version of gcc: 2.95.3-4 (cygwin
special)
version of newlib: 1.9.0
target: arm-coff
Â
Â
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Strange additional data in text section of arm-coff object files
2001-05-28 18:37 Strange additional data in text section of arm-coff object files David Lin
@ 2001-05-29 0:49 ` Anders Norlander
2001-05-29 1:16 ` Nick Clifton
1 sibling, 0 replies; 3+ messages in thread
From: Anders Norlander @ 2001-05-29 0:49 UTC (permalink / raw)
To: David Lin; +Cc: binutils
David Lin wrote:
> Hi, everybody
>
> There is something strange about the COFF file generated by arm-coff tools
>
> I built an environment for building COFF files on target machine with
> ARM processor
>
> As the manual of ld descriped, executable object codes could be generated
>
> and relocatable object files could also be created with additional
> flag '-r'
>
> for example:
>
> arm-coff-gcc -c init.c
>
> arm-coff-gcc -c hello.c
>
> arm-coff-ld -e _hello -o hello_cof.o hello.o init.o
>
> arm-coff-ld -r -e _hello -o hello_rel.o hello.o init.o
>
> By observing the executable COFF file hello_cof.o and relocatable file
> hello_rel.o,
>
> there is surely something different
>
> Concerning the text section only,
>
> I found size of text in hello_cof.o is 16-byte more than size in
> hello_rel.o
>
> content of these 16 bytes of data is "FFFFFFFF 00000000 FFFFFFFF 00000000"
>
> On the experience of prevous work, it is similiar to the m68k case,
> the cross-platform tools for Motorola 68k processors
>
> size of text section in executable object files is also 16 byte more
> than in relocatable ones
>
> content of these 16 bytes of data, however, is "00000000 00000000
> 00000000 00000000"
>
> does this circumstance imply something?
>
> I am interested in it :)
>
It's the constructor/destructor lists. For arm-coff they start
with -1 and end with 0, so both lists are empty. For the m68k the
tables start with the number of entries and are terminated by 0.
Relocateable links do not generate constructor tables, but you
can force it with the -Ur linker option.
Regards,
Anders
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Strange additional data in text section of arm-coff object files
2001-05-28 18:37 Strange additional data in text section of arm-coff object files David Lin
2001-05-29 0:49 ` Anders Norlander
@ 2001-05-29 1:16 ` Nick Clifton
1 sibling, 0 replies; 3+ messages in thread
From: Nick Clifton @ 2001-05-29 1:16 UTC (permalink / raw)
To: David Lin; +Cc: binutils
Hi David,
> Concerning the text section only,
> I found size of text in hello_cof.o is 16-byte more than size in
> hello_rel.o content of these 16 bytes of data is "FFFFFFFF 00000000
> FFFFFFFF 00000000"
The answer becomes obvious once you use disassemble the two text
sections. In the fully linked executable you will find this at the
end of the .text section:
00008028 <__CTOR_LIST__>:
8028: ffffffff swinv 0x00ffffff
802c: 00000000 andeq r0, r0, r0
00008030 <__DTOR_LIST__>:
8030: ffffffff swinv 0x00ffffff
8034: 00000000 andeq r0, r0, r0
These words are inserted by the linker script. (Run ld --verbose to
see the default script that the linker will use). If this is a
problem for you, you can create your own linker script that does not
add these words. (Always assuming that you Ir not using any C++ in
your program, since these words are used to build the static
constructor and destructor lists).
Cheers
Nick
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-05-29 1:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-28 18:37 Strange additional data in text section of arm-coff object files David Lin
2001-05-29 0:49 ` Anders Norlander
2001-05-29 1:16 ` Nick Clifton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).