mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
Map ELf flags back to more specific section kinds.
With that, convert another llc -filetype=obj test. llvm-svn: 205031
This commit is contained in:
parent
77481e60fa
commit
b5253f1b62
@ -269,11 +269,37 @@ bool ELFAsmParser::ParseSectionName(StringRef &SectionName) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static SectionKind computeSectionKind(unsigned Flags) {
|
||||
static SectionKind computeSectionKind(unsigned Flags, unsigned ElemSize) {
|
||||
if (Flags & ELF::SHF_EXECINSTR)
|
||||
return SectionKind::getText();
|
||||
if (Flags & ELF::SHF_TLS)
|
||||
return SectionKind::getThreadData();
|
||||
if (Flags & ELF::SHF_MERGE) {
|
||||
if (Flags & ELF::SHF_STRINGS) {
|
||||
switch (ElemSize) {
|
||||
default:
|
||||
break;
|
||||
case 1:
|
||||
return SectionKind::getMergeable1ByteCString();
|
||||
case 2:
|
||||
return SectionKind::getMergeable2ByteCString();
|
||||
case 4:
|
||||
return SectionKind::getMergeable4ByteCString();
|
||||
}
|
||||
} else {
|
||||
switch (ElemSize) {
|
||||
default:
|
||||
break;
|
||||
case 4:
|
||||
return SectionKind::getMergeableConst4();
|
||||
case 8:
|
||||
return SectionKind::getMergeableConst8();
|
||||
case 16:
|
||||
return SectionKind::getMergeableConst16();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return SectionKind::getDataRel();
|
||||
}
|
||||
|
||||
@ -518,7 +544,7 @@ EndStmt:
|
||||
}
|
||||
}
|
||||
|
||||
SectionKind Kind = computeSectionKind(Flags);
|
||||
SectionKind Kind = computeSectionKind(Flags, Size);
|
||||
getStreamer().SwitchSection(getContext().getELFSection(SectionName, Type,
|
||||
Flags, Kind, Size,
|
||||
GroupName),
|
||||
|
@ -1,39 +0,0 @@
|
||||
; RUN: llc -filetype=obj -mtriple mipsel-unknown-linux %s -o - | llvm-readobj -t | FileCheck %s
|
||||
|
||||
; Check that the appropriate symbols were created.
|
||||
|
||||
; CHECK: Symbols [
|
||||
; CHECK: Symbol {
|
||||
; CHECK: Name: $.str
|
||||
; CHECK: }
|
||||
; CHECK: Symbol {
|
||||
; CHECK: Name: $.str1
|
||||
; CHECK: }
|
||||
; CHECK: Symbol {
|
||||
; CHECK: Name: $CPI0_0
|
||||
; CHECK: }
|
||||
; CHECK: Symbol {
|
||||
; CHECK: Name: $CPI0_1
|
||||
; CHECK: }
|
||||
; CHECK: ]
|
||||
|
||||
@.str = private unnamed_addr constant [6 x i8] c"abcde\00", align 1
|
||||
@gc1 = external global i8*
|
||||
@.str1 = private unnamed_addr constant [5 x i8] c"fghi\00", align 1
|
||||
@gc2 = external global i8*
|
||||
@gd1 = external global double
|
||||
@gd2 = external global double
|
||||
|
||||
define void @foo1() nounwind {
|
||||
entry:
|
||||
store i8* getelementptr inbounds ([6 x i8]* @.str, i32 0, i32 0), i8** @gc1, align 4
|
||||
store i8* getelementptr inbounds ([5 x i8]* @.str1, i32 0, i32 0), i8** @gc2, align 4
|
||||
%0 = load double* @gd1, align 8
|
||||
%add = fadd double %0, 2.500000e+00
|
||||
store double %add, double* @gd1, align 8
|
||||
%1 = load double* @gd2, align 8
|
||||
%add1 = fadd double %1, 4.500000e+00
|
||||
store double %add1, double* @gd2, align 8
|
||||
ret void
|
||||
}
|
||||
|
87
test/MC/Mips/elf-relsym.s
Normal file
87
test/MC/Mips/elf-relsym.s
Normal file
@ -0,0 +1,87 @@
|
||||
// RUN: llvm-mc -filetype=obj -triple mipsel-unknown-linux %s -o - | llvm-readobj -t | FileCheck %s
|
||||
|
||||
// Check that the appropriate symbols were created.
|
||||
|
||||
// CHECK: Symbols [
|
||||
// CHECK: Symbol {
|
||||
// CHECK: Name: $.str
|
||||
// CHECK: }
|
||||
// CHECK: Symbol {
|
||||
// CHECK: Name: $.str1
|
||||
// CHECK: }
|
||||
// CHECK: Symbol {
|
||||
// CHECK: Name: $CPI0_0
|
||||
// CHECK: }
|
||||
// CHECK: Symbol {
|
||||
// CHECK: Name: $CPI0_1
|
||||
// CHECK: }
|
||||
// CHECK: ]
|
||||
|
||||
.text
|
||||
.abicalls
|
||||
.section .mdebug.abi32,"",@progbits
|
||||
.file "/home/espindola/llvm/llvm/test/MC/Mips/elf-relsym.ll"
|
||||
.section .rodata.cst8,"aM",@progbits,8
|
||||
.align 3
|
||||
$CPI0_0:
|
||||
.8byte 4612811918334230528 # double 2.5
|
||||
$CPI0_1:
|
||||
.8byte 4616752568008179712 # double 4.5
|
||||
.text
|
||||
.globl foo1
|
||||
.align 2
|
||||
.type foo1,@function
|
||||
.set nomips16
|
||||
.ent foo1
|
||||
foo1: # @foo1
|
||||
.frame $sp,0,$ra
|
||||
.mask 0x00000000,0
|
||||
.fmask 0x00000000,0
|
||||
.set noreorder
|
||||
.set nomacro
|
||||
.set noat
|
||||
# BB#0: # %entry
|
||||
lui $2, %hi(_gp_disp)
|
||||
addiu $2, $2, %lo(_gp_disp)
|
||||
addu $1, $2, $25
|
||||
lw $2, %got($.str)($1)
|
||||
addiu $2, $2, %lo($.str)
|
||||
lw $3, %got(gc1)($1)
|
||||
sw $2, 0($3)
|
||||
lw $2, %got($.str1)($1)
|
||||
addiu $2, $2, %lo($.str1)
|
||||
lw $3, %got(gc2)($1)
|
||||
sw $2, 0($3)
|
||||
lw $2, %got($CPI0_0)($1)
|
||||
ldc1 $f0, %lo($CPI0_0)($2)
|
||||
lw $2, %got(gd1)($1)
|
||||
ldc1 $f2, 0($2)
|
||||
lw $3, %got($CPI0_1)($1)
|
||||
ldc1 $f4, %lo($CPI0_1)($3)
|
||||
lw $1, %got(gd2)($1)
|
||||
add.d $f0, $f2, $f0
|
||||
sdc1 $f0, 0($2)
|
||||
ldc1 $f0, 0($1)
|
||||
add.d $f0, $f0, $f4
|
||||
jr $ra
|
||||
sdc1 $f0, 0($1)
|
||||
.set at
|
||||
.set macro
|
||||
.set reorder
|
||||
.end foo1
|
||||
$tmp0:
|
||||
.size foo1, ($tmp0)-foo1
|
||||
|
||||
.type $.str,@object # @.str
|
||||
.section .rodata.str1.1,"aMS",@progbits,1
|
||||
$.str:
|
||||
.asciz "abcde"
|
||||
.size $.str, 6
|
||||
|
||||
.type $.str1,@object # @.str1
|
||||
$.str1:
|
||||
.asciz "fghi"
|
||||
.size $.str1, 5
|
||||
|
||||
|
||||
.text
|
Loading…
Reference in New Issue
Block a user