[PATCH] D77672: [ELF] Support a few more SPARCv9 relocations

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 14 12:58:23 PDT 2020


MaskRay added inline comments.


================
Comment at: lld/test/ELF/emulation-sparc.s:2
+# REQUIRES: arm
+# RUN: llvm-mc -filetype=obj -triple=sparcv9-unknown-linux %s -o %tsparc
+# RUN: ld.lld -m elf64_sparc %tsparc -o %t2sparc
----------------
You can drop `-unknown-linux`. FreeBSD/OpenBSD's triples don't have the OS part. Without the OS part, it usually means the generic ELF behavior.

For an object file, it is usually better to use `%t.o` or similar.

For an executable, `%t` usually suffices. When there are more than one, Use `%t1` `%t2` ...

(I know that some existing tests don't follow the convention.) And the existing `emulation-*` do not follow the best practice.


================
Comment at: lld/test/ELF/emulation-sparc.s:8
+# RUN: echo 'OUTPUT_FORMAT(elf64-sparc)' > %t4sparc.script
+# RUN: ld.lld %t4sparc.script %tsparc -o %t5sparc
+# RUN: llvm-readobj --file-headers %t5sparc | FileCheck --check-prefix=V9 %s
----------------
Add -T before a linker script (you may name it `%t.lds`, shorter than `%t.script`)

GNU ld warns without `-T`


================
Comment at: lld/test/ELF/emulation-sparc.s:10
+# RUN: llvm-readobj --file-headers %t5sparc | FileCheck --check-prefix=V9 %s
+# V9:      ElfHeader {
+# V9-NEXT:   Ident {
----------------
If there are no other prefixes, just use the FileCheck default `CHECK`. You can omit `--check-prefix` as well.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77672/new/

https://reviews.llvm.org/D77672





More information about the llvm-commits mailing list