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@GOTPCREL, %rax ^
X86DAGToDAGISel::matchWrapper, X86::isOffsetSuitableForCodeModel and X86TargetLowering::getGlobalWrapperKind didn't handle the wrapperRIP for medium code model correctly. This patch is fixed this.
This doesn't seem correct. global_arr might be too far away, right?