[PATCH] D44485: [MC] Always emit relocations for same-section function references

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 29 16:12:54 PDT 2020


rnk added a comment.

That makes some sense. However, it seems like LLVM MC will correctly report this as an error:

  $ cat t.ll
  @gv = hidden local_unnamed_addr global i64 sub (i64 ptrtoint (i32 ()* @f1 to i64),
                                                  i64 ptrtoint (i32 ()* @f2 to i64)), align 8
  define internal i32 @f1() { ret i32 13 }
  define internal i32 @f2() { ret i32 42 }
  
  $ llc t.ll -filetype=obj -mtriple=x86_64-windows-gnu -o t.o
  LLVM ERROR: Cannot represent this expression
  PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
  Stack dump:
  ...

Seems to be WAI, Julia should not generate such GV initializers.

At the assembly level, the expression looks like this:

  gv:
          .quad   f1-f2

llvm-mc reports a nice error diagnostic instead of error spew in that case.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D44485





More information about the llvm-commits mailing list