[LLVMdev] Generate data16 assembly instruction for TLS with PIC
Wei-zhi Liao
giggle at zillians.com
Fri Aug 17 09:27:22 PDT 2012
Hi all,
System: x86-64 ubuntu 11.04
LLVM: 3.0
gcc: 4.5.2
I declare a thread_local global variable and access it in a function in
llvm IR.
for example,
@my_value = linkonce thread_local global %dummy* null
define void @test1() {
entry:
%load_my_value = load %dummy** @my_value
....
}
After that, I use the following command:
bash$ llc -relocation-model=pic test.ll
And I have test.s which is an assembly file.
I tried to build it with gcc, but I have the following warning
bash$ gcc -c test.s
test.s: Assembler messages:
test.s:43: Warning: stand-alone `data16' prefix
I just wonder why I have data16 instruction in my assembly file.
(ps. If I build it with "llc test.ll", the assembly file will not have
data16 instruction)
I search the llvm project and find some clues in this
file: lib/Target/X86/X86MCInstLower.cpp
static void LowerTlsAddr(...)
{
bool is64Bits = MI.getOpcode() == X86::TLS_addr64;
....
if (is64Bits) {
MCInst prefix;
prefix.setOpcode(X86::DATA16_PREFIX);
....
}
....
}
I think it is the logic to generate data16 instruction, but I wonder why
gcc report warning. Is it a LLVM's bug?
Thanks for your time in advance :D
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120818/d2f80ca6/attachment.html>
More information about the llvm-dev
mailing list