mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-02 16:56:50 +00:00
[mips][ias] Make section sizes a multiple of the alignment.
Reviewers: sdardis Subscribers: dsanders, llvm-commits, sdardis Differential Revision: http://reviews.llvm.org/D19008 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268036 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
931826ba5d
commit
ae3740223b
@ -518,6 +518,21 @@ void MipsTargetELFStreamer::finish() {
|
||||
DataSection.setAlignment(std::max(16u, DataSection.getAlignment()));
|
||||
BSSSection.setAlignment(std::max(16u, BSSSection.getAlignment()));
|
||||
|
||||
// Make sections sizes a multiple of the alignment.
|
||||
MCStreamer &OS = getStreamer();
|
||||
for (MCSection &S : MCA) {
|
||||
MCSectionELF &Section = static_cast<MCSectionELF &>(S);
|
||||
|
||||
unsigned Alignment = Section.getAlignment();
|
||||
if (Alignment) {
|
||||
OS.SwitchSection(&Section);
|
||||
if (Section.UseCodeAlign())
|
||||
OS.EmitCodeAlignment(Alignment, Alignment);
|
||||
else
|
||||
OS.EmitValueToAlignment(Alignment, 0, 1, Alignment);
|
||||
}
|
||||
}
|
||||
|
||||
const FeatureBitset &Features = STI.getFeatureBits();
|
||||
|
||||
// Update e_header flags. See the FIXME and comment above in
|
||||
|
@ -19,7 +19,7 @@
|
||||
; CHECK: 0x000000000000002c 3 0 1 0 0 is_stmt
|
||||
; CHECK: 0x000000000000003c 4 0 1 0 0 is_stmt
|
||||
; CHECK: 0x0000000000000048 5 0 1 0 0 is_stmt
|
||||
; CHECK: 0x0000000000000058 5 0 1 0 0 is_stmt end_sequence
|
||||
; CHECK: 0x0000000000000060 5 0 1 0 0 is_stmt end_sequence
|
||||
|
||||
|
||||
target datalayout = "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"
|
||||
|
106
test/MC/Mips/section-size.s
Normal file
106
test/MC/Mips/section-size.s
Normal file
@ -0,0 +1,106 @@
|
||||
# RUN: llvm-mc -triple mips-unknown-linux -filetype=obj %s | \
|
||||
# RUN: llvm-readobj -sections | FileCheck %s
|
||||
.section ".talign1", "ax"
|
||||
.p2align 4
|
||||
t1: .byte 1
|
||||
|
||||
.section ".talign2", "ax"
|
||||
.p2align 3
|
||||
t2: addiu $2, $2, 1
|
||||
addiu $2, $2, 1
|
||||
|
||||
.section ".talign3", "ax"
|
||||
.p2align 3
|
||||
t3: addiu $2, $2, 1
|
||||
|
||||
.section ".talign4", "ax"
|
||||
t4: .byte 1
|
||||
|
||||
.section ".dalign1", "a"
|
||||
.p2align 4
|
||||
d1: .byte 1
|
||||
|
||||
.section ".dalign2", "a"
|
||||
.p2align 3
|
||||
d2: .word 1
|
||||
.word 2
|
||||
|
||||
.section ".dalign3", "a"
|
||||
.p2align 3
|
||||
d3: .word 1
|
||||
|
||||
.section ".dalign4", "a"
|
||||
d4: .byte 1
|
||||
|
||||
.section ".dalign5", "a"
|
||||
.p2align 16
|
||||
d5: .word 1
|
||||
|
||||
.section ".nalign1", ""
|
||||
.p2align 4
|
||||
n1: .byte 1
|
||||
|
||||
.section ".nalign2", ""
|
||||
.p2align 3
|
||||
n2: .word 1
|
||||
.word 2
|
||||
|
||||
.section ".nalign3", ""
|
||||
.p2align 3
|
||||
n3: .word 1
|
||||
|
||||
.section ".nalign4", ""
|
||||
n4: .byte 1
|
||||
|
||||
# CHECK-LABEL: Name: .talign1
|
||||
# CHECK: Size: 16
|
||||
# CHECK: AddressAlignment: 16
|
||||
# CHECK-LABEL: }
|
||||
# CHECK-LABEL: Name: .talign2
|
||||
# CHECK: Size: 8
|
||||
# CHECK: AddressAlignment: 8
|
||||
# CHECK-LABEL: }
|
||||
# CHECK-LABEL: Name: .talign3
|
||||
# CHECK: Size: 8
|
||||
# CHECK: AddressAlignment: 8
|
||||
# CHECK-LABEL: }
|
||||
# CHECK-LABEL: Name: .talign4
|
||||
# CHECK: Size: 1
|
||||
# CHECK: AddressAlignment: 1
|
||||
# CHECK-LABEL: }
|
||||
# CHECK-LABEL: Name: .dalign1
|
||||
# CHECK: Size: 16
|
||||
# CHECK: AddressAlignment: 16
|
||||
# CHECK-LABEL: }
|
||||
# CHECK-LABEL: Name: .dalign2
|
||||
# CHECK: Size: 8
|
||||
# CHECK: AddressAlignment: 8
|
||||
# CHECK-LABEL: }
|
||||
# CHECK-LABEL: Name: .dalign3
|
||||
# CHECK: Size: 8
|
||||
# CHECK: AddressAlignment: 8
|
||||
# CHECK-LABEL: }
|
||||
# CHECK-LABEL: Name: .dalign4
|
||||
# CHECK: Size: 1
|
||||
# CHECK: AddressAlignment: 1
|
||||
# CHECK-LABEL: }
|
||||
# CHECK-LABEL: Name: .dalign5
|
||||
# CHECK: Size: 65536
|
||||
# CHECK: AddressAlignment: 65536
|
||||
# CHECK-LABEL: }
|
||||
# CHECK-LABEL: Name: .nalign1
|
||||
# CHECK: Size: 16
|
||||
# CHECK: AddressAlignment: 16
|
||||
# CHECK-LABEL: }
|
||||
# CHECK-LABEL: Name: .nalign2
|
||||
# CHECK: Size: 8
|
||||
# CHECK: AddressAlignment: 8
|
||||
# CHECK-LABEL: }
|
||||
# CHECK-LABEL: Name: .nalign3
|
||||
# CHECK: Size: 8
|
||||
# CHECK: AddressAlignment: 8
|
||||
# CHECK-LABEL: }
|
||||
# CHECK-LABEL: Name: .nalign4
|
||||
# CHECK: Size: 1
|
||||
# CHECK: AddressAlignment: 1
|
||||
# CHECK-LABEL: }
|
Loading…
Reference in New Issue
Block a user