[PATCH] D15740: [mips] Add SHF_MIPS_GPREL flag to the MIPS .sbss and .sdata sections

Simon Atanasyan via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 3 03:54:40 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL259641: [mips] Add SHF_MIPS_GPREL flag to the MIPS .sbss and .sdata sections (authored by atanasyan).

Changed prior to commit:
  http://reviews.llvm.org/D15740?vs=45422&id=46765#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15740

Files:
  llvm/trunk/lib/Target/Mips/MipsTargetObjectFile.cpp
  llvm/trunk/test/CodeGen/Mips/mips-shf-gprel.ll

Index: llvm/trunk/test/CodeGen/Mips/mips-shf-gprel.ll
===================================================================
--- llvm/trunk/test/CodeGen/Mips/mips-shf-gprel.ll
+++ llvm/trunk/test/CodeGen/Mips/mips-shf-gprel.ll
@@ -0,0 +1,24 @@
+; Check that .sdata section has SHF_MIPS_GPREL flag.
+
+; RUN: llc -mips-ssection-threshold=16 -mgpopt -mattr=noabicalls \
+; RUN:     -relocation-model=static -march=mips -o - %s -filetype=obj \
+; RUN:   | llvm-readobj -s | FileCheck %s
+
+ at data1 = global [4 x i32] [i32 1, i32 2, i32 3, i32 4], align 4
+ at date2 = global [4 x i32] zeroinitializer, align 4
+
+; CHECK:      Name: .sdata
+; CHECK-NEXT: Type: SHT_PROGBITS
+; CHECK-NEXT: Flags [ (0x10000003)
+; CHECK-NEXT:   SHF_ALLOC
+; CHECK-NEXT:   SHF_MIPS_GPREL
+; CHECK-NEXT:   SHF_WRITE
+; CHECK-NEXT: ]
+
+; CHECK:      Name: .sbss
+; CHECK-NEXT: Type: SHT_NOBITS
+; CHECK-NEXT: Flags [ (0x10000003)
+; CHECK-NEXT:   SHF_ALLOC
+; CHECK-NEXT:   SHF_MIPS_GPREL
+; CHECK-NEXT:   SHF_WRITE
+; CHECK-NEXT: ]
Index: llvm/trunk/lib/Target/Mips/MipsTargetObjectFile.cpp
===================================================================
--- llvm/trunk/lib/Target/Mips/MipsTargetObjectFile.cpp
+++ llvm/trunk/lib/Target/Mips/MipsTargetObjectFile.cpp
@@ -41,10 +41,12 @@
   InitializeELF(TM.Options.UseInitArray);
 
   SmallDataSection = getContext().getELFSection(
-      ".sdata", ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
+      ".sdata", ELF::SHT_PROGBITS,
+      ELF::SHF_WRITE | ELF::SHF_ALLOC | ELF::SHF_MIPS_GPREL);
 
   SmallBSSSection = getContext().getELFSection(".sbss", ELF::SHT_NOBITS,
-                                               ELF::SHF_WRITE | ELF::SHF_ALLOC);
+                                               ELF::SHF_WRITE | ELF::SHF_ALLOC |
+                                                   ELF::SHF_MIPS_GPREL);
   this->TM = &static_cast<const MipsTargetMachine &>(TM);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15740.46765.patch
Type: text/x-patch
Size: 1904 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160203/1ab6cfb8/attachment.bin>


More information about the llvm-commits mailing list