[PATCH] D58378: [PowerPC]Leverage the addend in the TOC relocation to do the address calculation

Nemanja Ivanovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 19 08:02:54 PST 2019


nemanjai requested changes to this revision.
nemanjai added a comment.
This revision now requires changes to proceed.

This can cause relocation overflows:

  $ cat b.c 
  double b[1LU << 33];
  double foo() { return b[(1LU << _SH) - 1] ; }
  void setfoo(double d) { b[(1LU << _SH) - 1] = d; }
  
  $ cat main.c 
  double foo();
  void setfoo(double);
  int main(void) {
    setfoo(445.2);
    return foo() == 445.2;
  }
  
  $ clang -O2 b.c main.c -D_SH=28
  /tmp/b-9d97be.o: In function `foo':
  b.c:(.text+0x8): relocation truncated to fit: R_PPC64_TOC16_HA against symbol `b' defined in COMMON section in /tmp/b-9d97be.o+7ffffff8
  /tmp/b-9d97be.o: In function `setfoo':
  b.c:(.text+0x28): relocation truncated to fit: R_PPC64_TOC16_HA against symbol `b' defined in COMMON section in /tmp/b-9d97be.o+7ffffff8
  clang-9: error: linker command failed with exit code 1 (use -v to see invocation)


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

https://reviews.llvm.org/D58378





More information about the llvm-commits mailing list