[PATCH] D48417: Fix global variable addressing code generation issue in PIC medium code model

Chen Jianping via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 21 01:03:28 PDT 2018


Jianping created this revision.
Jianping added reviewers: craig.topper, DavidKreitzer, zansari.
Herald added a subscriber: llvm-commits.

This is to fix the bug on PIC medium code model for global variable addressing.
without this patch,
llc -filetype=asm -code-model=medium -relocation-model=pic x86-64-pic-medium-codemodel.ll –o x86-64-pic-medium-codemodel.s
will report error like
error: 32 bit reloc applied to a field with a different size

  movabsq $x at GOTPCREL, %rax
  ^

X86DAGToDAGISel::matchWrapper, X86::isOffsetSuitableForCodeModel and X86TargetLowering::getGlobalWrapperKind didn't handle the wrapperRIP for medium code model correctly. This patch is fixed this.


Repository:
  rL LLVM

https://reviews.llvm.org/D48417

Files:
  lib/Target/X86/X86ISelDAGToDAG.cpp
  lib/Target/X86/X86ISelLowering.cpp
  test/CodeGen/X86/x86-64-codemodel-medium-external.ll
  test/CodeGen/X86/x86-64-codemodel-medium-internal.ll
  test/CodeGen/X86/x86-64-pic-medium-codemodel.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48417.152231.patch
Type: text/x-patch
Size: 8476 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180621/b893c174/attachment.bin>


More information about the llvm-commits mailing list