[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GNU/Linker and Microsoft object code.
From: |
Nick Clifton |
Subject: |
Re: GNU/Linker and Microsoft object code. |
Date: |
28 Jun 2001 17:33:40 +0100 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 |
Hi Pascal,
> It seems that when .o (GNU object code) and .obj (Microsoft object
> code) are mixed together some sections are overlapping
> Something else I have experienced, if the value of variable c (in
> the C code) is set to something else than 0 then the right value is
> displayed.
Hmm, OK this would imply that the linker is placing the initialised
data section (.bss) in the same area as the initialised data section
(.data).
There are a couple of simple checks that you do:
1. Add the --print-map option to the linker and examine the
resulting map. Do you see an overlapping .data and .bss section
? Where is the 'C' symbol located ?
2. Add the --check-sections switch to the linker command line. This
is supposed to check for and warn about overlapping sections.
3. Print out the linker script and check to see what is happening to
the .data and .bss sections. (You can use 'ld --verbose' to see
the default linker script, but it is possible that gcc is using a
custom linker script so add '-v' to gcc's command line and check
to see if -T is being passed to the linker).
4. Another possibility is that the linker is confused about common
symbols. Does the problem go away of you compile with
-fno-common ?
Cheers
Nick