Skip to content

Wrong symbol names with cross compiling #10547

@llvmbot

Description

@llvmbot
Bugzilla Link 10175
Resolution DUPLICATE
Resolved on Jun 23, 2011 05:51
Version trunk
OS MacOS X
Reporter LLVM Bugzilla Contributor
CC @asl

Extended Description

The cross compiler produces wrong export symbols if you cross compile a windows target.

/Developer/usr/bin/clang -shared -ccc-host-triple i386-pc-mingw32 -ccc-gcc-name /Developer/Cocotron/1.0/Windows/i386/gcc-4.3.1/bin/i386-pc-mingw32msvc-gcc -I/Developer/Cocotron/1.0/Windows/i386/llvm-clang-trunk/i386-pc-mingw32msvc/include exportTest.c

produces
Cannot export _Function1: symbol not found
collect2: ld returned 1 exit status
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Cotent of exportTest.c:

__declspec(dllexport) void __cdecl Function1(void)
{

}

see mailing list : http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-June/015757.html

I have a workaround for this in lib/Target/X86/X86AsmPrinter.cpp to delete the first character of the symbol wiht .substr(1) at line 624 and 637.

Line 624:
name += DLLExportedGlobals[i]->getName()
To
name += DLLExportedGlobals[i]->getName().substr(1);

AND

Line 637:
name += DLLExportedFns[i]->getName();
To
name += DLLExportedFns[i]->getName().substr(1);

This is for sure the wrong place and this is only a hack.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions