cross-compiler and assembler linkage question

Robert P. J. Day rpjday@mindspring.com
Sun Dec 11 13:57:00 GMT 2005


  not strictly speaking a cross-compiler question but i'm hoping
someone here has a solution.

  with an SH3eb toolchain i created with crosstool, i wanted to
compile and link some source files i got from someone else -- some C
files and a couple assembler files.

  the source files will call routines in the .asm files as sub1(), and
the .asm files will define those global entry points with

  .global _sub1		(note the leading "_")
  ...
_sub1:
...

the compilation (and assembly) of the individual files works fine, but
the link step fails, claiming that the name "sub1" is an undefined
reference from the calling file.

  this just shows how long it's been since i've messed with this, but
what's the rule on C/asm linkage and that leading underscore?  didn't
it used to be necessary?  the symbol table of the assembler object
file shows:

... T _sub1

so that's the name in the object file's symbol table.  and the symbol
table in the calling object file contains:

... U sub1

so there's a clear mismatch based on that leading underscore.

  i've been assured this all compiled and linked under a commercial
vendor's toolchain for this architecture.  can anyone point me at a
page outlining the rules for linkage here?   thanks.

rday


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



More information about the crossgcc mailing list