[llvm-commits] [llvm] r118395 - in /llvm/trunk: lib/MC/MCParser/ELFAsmParser.cpp test/MC/ELF/section.s

Rafael Espindola rafael.espindola at gmail.com
Sun Nov 7 18:47:59 PST 2010


Author: rafael
Date: Sun Nov  7 20:47:59 2010
New Revision: 118395

URL: http://llvm.org/viewvc/llvm-project?rev=118395&view=rev
Log:
Set default flags for .rodata.

Modified:
    llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp
    llvm/trunk/test/MC/ELF/section.s

Modified: llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp?rev=118395&r1=118394&r2=118395&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp Sun Nov  7 20:47:59 2010
@@ -271,9 +271,11 @@
   unsigned Type = MCSectionELF::SHT_NULL;
 
   // Set the defaults first.
-  if (SectionName == ".fini" || SectionName == ".init") {
+  if (SectionName == ".fini" || SectionName == ".init" || SectionName == ".rodata") {
     Type = MCSectionELF::SHT_PROGBITS;
     Flags |= MCSectionELF::SHF_ALLOC;
+  }
+  if (SectionName == ".fini" || SectionName == ".init") {
     Flags |= MCSectionELF::SHF_EXECINSTR;
   }
 

Modified: llvm/trunk/test/MC/ELF/section.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/section.s?rev=118395&r1=118394&r2=118395&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/section.s (original)
+++ llvm/trunk/test/MC/ELF/section.s Sun Nov  7 20:47:59 2010
@@ -10,10 +10,11 @@
 // CHECK: ('sh_name', 0x00000022) # '.note.GNU-'
 // CHECK: ('sh_name', 0x0000002d) # '-.note.GNU'
 
-// Test that the dafults for init and fini are used
+// Test that the dafults are used
 
 .section	.init
 .section	.fini
+.section	.rodata
 
 // CHECK:      (('sh_name', 0x00000038) # '.init'
 // CHECK-NEXT:  ('sh_type', 0x00000001)
@@ -37,7 +38,19 @@
 // CHECK-NEXT:  ('sh_info', 0x00000000)
 // CHECK-NEXT:  ('sh_addralign', 0x00000001)
 // CHECK-NEXT:  ('sh_entsize', 0x00000000)
-
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Section 0x00000009
+// CHECK-NEXT: (('sh_name', 0x00000044) # '.rodata'
+// CHECK-NEXT:  ('sh_type', 0x00000001)
+// CHECK-NEXT:  ('sh_flags', 0x00000002)
+// CHECK-NEXT:  ('sh_addr', 0x00000000)
+// CHECK-NEXT:  ('sh_offset', 0x00000040)
+// CHECK-NEXT:  ('sh_size', 0x00000000)
+// CHECK-NEXT:  ('sh_link', 0x00000000)
+// CHECK-NEXT:  ('sh_info', 0x00000000)
+// CHECK-NEXT:  ('sh_addralign', 0x00000001)
+// CHECK-NEXT:  ('sh_entsize', 0x00000000)
+// CHECK-NEXT: ),
 
 // Test that we can parse these
 .section        .text.foo,"axG", at progbits,foo,comdat





More information about the llvm-commits mailing list