Index: lib/Target/Mips/MipsSubtarget.cpp
===================================================================
--- lib/Target/Mips/MipsSubtarget.cpp
+++ lib/Target/Mips/MipsSubtarget.cpp
@@ -153,7 +153,9 @@
   // Set UseSmallSection.
   // TODO: Investigate the IsLinux check. I suspect it's really checking for
   //       bare-metal.
-  UseSmallSection = !IsLinux && (RM == Reloc::Static);
+  // We disable gp-relative addressing for NaCl.  gp-relative addressing can
+  // address 64K area only.
+  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
+
+
+@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)
+}