On Saturday 27 April 2024 22:47:33 LIU Hao wrote:
> 在 2024-04-27 19:46, Pali Rohár 写道:
> > Symbol alias is defined by "==".
> 
> This message is incorrect. `=` really defines an alias [1]. `==` specifies
> the export name (the name before `==` is used by the linker).

Ok, I see. Alias is somehow overloaded word and lot of times I just
use alias for both cases. I will try to avoid making confusion here.

> For an import library, there is likely no difference.

I did some experiments and results are that for an import library, right
part of the "=" is completely ignored. So there is a big difference.

Simple test case:

$ cat lib.def
LIBRARY "lib.dll"
EXPORTS
func1 = func2
func3 == func4

$ cat test.c
void func1(void);
void func3(void);
void test(void) {
        func1();
        func3();
}
int main() { test(); }

Compile with:

$ i686-w64-mingw32-dlltool -d lib.def -l lib.a
$ i686-w64-mingw32-gcc test.c lib.a -o test.exe

And then inspect import table of the test.exe.

$ readpe -i test.exe | tail -20
    Library
        Name:                            lib.dll
        Functions
            Function
                Hint:                            2
                Name:                            func4
            Function
                Hint:                            1
                Name:                            func1

As can be seen, the func1 symbol is being used, even the fact that in
lib.def was line "func1 = func2". So it is same as if lib.def contained
only line "func1".

On the other hand, no "func3" is in import table. And this was due to
usage of "func3 == func4" with double "==", which renamed the symbol.


_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to