[Mplayer-dev-eng] Porting Question

Felix Buenemann atmosfear at users.sourceforge.net
Tue Aug 7 22:41:49 CEST 2001


On Friday,  3. August 2001 14:13, you wrote:
> Hi, Felix Buenemann!
>
> On 2001-08-03 09:04:53 you wrote:
> >On Friday,  3. August 2001 12:35, you wrote:
> >> Hi, Felix Buenemann!
> >>
> >> On 2001-08-03 08:22:46 you wrote:
> >> >On Friday,  3. August 2001 11:33, you wrote:
> >> >> Hi, Arpi!
> >> >>
> >> >> On 2001-08-02 21:42:34 you wrote:
> >> >> >Hi,
> >> >> >
> >> >> >>   while cygwin patched sources (not in cvs yet), compile fine now,
> >> >> >> I have a problem in the linking stage, all external assembler
> >> >> >> functions are reported as undefined references. Does anyone have a
> >> >> >> clue how to fix it?
> >> >> >
> >> >> >they are not 'all', and not assembler.
> >> >> >3 problems are:
> >> >> >
> >> >> >- missing DLL loader stuff ( you don't link loader/libloader.a)
> >> >> >- missing shared memory functions (maybe -mno-cygwin kill these
> >> >> >compatibility functions)
> >> >> >- i don't know what's teh prob with libMP3, maybe soem files aren't
> >> >> > well compiled or some broken #ifdefs
> >> >>
> >> >> It is because cygwin (as any other DOS-Win32 compiler) generates
> >> >> assembler function with underscore, but our assembler doesn't contain
> >> >> leading underscore before function names. (It still one reason - why
> >> >> I choose inline assembler against external).
> >> >
> >> >Thanks, so I understood right that changing functionname to
> >> > _functionname solves the prob? (and do this both in C and asm file or
> >> > only in C?)
> >>
> >> Only in ASM, but it will make assembler stuff incompatible with
> >> Linux-Unix
> >>
> >> :( Only solution in this case is rewrite all .S files through inline
> >>
> >> assembler of "C". In this case compiler will generate correct function
> >> name automatically.
> >
> >hmm, I can simply change function names in asm sources and do some #ifdef
> >__CYGWIN__ #else stuff in C sources.
> >Or I write some little sed script that does the dirty work only on win32
> >systems.
>
> Yes! But it's requires to rewrite a lot of sourcelines.
> I could get only such workable stuff:
>
> #ifdef LINUX
> #define ASMLINKAGE(x) _##x
> #else
> #define ASMLINKAGE(x) x
> #endif
>
> extern void ASMLINKAGE(func)( void );
> #define FUNC ASMLINKAGE(func)
>
> void my_func( void ) { FUNC(); }
>
> As you see - function call should be rewritten too!
> Or you have better solution?
>
yes, a little late but just found this (in the linux assembly howto):
----
5.1.2. ELF vs a.out problems

Some C compilers prepend an underscore before every symbol, while others do 
not.

Particularly, Linux a.out GCC does such prepending, while Linux ELF GCC does 
not.

If you need to cope with both behaviors at once, see how existing packages 
do. For instance, get an old Linux source tree, the Elk, qthreads, or OCaml...

You can also override the implicit C->asm renaming by inserting statements 
like 

        void foo asm("bar") (void); to be sure that the C function foo() will 
be called really bar in assembly.

Note that the objcopy utility from the binutils package should allow you to 
transform your a.out objects into ELF objects, and perhaps the contrary too, 
in some cases. More generally, it will do lots of file format conversions.
----

thid means I just need one change per funtion definition, will test it asap.

> But idea with rewritting of assembler stuff with using inline assembler
> is much better since allows to optimize function prologue and epilogue
> and probably some other stuff
>
> Best regards! Nick (2001-08-03 12:03:05)
>

-- 
Best Regards,
   Felix

____
Ever tried? Ever failed? - Try again! Fail better!

_______________________________________________
Mplayer-dev-eng mailing list
Mplayer-dev-eng at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-dev-eng



More information about the MPlayer-dev-eng mailing list