[MPlayer-dev-eng] symbol mangling prob on win32

Michael Niedermayer michaelni at gmx.at
Thu Jan 17 01:39:43 CET 2002


Hi

On Thursday 17 January 2002 00:40, Felix Buenemann wrote:
> Hi,
>
> I just found out, that on win32 there's a prob with the symbol mangling of
> variables used inside inline asm, here's an example with (one way) to fix:
>
> #include <stdio.h>
> #include <inttypes.h>
> static const uint64_t bFF  __attribute__((aligned(8))) =
> 0xFFFFFFFFFFFFFFFFULL;
> #ifndef __CYGWIN__
> #define _bFF "bFF"
> #else
> #define _bFF "_bFF"
> #endif
>
> int main(void) {
>   asm volatile("movq "_bFF", %%mm0;":::"memory");
>   printf("bFF: %lld\n", bFF);
>   return 0;
> }
>
> What do you think, is the best way to handle the problem (var in inline asm
best way? ... destroy M$ & win32 :))))
alternative way:
#ifndef __CYGWIN__
#define MANGLE(a) #a
#else
#define MANGLE(a) "_" #a
#endif
asm volatile("movq "MANGLE(bFF)", %%mm0;":::"memory");

its still ugly but less so imho

> on win32 must be _var, but outside inline asm stays var)?
[...]
> Maybe we could directly insert varvalues into code, I think it's all const
no, not all, some are not const (pQPb in postprocess, ...)

> values, but I'm not sure alignment is correct then.
imho it should be ok 

Michael



More information about the MPlayer-dev-eng mailing list