231 lines · plain
1# REQUIRES: aarch642 3# RUN: rm -rf %t; split-file %s %t4# RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %t/test.s -o %t/test.o5# RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %t/more-cstrings.s -o %t/more-cstrings.o6 7# RUN: %lld -arch arm64 -lSystem -e _main -o %t/test-0 %t/test.o %t/more-cstrings.o8# RUN: llvm-nm --numeric-sort --format=just-symbols %t/test-0 | FileCheck %s --check-prefix=ORIGIN_SYM9# RUN: llvm-objdump --macho --section="__TEXT,__cstring" %t/test-0 | FileCheck %s --check-prefix=ORIGIN_SEC10 11# RUN: %lld -arch arm64 -lSystem -e _main -o %t/test-1 %t/test.o %t/more-cstrings.o -order_file %t/ord-112# RUN: llvm-nm --numeric-sort --format=just-symbols %t/test-1 | FileCheck %s --check-prefix=ONE_SYM13# RUN: llvm-objdump --macho --section="__TEXT,__cstring" %t/test-1 | FileCheck %s --check-prefix=ONE_SEC14 15# RUN: %lld --no-deduplicate-strings -arch arm64 -lSystem -e _main -o %t/test-1-dup %t/test.o %t/more-cstrings.o -order_file %t/ord-116# RUN: llvm-nm --numeric-sort --format=just-symbols %t/test-1-dup | FileCheck %s --check-prefix=ONE_SYM17# RUN: llvm-objdump --macho --section="__TEXT,__cstring" %t/test-1-dup | FileCheck %s --check-prefix=ONE_SEC18 19# RUN: %lld -arch arm64 -lSystem -e _main -o %t/test-2 %t/test.o %t/more-cstrings.o -order_file %t/ord-220# RUN: llvm-nm --numeric-sort --format=just-symbols %t/test-2 | FileCheck %s --check-prefix=TWO_SYM21# RUN: llvm-objdump --macho --section="__TEXT,__cstring" %t/test-2 | FileCheck %s --check-prefix=TWO_SEC22 23# RUN: %lld -arch arm64 -lSystem -e _main -o %t/test-3 %t/test.o %t/more-cstrings.o -order_file %t/ord-324# RUN: llvm-nm --numeric-sort --format=just-symbols %t/test-3 | FileCheck %s --check-prefix=THREE_SYM25# RUN: llvm-objdump --macho --section="__TEXT,__cstring" %t/test-3 | FileCheck %s --check-prefix=THREE_SEC26 27# RUN: %lld -arch arm64 -lSystem -e _main -o %t/test-4 %t/test.o %t/more-cstrings.o -order_file %t/ord-428# RUN: llvm-nm --numeric-sort --format=just-symbols %t/test-4 | FileCheck %s --check-prefix=FOUR_SYM29# RUN: llvm-objdump --macho --section="__TEXT,__cstring" %t/test-4 | FileCheck %s --check-prefix=FOUR_SEC30# RUN: llvm-readobj --string-dump=__cstring %t/test-4 | FileCheck %s --check-prefix=FOUR_SEC_ESCAPE31 32# We expect:33# 1) Covered cstring symbols to be reordered34# 2) the rest of the cstring symbols remain in the original relative order within the cstring section35 36# ORIGIN_SYM: _local_foo137# ORIGIN_SYM: _globl_foo238# ORIGIN_SYM: _local_foo239# ORIGIN_SYM: _bar40# ORIGIN_SYM: _baz41# ORIGIN_SYM: _baz_dup42# ORIGIN_SYM: _bar243# ORIGIN_SYM: _globl_foo344 45# ORIGIN_SEC: foo146# ORIGIN_SEC: foo247# ORIGIN_SEC: bar48# ORIGIN_SEC: baz49# ORIGIN_SEC: bar250# ORIGIN_SEC: foo351 52# original order, but only parital covered53#--- ord-154#foo255CSTR;143394267756#bar57CSTR;54020182658#bar259CSTR;149628655560#foo361CSTR;134399902562 63# ONE_SYM-DAG: _globl_foo264# ONE_SYM-DAG: _local_foo265# ONE_SYM: _bar66# ONE_SYM: _bar267# ONE_SYM: _globl_foo368# ONE_SYM: _local_foo169# ONE_SYM: _baz70# ONE_SYM: _baz_dup71 72# ONE_SEC: foo273# ONE_SEC: bar74# ONE_SEC: bar275# ONE_SEC: foo376# ONE_SEC: foo177# ONE_SEC: baz78 79 80# TWO_SYM: _globl_foo281# TWO_SYM: _local_foo282# TWO_SYM: _local_foo183# TWO_SYM: _baz84# TWO_SYM: _baz_dup85# TWO_SYM: _bar86# TWO_SYM: _bar287# TWO_SYM: _globl_foo388 89# TWO_SEC: foo290# TWO_SEC: foo191# TWO_SEC: baz92# TWO_SEC: bar93# TWO_SEC: bar294# TWO_SEC: foo395 96 97# THREE_SYM: _local_foo198# THREE_SYM: _baz99# THREE_SYM: _baz_dup100# THREE_SYM: _bar101# THREE_SYM: _bar2102# THREE_SYM: _globl_foo2103# THREE_SYM: _local_foo2104# THREE_SYM: _globl_foo3105 106# THREE_SEC: foo1107# THREE_SEC: baz108# THREE_SEC: bar109# THREE_SEC: bar2110# THREE_SEC: foo2111# THREE_SEC: foo3112 113 114# FOUR_SYM: _local_escape_white_space115# FOUR_SYM: _globl_foo2116# FOUR_SYM: _local_foo2117# FOUR_SYM: _local_escape118# FOUR_SYM: _globl_foo3119# FOUR_SYM: _bar120# FOUR_SYM: _local_foo1121# FOUR_SYM: _baz122# FOUR_SYM: _baz_dup123# FOUR_SYM: _bar2124 125# FOUR_SEC: \t\n126# FOUR_SEC: foo2127# FOUR_SEC: @\"NSDictionary\"128# FOUR_SEC: foo3129# FOUR_SEC: bar130# FOUR_SEC: foo1131# FOUR_SEC: baz132# FOUR_SEC: bar2133 134# FOUR_SEC_ESCAPE: ..135# FOUR_SEC_ESCAPE: foo2136# FOUR_SEC_ESCAPE: @"NSDictionary"137# FOUR_SEC_ESCAPE: foo3138# FOUR_SEC_ESCAPE: bar139# FOUR_SEC_ESCAPE: foo1140# FOUR_SEC_ESCAPE: baz141# FOUR_SEC_ESCAPE: bar2142 143 144# change order, parital covered145#--- ord-2146#foo2147CSTR;1433942677148#foo1149CSTR;1663475769150#baz151CSTR;862947621152#bar153CSTR;540201826154#bar2155CSTR;1496286555156 157# change order, parital covered, with mismatches, duplicates158#--- ord-3159foo2222160CSTR;0x11111111161#bar (mismatched cpu and file name)162fakeCPU:fake-file-name.o:CSTR;540201826163#not a hash164CSTR;xxx165#foo1166CSTR;1663475769167#baz168CSTR;862947621169#bar170CSTR;540201826171#bar2172CSTR;1496286555173#baz174CSTR;862947621175 176# test escape strings177#--- ord-4178#\t\n179CSTR;1035903177180#foo2181CSTR;1433942677182#@\"NSDictionary\"183CSTR;1202669430184#foo3185CSTR;1343999025186#bar187CSTR;540201826188 189 190#--- test.s191.text192.globl _main193 194_main:195 ret196 197.cstring198.p2align 2199_local_foo1:200 .asciz "foo1"201_local_foo2:202 .asciz "foo2"203L_.foo1_dup:204 .asciz "foo1"205L_.foo2_dup:206 .asciz "foo2"207_local_escape:208 .asciz "@\"NSDictionary\""209_local_escape_white_space:210 .asciz "\t\n"211 212_bar:213 .asciz "bar"214_baz:215 .asciz "baz"216_bar2:217 .asciz "bar2"218_baz_dup:219 .asciz "baz"220 221.subsections_via_symbols222 223#--- more-cstrings.s224.globl _globl_foo1, _globl_foo3225.cstring226.p2align 4227_globl_foo3:228 .asciz "foo3"229_globl_foo2:230 .asciz "foo2"231