<div dir="ltr">On Mon, Aug 5, 2013 at 8:58 PM, Shankar Easwaran <span dir="ltr"><<a href="mailto:shankare@codeaurora.org" target="_blank">shankare@codeaurora.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Isnt this supposed to be meant for common symbols ?</blockquote><div><br></div><div>I guess it's the correct terminology, but I don't know much about it. Is this different from atoms for BSS?</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
<br>
On 8/2/2013 12:25 AM, Rui Ueyama wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: ruiu<br>
Date: Fri Aug 2 00:25:31 2013<br>
New Revision: 187645<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=187645&view=rev" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project?rev=187645&view=rev</a><br>
Log:<br>
[PECOFF] A symbol with symbol with section number 0 and non-zero value represents a BSS atom.<br>
<br>
Added:<br>
lld/trunk/test/pecoff/Inputs/<u></u>bss-undef.obj.yaml<br>
lld/trunk/test/pecoff/bss-<u></u>undef.test<br>
Modified:<br>
lld/trunk/lib/ReaderWriter/<u></u>PECOFF/ReaderCOFF.cpp<br>
<br>
Modified: lld/trunk/lib/ReaderWriter/<u></u>PECOFF/ReaderCOFF.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp?rev=187645&r1=187644&r2=187645&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/lld/trunk/lib/<u></u>ReaderWriter/PECOFF/<u></u>ReaderCOFF.cpp?rev=187645&r1=<u></u>187644&r2=187645&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- lld/trunk/lib/ReaderWriter/<u></u>PECOFF/ReaderCOFF.cpp (original)<br>
+++ lld/trunk/lib/ReaderWriter/<u></u>PECOFF/ReaderCOFF.cpp Fri Aug 2 00:25:31 2013<br>
@@ -161,6 +161,20 @@ private:<br>
// Filter non-defined atoms, and group defined atoms by its section.<br>
SectionToSymbolsT definedSymbols;<br>
for (const coff_symbol *sym : symbols) {<br>
+ // A symbol with section number 0 and non-zero value represents an<br>
+ // uninitialized data. I don't understand why there are two ways to define<br>
+ // an uninitialized data symbol (.bss and this way), but that's how COFF<br>
+ // works.<br>
+ if (sym->SectionNumber == llvm::COFF::IMAGE_SYM_<u></u>UNDEFINED &&<br>
+ sym->Value > 0) {<br>
+ StringRef name = _symbolName[sym];<br>
+ uint32_t size = sym->Value;<br>
+ auto *atom = new (_alloc) COFFBSSAtom(*this, name, sym, size, 0);<br>
+ result.push_back(atom);<br>
+ continue;<br>
+ }<br>
+<br>
+ // Skip if it's not for defined atom.<br>
if (sym->SectionNumber == llvm::COFF::IMAGE_SYM_ABSOLUTE ||<br>
sym->SectionNumber == llvm::COFF::IMAGE_SYM_<u></u>UNDEFINED)<br>
continue;<br>
<br>
Added: lld/trunk/test/pecoff/Inputs/<u></u>bss-undef.obj.yaml<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/Inputs/bss-undef.obj.yaml?rev=187645&view=auto" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/lld/trunk/test/pecoff/<u></u>Inputs/bss-undef.obj.yaml?rev=<u></u>187645&view=auto</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- lld/trunk/test/pecoff/Inputs/<u></u>bss-undef.obj.yaml (added)<br>
+++ lld/trunk/test/pecoff/Inputs/<u></u>bss-undef.obj.yaml Fri Aug 2 00:25:31 2013<br>
@@ -0,0 +1,43 @@<br>
+---<br>
+header:<br>
+ Machine: IMAGE_FILE_MACHINE_I386<br>
+ Characteristics: [ ]<br>
+sections:<br>
+ - Name: .text<br>
+ Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]<br>
+ Alignment: 4<br>
+ SectionData: ""<br>
+ - Name: .data<br>
+ Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_<u></u>DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]<br>
+ Alignment: 4<br>
+ SectionData: 03000000<br>
+symbols:<br>
+ - Name: .text<br>
+ Value: 0<br>
+ SectionNumber: 1<br>
+ SimpleType: IMAGE_SYM_TYPE_NULL<br>
+ ComplexType: IMAGE_SYM_DTYPE_NULL<br>
+ StorageClass: IMAGE_SYM_CLASS_STATIC<br>
+ NumberOfAuxSymbols: 1<br>
+ AuxiliaryData: 000000000000000000000000000000<u></u>000000<br>
+ - Name: .data<br>
+ Value: 0<br>
+ SectionNumber: 2<br>
+ SimpleType: IMAGE_SYM_TYPE_NULL<br>
+ ComplexType: IMAGE_SYM_DTYPE_NULL<br>
+ StorageClass: IMAGE_SYM_CLASS_STATIC<br>
+ NumberOfAuxSymbols: 1<br>
+ AuxiliaryData: 040000000000000000000000000000<u></u>000000<br>
+ - Name: _bssdata1<br>
+ Value: 4<br>
+ SectionNumber: 0<br>
+ SimpleType: IMAGE_SYM_TYPE_NULL<br>
+ ComplexType: IMAGE_SYM_DTYPE_NULL<br>
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL<br>
+ - Name: _bssdata2<br>
+ Value: 4<br>
+ SectionNumber: 0<br>
+ SimpleType: IMAGE_SYM_TYPE_NULL<br>
+ ComplexType: IMAGE_SYM_DTYPE_NULL<br>
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL<br>
+...<br>
<br>
Added: lld/trunk/test/pecoff/bss-<u></u>undef.test<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/bss-undef.test?rev=187645&view=auto" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/lld/trunk/test/pecoff/<u></u>bss-undef.test?rev=187645&<u></u>view=auto</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- lld/trunk/test/pecoff/bss-<u></u>undef.test (added)<br>
+++ lld/trunk/test/pecoff/bss-<u></u>undef.test Fri Aug 2 00:25:31 2013<br>
@@ -0,0 +1,22 @@<br>
+# RUN: yaml2obj %p/Inputs/bss-undef.obj.yaml > %t.obj<br>
+#<br>
+# RUN: lld -flavor link /out:%t /subsystem:console /force -- %t.obj \<br>
+# RUN: && llvm-readobj -sections %t | FileCheck %s<br>
+<br>
+CHECK: Section {<br>
+CHECK: Number: 2<br>
+CHECK-NEXT: Name: .bss<br>
+CHECK-NEXT: VirtualSize: 0x0<br>
+CHECK-NEXT: VirtualAddress: 0x2000<br>
+CHECK-NEXT: RawDataSize: 512<br>
+CHECK-NEXT: PointerToRawData: 0x0<br>
+CHECK-NEXT: PointerToRelocations: 0x0<br>
+CHECK-NEXT: PointerToLineNumbers: 0x0<br>
+CHECK-NEXT: RelocationCount: 0<br>
+CHECK-NEXT: LineNumberCount: 0<br>
+CHECK-NEXT: Characteristics [<br>
+CHECK-NEXT: IMAGE_SCN_CNT_UNINITIALIZED_<u></u>DATA<br>
+CHECK-NEXT: IMAGE_SCN_MEM_READ<br>
+CHECK-NEXT: IMAGE_SCN_MEM_WRITE<br>
+CHECK-NEXT: ]<br>
+CHECK-NEXT: }<br>
<br>
<br>
______________________________<u></u>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/llvm-commits</a><br>
<br>
<br>
</blockquote>
<br>
<br></div></div><span class="HOEnZb"><font color="#888888">
-- <br>
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation<br>
<br>
</font></span></blockquote></div><br></div></div>