[PATCH] D104609: [lld/mac] Test zerofill sections after __thread_bss

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 20 16:45:19 PDT 2021


thakis created this revision.
thakis added a reviewer: lld-macho.
Herald added a reviewer: gkm.
Herald added a project: lld-macho.
thakis requested review of this revision.

Real zerofill sections go after __thread_bss, since zerofill sections
must all be at the end of their segment and __thread_bss must be right
after __thread_data.

Works fine already, but wasn't tested as far as I can tell.

Also tweak comment about zerofill sections a bit.

No behavior change.


https://reviews.llvm.org/D104609

Files:
  lld/test/MachO/tlv-dylib.s


Index: lld/test/MachO/tlv-dylib.s
===================================================================
--- lld/test/MachO/tlv-dylib.s
+++ lld/test/MachO/tlv-dylib.s
@@ -69,11 +69,29 @@
 # FLAGS-NEXT:   segname __DATA
 # FLAGS-NEXT:      addr
 # FLAGS-NEXT:      size 0x0000000000000008
-# FLAGS-NEXT:    offset
+# FLAGS-NEXT:    offset 0
 # FLAGS-NEXT:     align 2^3 (8)
 # FLAGS-NEXT:    reloff 0
 # FLAGS-NEXT:    nreloc 0
 # FLAGS-NEXT:      type S_THREAD_LOCAL_ZEROFILL
+# FLAGS:       sectname __bss
+# FLAGS-NEXT:   segname __DATA
+# FLAGS-NEXT:      addr
+# FLAGS-NEXT:      size 0x0000000000002000
+# FLAGS-NEXT:    offset 0
+# FLAGS-NEXT:     align 2^0 (1)
+# FLAGS-NEXT:    reloff 0
+# FLAGS-NEXT:    nreloc 0
+# FLAGS-NEXT:      type S_ZEROFILL
+# FLAGS:       sectname __common
+# FLAGS-NEXT:   segname __DATA
+# FLAGS-NEXT:      addr
+# FLAGS-NEXT:      size 0x0000000000004000
+# FLAGS-NEXT:    offset 0
+# FLAGS-NEXT:     align 2^14 (16384)
+# FLAGS-NEXT:    reloff 0
+# FLAGS-NEXT:    nreloc 0
+# FLAGS-NEXT:      type S_ZEROFILL
 
 #--- libtlv.s
 .section __DATA,__thread_vars,thread_local_variables
@@ -95,6 +113,12 @@
 
 ## Add some TLVs to test too, so that we can test the ordering
 ## of __thread_ptrs, __thread_data, and __thread_bss.
+## Also add a .bss and a .comm for good measure too. Since they
+## are both zerofill, they end up after __thread_bss.
+.comm _com, 0x4000
+.bss
+.zero 0x2000
+
 .section __DATA,__thread_data,thread_local_regular
 _tfoo$tlv$init:
   .quad 123


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104609.353248.patch
Type: text/x-patch
Size: 1501 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210620/73076243/attachment.bin>


More information about the llvm-commits mailing list