[PATCH] Don't access items in .sdata section using gp-relative addressing when target is NaCl.

Sasa Stankovic Sasa.Stankovic at imgtec.com
Mon Jun 9 08:45:27 PDT 2014


Hi mseaborn,

[mips] Don't access items in .sdata section using gp-relative addressing when target is NaCl.

http://reviews.llvm.org/D4069

Files:
  lib/Target/Mips/MipsSubtarget.cpp
  test/CodeGen/Mips/nacl-small-section.ll

Index: lib/Target/Mips/MipsSubtarget.cpp
===================================================================
--- lib/Target/Mips/MipsSubtarget.cpp
+++ lib/Target/Mips/MipsSubtarget.cpp
@@ -153,7 +153,7 @@
   // Set UseSmallSection.
   // TODO: Investigate the IsLinux check. I suspect it's really checking for
   //       bare-metal.
-  UseSmallSection = !IsLinux && (RM == Reloc::Static);
+  UseSmallSection = !IsLinux && !isTargetNaCl() && (RM == Reloc::Static);
 }
 
 bool
Index: test/CodeGen/Mips/nacl-small-section.ll
===================================================================
--- test/CodeGen/Mips/nacl-small-section.ll
+++ test/CodeGen/Mips/nacl-small-section.ll
@@ -0,0 +1,18 @@
+; RUN: llc -filetype=asm -mtriple=mipsel-none-nacl -relocation-model=static \
+; RUN:     < %s | FileCheck %s
+
+
+ at x = global i32 1, align 4
+
+define i32 @test1() {
+  %1 = load i32* @x, align 4
+  ret i32 %1
+
+
+; CHECK-LABEL:       test1
+
+; Check that in NaCl the items in .sdata secton are not accessed using
+; gp-relative addressing.
+
+; CHECK-NOT:         %gp_rel(x)($gp)
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4069.10238.patch
Type: text/x-patch
Size: 1084 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140609/aa06c787/attachment.bin>


More information about the llvm-commits mailing list