This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Smpeg MMX asm compilation (problem)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]