[PATCH] D69411: [MC] Resolve the difference of symbols in consecutive MCDataFragements

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 19 21:12:06 PDT 2020


MaskRay added a comment.

Worth mentioning that this is needed by (this assembly file does not assemble with the integrated assembler as of today):

  make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- LLVM=1 LLVM_IAS=1 defconfig arch/arm/mm/proc-v7.o



================
Comment at: llvm/include/llvm/MC/MCFragment.h:74
+  // the fragment is not in any subsection
+  unsigned SubsectionNumber = 0;
+
----------------
Move below LayoutOrder. sizeof(MCDataFragment) will not change

Alternatively, disable the folding for Mach-O because this is too subtle (if getSubsectionViaSymbols())


================
Comment at: llvm/lib/MC/MCExpr.cpp:621
+  // in the case of foo: instr; .arch_extension ext; instr .if . - foo
+  if (!Layout) {
+    if (SA.isVariable() || SA.isUnset() || SB.isVariable() || SB.isUnset() ||
----------------
Consider swapping then and else branches to avoid `!`


================
Comment at: llvm/test/MC/ARM/directive_if_offset.s:1
+@ RUN: llvm-mc -triple armv7a-linux-gnueabihf %s -filetype=obj -o /dev/null 2>&1 | FileCheck --allow-empty %s
+@ RUN: llvm-mc -triple armv7a-linux-gnueabihf %s -filetype=obj -o %t | llvm-objdump -d %t | FileCheck --check-prefix=CHECK-ASM %s
----------------
In this directory `file-name.s` is more common. What about directive-if-sub.s? sub is more meaningful than offset.

Add a `llvm-mc -triple armv7a-linux-gnueabihf %s -o /dev/null 2>&1` test to show that -filetype=asm does not work (MCAssembler * is null so, but this is less of an issue)


================
Comment at: llvm/test/MC/ARM/directive_if_offset_error.s:1
+@ RUN: not llvm-mc -filetype=obj -triple arm-linux-gnueabihf %s -o /dev/null 2>&1 | FileCheck %s
+
----------------
See ELF/reloc-directive.s

You can use --defsym=ERR=1 to merge the tests into directive-if-sub.s


================
Comment at: llvm/test/MC/ARM/thumb2_directive_if_offset_error.s:1
+@ RUN: not llvm-mc -filetype=obj -triple thumbv7a-linux-gnueabihf %s -o /dev/null 2>&1 | FileCheck %s
+
----------------
ditto


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69411



More information about the llvm-commits mailing list