Hey Cameron,<div><br></div><div>Sorry to reply this mail so late.</div><div><br></div><div>Recently, I tried to understand what's the impact of the warning message</div><div>(Warning: stand-alone `data16' prefix)</div>
<div><br></div><div>And in binutils (gas/config/tc-i386.c), I found:</div><div><br></div><div><div>if (!quiet_warnings)</div><div>{ </div><div> .....</div><div><br></div><div> if (t->opcode_modifier.isprefix</div>
<div> && t->opcode_modifier.ignoresize)</div><div> { </div><div> /* Warn them that a data or address size prefix doesn't</div><div> affect assembly of the next line of code. */</div>
<div> as_warn (_("stand-alone `%s' prefix"), t->name);</div><div> }</div><div>}</div></div><div><br></div><div>It looks like the `data16' does not have any influence on the instructions followed. </div>
<div>My opinion is to safely ignore this warning :=D<br><div class="gmail_extra"><br></div><div class="gmail_extra">-- Giggle (giggling)<br><br><div class="gmail_quote">On Sat, Aug 18, 2012 at 1:00 AM, <span dir="ltr"><<a href="mailto:llvmdev-request@cs.uiuc.edu" target="_blank">llvmdev-request@cs.uiuc.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Send LLVMdev mailing list submissions to<br>
<a href="mailto:llvmdev@cs.uiuc.edu">llvmdev@cs.uiuc.edu</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:llvmdev-request@cs.uiuc.edu">llvmdev-request@cs.uiuc.edu</a><br>
<br>
You can reach the person managing the list at<br>
<a href="mailto:llvmdev-owner@cs.uiuc.edu">llvmdev-owner@cs.uiuc.edu</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of LLVMdev digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
1. Generate data16 assembly instruction for TLS with PIC<br>
(Wei-zhi Liao)<br>
2. Re: Generate data16 assembly instruction for TLS with PIC<br>
(Cameron McInally)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Sat, 18 Aug 2012 00:27:22 +0800<br>
From: Wei-zhi Liao <<a href="mailto:giggle@zillians.com">giggle@zillians.com</a>><br>
Subject: [LLVMdev] Generate data16 assembly instruction for TLS with<br>
PIC<br>
To: <a href="mailto:llvmdev@cs.uiuc.edu">llvmdev@cs.uiuc.edu</a><br>
Message-ID:<br>
<<a href="mailto:CAASwg9gTqU-fDDFKwWvYdCZaEW2pyP2G544vHtguFYyV3D6zdw@mail.gmail.com">CAASwg9gTqU-fDDFKwWvYdCZaEW2pyP2G544vHtguFYyV3D6zdw@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="iso-8859-1"<br>
<br>
Hi all,<br>
<br>
System: x86-64 ubuntu 11.04<br>
LLVM: 3.0<br>
gcc: 4.5.2<br>
<br>
I declare a thread_local global variable and access it in a function in<br>
llvm IR.<br>
for example,<br>
<br>
@my_value = linkonce thread_local global %dummy* null<br>
<br>
define void @test1() {<br>
entry:<br>
%load_my_value = load %dummy** @my_value<br>
....<br>
}<br>
<br>
After that, I use the following command:<br>
<br>
bash$ llc -relocation-model=pic test.ll<br>
<br>
And I have test.s which is an assembly file.<br>
<br>
I tried to build it with gcc, but I have the following warning<br>
<br>
bash$ gcc -c test.s<br>
test.s: Assembler messages:<br>
test.s:43: Warning: stand-alone `data16' prefix<br>
<br>
I just wonder why I have data16 instruction in my assembly file.<br>
(ps. If I build it with "llc test.ll", the assembly file will not have<br>
data16 instruction)<br>
<br>
I search the llvm project and find some clues in this<br>
file: lib/Target/X86/X86MCInstLower.cpp<br>
static void LowerTlsAddr(...)<br>
{<br>
bool is64Bits = MI.getOpcode() == X86::TLS_addr64;<br>
....<br>
if (is64Bits) {<br>
MCInst prefix;<br>
prefix.setOpcode(X86::DATA16_PREFIX);<br>
....<br>
}<br>
....<br>
}<br>
<br>
I think it is the logic to generate data16 instruction, but I wonder why<br>
gcc report warning. Is it a LLVM's bug?<br>
Thanks for your time in advance :D<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/attachments/20120818/d2f80ca6/attachment-0001.html" target="_blank">http://lists.cs.uiuc.edu/pipermail/llvmdev/attachments/20120818/d2f80ca6/attachment-0001.html</a><br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Fri, 17 Aug 2012 12:40:09 -0400<br>
From: Cameron McInally <<a href="mailto:cameron.mcinally@nyu.edu">cameron.mcinally@nyu.edu</a>><br>
Subject: Re: [LLVMdev] Generate data16 assembly instruction for TLS<br>
with PIC<br>
To: Wei-zhi Liao <<a href="mailto:giggle@zillians.com">giggle@zillians.com</a>><br>
Cc: <a href="mailto:llvmdev@cs.uiuc.edu">llvmdev@cs.uiuc.edu</a><br>
Message-ID:<br>
<CAKs25gOyDpP=<a href="mailto:UwBJn7e9NBuie%2BTu09wfnVmtrNVPbMesHc1y3g@mail.gmail.com">UwBJn7e9NBuie+Tu09wfnVmtrNVPbMesHc1y3g@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="iso-8859-1"<br>
<br>
Hey Wei-zhi,<br>
<br>
I also had this issue with the X86 backend. And, unfortunately, searching<br>
for the warning did not turn up too much information. My solution was to<br>
emit a raw 0x66 byte in place of the data16 prefix. I believe those are<br>
equivalent and the assembler is much happier about it...<br>
<br>
> #if LLVM_31_MERGE<br>
> SmallString<11> byte;<br>
> byte = "\t.byte 0x66";<br>
> OutStreamer.EmitRawText(byte);<br>
>#else /* LLVM_31_MERGE */<br>
> prefix.setOpcode(X86::DATA16_PREFIX);<br>
> OutStreamer.EmitInstruction(prefix);<br>
>#endif /* LLVM_31_MERGE */<br>
<br>
-Cameron<br>
<br>
On Fri, Aug 17, 2012 at 12:27 PM, Wei-zhi Liao <<a href="mailto:giggle@zillians.com">giggle@zillians.com</a>> wrote:<br>
...<br>
><br>
> I think it is the logic to generate data16 instruction, but I wonder why<br>
> gcc report warning. Is it a LLVM's bug?<br>
> Thanks for your time in advance :D<br>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/attachments/20120817/93d75f02/attachment-0001.html" target="_blank">http://lists.cs.uiuc.edu/pipermail/llvmdev/attachments/20120817/93d75f02/attachment-0001.html</a><br>
<br>
------------------------------<br>
<br>
_______________________________________________<br>
LLVMdev mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br>
<br>
End of LLVMdev Digest, Vol 98, Issue 33<br>
***************************************<br>
</blockquote></div><br></div></div>