[mac/arm] fix clang/test/Driver/darwin-ld-dedup.c

The test needs an object file, which it currenty gets with
`-target x86_64-apple-darwin10`.  Rather than adding `REQUIRES: X86`, create
the object file via yaml2obj. This way, the test runs and passes even if the
host arch isn't x86 and only the host arch is built.

Part of PR46644.
This commit is contained in:
Nico Weber 2020-11-23 13:29:36 -05:00
parent e65a5e5b00
commit 47eb5ce19a
5 changed files with 48 additions and 2 deletions

View File

@ -124,6 +124,7 @@ if( NOT CLANG_BUILT_STANDALONE )
llvm-readobj
llvm-symbolizer
opt
yaml2obj
)
if(TARGET llvm-lto)

View File

@ -0,0 +1,44 @@
# Created by `clang -target x86_64-apple-darwin10 -c -x c /dev/null -o - | obj2yaml`.
--- !mach-o
FileHeader:
magic: 0xFEEDFACF
cputype: 0x1000007
cpusubtype: 0x3
filetype: 0x1
ncmds: 2
sizeofcmds: 176
flags: 0x2000
reserved: 0x0
LoadCommands:
- cmd: LC_SEGMENT_64
cmdsize: 152
segname: ''
vmaddr: 0
vmsize: 0
fileoff: 208
filesize: 0
maxprot: 7
initprot: 7
nsects: 1
flags: 0
Sections:
- sectname: __text
segname: __TEXT
addr: 0x0
size: 0
offset: 0xD0
align: 0
reloff: 0x0
nreloc: 0
flags: 0x80000000
reserved1: 0x0
reserved2: 0x0
reserved3: 0x0
content: ''
- cmd: LC_BUILD_VERSION
cmdsize: 24
platform: 1
minos: 720896
sdk: 720896
ntools: 0
...

View File

@ -29,7 +29,7 @@
// Do *not* add -no_deduplicate when no -O option is specified and this is just a link
// (since we can't imply -O0)
// RUN: rm -f %t.o %t.bin
// RUN: %clang -target x86_64-apple-darwin10 -c -o %t.o %s
// RUN: yaml2obj %S/Inputs/empty-x86_64-apple-darwin.yaml -o %t.o
// RUN: %clang -target x86_64-apple-darwin10 %t.o -### -mlinker-version=262 \
// RUN: -o %t.bin 2>&1 | FileCheck -check-prefix=LINK_DEDUP %s
// RUN: %clang -target x86_64-apple-darwin10 %t.o -### -mlinker-version=262 \

View File

@ -64,7 +64,7 @@ tool_dirs = [config.clang_tools_dir, config.llvm_tools_dir]
tools = [
'apinotes-test', 'c-index-test', 'clang-diff', 'clang-format',
'clang-tblgen', 'opt', 'llvm-ifs',
'clang-tblgen', 'opt', 'llvm-ifs', 'yaml2obj',
ToolSubst('%clang_extdef_map', command=FindTool(
'clang-extdef-mapping'), unresolved='ignore'),
]

View File

@ -168,6 +168,7 @@ group("test") {
"//llvm/utils/count",
"//llvm/utils/llvm-lit",
"//llvm/utils/not",
"//llvm/tools/yaml2obj",
]
if (clang_enable_arcmt) {
deps += [