Files
clang-p2996/lld/test/MachO/invalid/cstring-dedup.s
Jez Ng 2828a54996 [lld-macho] Don't support relocations in cstring sections
We can technically handle them, but since they shouldn't come up in any
real-world programs (since ld64 dedups strings unconditionally), there's
no reason to support them.

It's a thoroughly untested code path too -- as evidenced by the fact
that the only test this change breaks is one that verifies that we
reject relocations when dedup'ing. There is no test that covers the case
where we handle relocations in cstring sections when dedup is disabled.

Reviewed By: #lld-macho, oontvoo, keith, thakis

Differential Revision: https://reviews.llvm.org/D141025
2023-01-05 14:14:11 -05:00

26 lines
849 B
ArmAsm

## We're intentionally testing fatal errors (for malformed input files), and
## fatal errors aren't supported for testing when main is run twice.
# XFAIL: main-run-twice
# REQUIRES: x86
# RUN: rm -rf %t; split-file %s %t
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/not-terminated.s -o %t/not-terminated.o
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/relocs.s -o %t/relocs.o
# RUN: not %lld -dylib %t/not-terminated.o 2>&1 | FileCheck %s --check-prefix=TERM
# RUN: not %lld -dylib %t/relocs.o 2>&1 | FileCheck %s --check-prefix=RELOCS
# TERM: not-terminated.o:(__cstring+0x4): string is not null terminated
# RELOCS: error: {{.*}}relocs.o: __TEXT,__cstring contains relocations, which is unsupported
#--- not-terminated.s
.cstring
.asciz "foo"
.ascii "oh no"
#--- relocs.s
.cstring
_str:
.asciz "foo"
.quad _str