[PATCH] D63076: [ELF][RISCV] Support PLT, GOT, copy and relative relocations

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 12 01:23:43 PDT 2019


MaskRay marked an inline comment as done.
MaskRay added inline comments.


================
Comment at: ELF/Arch/RISCV.cpp:116
+void RISCV::writeGotHeader(uint8_t *Buf) const {
+  write64le(Buf, Main->Dynamic->getVA());
+}
----------------
ruiu wrote:
> ruiu wrote:
> > For example, it looks like this code assumes RISCV64.
> We have writeInt and writeUint to write word-size integers. Maybe you should use that?
The functions are in SyntheticSections.cpp and are static:

```
static uint64_t readUint(uint8_t *Buf) {
  return Config->Is64 ? read64(Buf) : read32(Buf);
}

static void writeUint(uint8_t *Buf, uint64_t Val) {
  if (Config->Is64)
    write64(Buf, Val);
  else
    write32(Buf, Val);
}
```

I don't expect there will be many other dispatches like these. So the duplication is probably ok? (If there are going to have more, we can create such helper functions in this file)


Repository:
  rLLD LLVM Linker

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

https://reviews.llvm.org/D63076





More information about the llvm-commits mailing list