public inbox for crossgcc@sourceware.org
 help / color / mirror / Atom feed
* HOWTO: Add underscores to symbols with ELF
@ 2000-10-19 18:19 Christopher Bahns
  0 siblings, 0 replies; only message in thread
From: Christopher Bahns @ 2000-10-19 18:19 UTC (permalink / raw)
  To: crossgcc

Hello,
I am having trouble making a cross-compiler that generates ELF object
files with an underscore ("_") added to the beginning of the symbol
names.

Here is my setup:
Windows NT 4.0 Server
Cygwin 1.1.2
binutils-2.10
gcc-2.95.2
newlib-1.8.2
target=m68k-elf
prefix=/gcc-m68k

Edited /source/gcc-2.95.2/gcc/config/m68k/m68kelf.h: changed
  USER_LABEL_PREFIX from "" to "_"
prior to running "configure" and "make"

The compiler build goes ok and everything seems to work until it tries
to link, when I get undefined symbols. When I use objdump on my object
files, global symbols do not have underscores as I would expect (e.g. my
main.o contains the symbol "main" instead of "_main"). However, the file
"crt0.o" generated while building the compiler contains the symbol
"_start", not "start", which it should. It seems that the use of the
SYM() macro in an assembly-language file does appropriately prepend the
underscore to symbol names. For some reason the C compiler does not seem
to be doing this however.

Should I do something else? I need to add the underscores in order to
make the compiled code compatible with stuff built by another compiler.
Using COFF works just fine, changing "USER_LABEL_PREFIX" in "coff.h" as
opposed to "m68kelf.h" allows me to build an m68k-coff compiler that
properly adds the underscores and I get no linker errors. However, for
other reasons I would rather use ELF.

Anyone know if there is a bug in the way USER_LABEL_PREFIX is used in
the ELF source code?

Thanks a lot for any help you can offer
Chris


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-10-19 18:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-10-19 18:19 HOWTO: Add underscores to symbols with ELF Christopher Bahns

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).