[LLVMdev] Fwd: [windows) how to use weak references with llvm 3.4 and windows?

Carl name.is.carl at gmail.com
Mon Feb 10 06:28:32 PST 2014


Hello,

I'm generating C code (and the resulting obj files) using llvm 3.4 for both
unix and windows.
And I use the dreaded weak references, that, for windows, are not too
widely supported.

When I link my application on linux, I have no issue.
But when I'm doing the same on windows using mingw I got a duplicate symbol
error :

..\robovm-0.0.8\lib\robovm-rt.jar\dalvik\system\BlockGuard$BlockGuardPolicyException.class.o:(.text$dalvik_system_BlockGuard$24BlockGuardPolicyException_getPolicy__I_lookup[_dalvik_system_BlockGuard$24BlockGuardPolicyException_getPolicy__I_lookup]+0x0):
multiple definition of
`dalvik_system_BlockGuard$24BlockGuardPolicyException_getPolicy__I_lookup'
..\Temp\robovm3774596063679264132.tmp\linker.o:(.text+0x340): first defined
here
..\robovm-0.0.8\lib\robovm-rt.jar\dalvik\system\BlockGuard$BlockGuardPolicyException.class.o:(.text$dalvik_system_BlockGuard$24BlockGuardPolicyException_getPolicyViolation__I_lookup[_dalvik_system_BlockGuard$24BlockGuardPolicyException_getPolicyViolation__I_lookup]+0x0):
multiple definition of
`dalvik_system_BlockGuard$24BlockGuardPolicyException_getPolicyViolation__I_lookup'
..\Temp\robovm3774596063679264132.tmp\linker.o:(.text+0x350): first defined
here
..\robovm-0.0.8\lib\robovm-rt.jar\dalvik\system\BlockGuard$BlockGuardPolicyException.class.o:(.text$dalvik_system_BlockGuard$24BlockGuardPolicyException_getMessage__Ljava_lang_String$3B_lookup[_dalvik_system_BlockGuard$24BlockGuardPolicyException_getMessage__Ljava_lang_String$3B_lookup]+0x0):
multiple definition of
`dalvik_system_BlockGuard$24BlockGuardPolicyException_getMessage__Ljava_lang_String$3B_lookup'

Because those symbols are declared as weak.

What is the status about the support of weak symbols on windows?
Are they supposed to work? Are they supposed to *never *work ?

Do you know any way to fix this (or work around it). I use weak symbols
everywhere in my code generation, so I would prefer a fix that doesn't
involve to rewrite my code.

I'm considering rewriting the obj files using objcopy.
Has this any chance to work ?
Here are the o.

Cheers,
Carl.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140210/ddacc877/attachment.html>


More information about the llvm-dev mailing list