[cfe-dev] export symbol names with leading underscore

Eli Friedman eli.friedman at gmail.com
Wed Jun 22 16:18:24 PDT 2011


On Wed, Jun 22, 2011 at 1:23 PM, Glenn Ganz <gganz at egastones.ch> wrote:
> Hi
>
> I'm working on the cocotron project. i try to make cocotron "clang"-ready.
>
> I use clang as cross compiler (On OS X for Windows) and  bintuils as linker (via gcc).
>
> i got some linking erros like "Cannot export _strnstr: symbol not found"
>
> i analyzed the problem. When you take a look into the object files you see the problem.
>
>
> Glenn-Ganzs-iMac:bin glenn$ strings  "/Users/glenn/Projects/glennganz-cocotron1-
> clang/Foundation/build/Windows/i386/Foundation.build/Debug/Foundation-Windows-i386
> (clang).build/Objects-normal/i386/CFBase.o" | grep strnstr
> strnstr
> strnstr
>  -export:_kCFAllocatorDefault,data -export:_kCFAllocatorSystemDefault,data -
> export:_kCFAllocatorMalloc,data -export:_kCFAllocatorMallocZone,data -
> export:_kCFAllocatorNull,data -export:_kCFAllocatorUseContext,data -export:_CFAllocatorGetDefault
> -export:_CFAllocatorSetDefault -export:_CFAllocatorGetTypeID -export:_CFAllocatorCreate -
> export:_CFAllocatorGetContext -export:_CFAllocatorGetPreferredSizeForSize -
> export:_CFAllocatorAllocate -export:_CFAllocatorDeallocate -export:_CFAllocatorReallocate -
> export:_CFGetTypeID -export:_CFRetain -export:_CFRelease -export:_CFGetRetainCount -
> export:_CFGetAllocator -export:_CFHash -export:_CFEqual -export:_CFCopyTypeIDDescription -
> export:_CFCopyDescription -export:_CFMakeCollectable -export:_sleep -export:_strlcpy -
> export:_strnstr -export:_bzero -export:_bcopy -export:_bcmp -export:_mkstemps -export:_random
> _strnstr
> Glenn-Ganzs-iMac:bin glenn$ strings  "/Users/glenn/Projects/glennganz-cocotron1-
> clang/Foundation/build/Windows/i386/Foundation.build/Debug/Foundation-Windows-
> i386.build/Objects-normal/i386/CFBase.o" | grep strnstr
> strnstr:F(0,77)
>  -export:kCFAllocatorUseContext,data -export:kCFAllocatorNull,data -
> export:kCFAllocatorMallocZone,data -export:kCFAllocatorMalloc,data -
> export:kCFAllocatorSystemDefault,data -export:kCFAllocatorDefault,data -export:random -
> export:mkstemps -export:bcmp -export:bcopy -export:bzero -export:strnstr -export:strlcpy -
> export:sleep -export:CFMakeCollectable -export:CFCopyDescription -
> export:CFCopyTypeIDDescription -export:CFEqual -export:CFHash -export:CFGetAllocator -
> export:CFGetRetainCount -export:CFRelease -export:CFRetain -export:CFGetTypeID -
> export:CFAllocatorReallocate -export:CFAllocatorDeallocate -export:CFAllocatorAllocate -
> export:CFAllocatorGetPreferredSizeForSize -export:CFAllocatorGetContext -export:CFAllocatorCreate
> -export:CFAllocatorGetTypeID -export:CFAllocatorSetDefault -export:CFAllocatorGetDefault
>
>
> the object file from gcc has no leading underscore in the export name.
>
> Is there an option for clang to produce the export names without leading underscores?

No, but there's clearly something going wrong... symbols on darwin are
always prefixed with an underscore, but symbols for Windows aren't.
How exactly are you cross-compiling?

-Eli




More information about the cfe-dev mailing list