[PATCH] D78741: [LLD][ELF][AVR] Implement the missing relocation types

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 9 10:24:54 PDT 2020


MaskRay added inline comments.


================
Comment at: lld/ELF/Arch/AVR.cpp:98
+  case R_AVR_LO8_LDI_NEG:
+    writeLDI(loc, (~val + 1) & 0xff);
+    break;
----------------
~val + 1 = -val

So just use (-val)


================
Comment at: lld/test/ELF/avr-reloc.s:3
+# RUN: llvm-mc -filetype=obj -triple=avr -mcpu=atmega328p %s -o %t.o
+# RUN: ld.lld %t.o --defsym=a=0x12345678 --defsym=b=30 -o %t.exe -Ttext=0
+# RUN: llvm-objdump -d %t.exe | FileCheck %s
----------------
`-o %t`

Omit `.exe`

I don't know why `-Ttext=0` is there. Use `--image-base=0` if you really want a 0 address text segment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78741





More information about the llvm-commits mailing list