Smpeg MMX asm compilation (problem)
Nick Clifton
nickc@redhat.com
Wed Aug 23 17:33:00 GMT 2006
Hi Matt,
> Alright, I've managed to get both .S files to compile- however when I
> try to link them with a program using:
> extern "C" {
> extern unsigned int cpu_flags(void);
> extern void IDCT_mmx(DCTBLOCK data);
> }
>
> The linker tool comes up with
> ./.libs/libsmpeg.a(parseblock.o): In function `Z8InitIDCTv':
> e:/programming/smpeg/video/parseblock.cpp:117: undefined reference to
> `cpu_flags()'
Probably because the compiler is adding a prefix of "_" to the
"cpu_flags" and "IDCT_mmx" symbols. Check the assembler output of the
compiler to be sure.
If this is the problem then there are two ways around it:
1. Add the "_" prefix to the symbols in the assembler source. eg:
.globl _cpu_flags
.def _cpu_flags; .scl 2; .type 32; .endef
_cpu_flags:
2. Use the "Asm Labels" feature of gcc to force the correct name to
be used. (See the gcc documentation for more details). eg:
extern unsigned int cpu_flags (void) asm ("cpu_flags");
Cheers
Nick
More information about the Binutils
mailing list