[lld] 2e5a0b3 - [lld-macho][test] Add test case for section ordering

Keith Smiley via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 13 13:56:40 PST 2022


Author: Keith Smiley
Date: 2022-12-13T13:55:21-08:00
New Revision: 2e5a0b3d835bc3fd8d6d4163e300825a88a0ef98

URL: https://github.com/llvm/llvm-project/commit/2e5a0b3d835bc3fd8d6d4163e300825a88a0ef98
DIFF: https://github.com/llvm/llvm-project/commit/2e5a0b3d835bc3fd8d6d4163e300825a88a0ef98.diff

LOG: [lld-macho][test] Add test case for section ordering

This covers the special section ordering handling. This chooses to fake the sections vs creating them organically which is probably a bit easier to maintain.

Differential Revision: https://reviews.llvm.org/D139959

Added: 
    

Modified: 
    lld/test/MachO/section-order.s

Removed: 
    


################################################################################
diff  --git a/lld/test/MachO/section-order.s b/lld/test/MachO/section-order.s
index c16300fdc1b22..f575eebf96dba 100644
--- a/lld/test/MachO/section-order.s
+++ b/lld/test/MachO/section-order.s
@@ -5,8 +5,17 @@
 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/2.s -o %t/2.o
 # RUN: %lld -dylib %t/1.o %t/2.o -o %t/12
 # RUN: %lld -dylib %t/2.o %t/1.o -o %t/21
+# RUN: %lld -dylib %t/2.o %t/1.o -o %t/synth-section-order \
+# RUN:     -add_empty_section __TEXT __objc_stubs \
+# RUN:     -add_empty_section __TEXT __init_offsets \
+# RUN:     -add_empty_section __TEXT __stubs \
+# RUN:     -add_empty_section __TEXT __stub_helper \
+# RUN:     -add_empty_section __TEXT __unwind_info \
+# RUN:     -add_empty_section __TEXT __eh_frame \
+# RUN:     -add_empty_section __DATA __objc_selrefs
 # RUN: llvm-objdump --macho --section-headers %t/12 | FileCheck %s --check-prefix=CHECK-12
 # RUN: llvm-objdump --macho --section-headers %t/21 | FileCheck %s --check-prefix=CHECK-21
+# RUN: llvm-objdump --macho --section-headers %t/synth-section-order | FileCheck %s --check-prefix=CHECK-SYNTHETIC-ORDER
 
 # CHECK-12:      __text
 # CHECK-12-NEXT: foo
@@ -18,6 +27,18 @@
 # CHECK-21-NEXT: bar
 # CHECK-21-NEXT: foo
 
+# CHECK-SYNTHETIC-ORDER:      __text
+# CHECK-SYNTHETIC-ORDER-NEXT: __stubs
+# CHECK-SYNTHETIC-ORDER-NEXT: __stub_helper
+# CHECK-SYNTHETIC-ORDER-NEXT: __objc_stubs
+# CHECK-SYNTHETIC-ORDER-NEXT: __init_offsets
+# CHECK-SYNTHETIC-ORDER-NEXT: __cstring
+# CHECK-SYNTHETIC-ORDER-NEXT: bar
+# CHECK-SYNTHETIC-ORDER-NEXT: foo
+# CHECK-SYNTHETIC-ORDER-NEXT: __unwind_info
+# CHECK-SYNTHETIC-ORDER-NEXT: __eh_frame
+# CHECK-SYNTHETIC-ORDER-NEXT: __objc_selrefs
+
 #--- 1.s
 .section __TEXT,foo
   .space 1


        


More information about the llvm-commits mailing list