mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-21 06:30:16 +00:00
MC: Treat ReadOnlyWithRel and ReadOnlyWithRelLocal as ReadOnly for COFF
A problem with our old behavior becomes observable under x86-64 COFF when we need a read-only GV which has an initializer which is referenced using a relocation: we would mark the section as writable. Marking the section as writable interferes with section merging. This fixes PR21009. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218179 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c16105b078
commit
3f34ae97b9
@ -761,7 +761,7 @@ getCOFFSectionFlags(SectionKind K) {
|
||||
COFF::IMAGE_SCN_MEM_EXECUTE |
|
||||
COFF::IMAGE_SCN_MEM_READ |
|
||||
COFF::IMAGE_SCN_CNT_CODE;
|
||||
else if (K.isBSS ())
|
||||
else if (K.isBSS())
|
||||
Flags |=
|
||||
COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA |
|
||||
COFF::IMAGE_SCN_MEM_READ |
|
||||
@ -771,7 +771,7 @@ getCOFFSectionFlags(SectionKind K) {
|
||||
COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
|
||||
COFF::IMAGE_SCN_MEM_READ |
|
||||
COFF::IMAGE_SCN_MEM_WRITE;
|
||||
else if (K.isReadOnly())
|
||||
else if (K.isReadOnly() || K.isReadOnlyWithRel())
|
||||
Flags |=
|
||||
COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
|
||||
COFF::IMAGE_SCN_MEM_READ;
|
||||
|
@ -51,7 +51,7 @@ void MCSectionCOFF::PrintSwitchToSection(const MCAsmInfo &MAI,
|
||||
OS << 'x';
|
||||
else if (getKind().isBSS())
|
||||
OS << 'b';
|
||||
if (getKind().isWriteable())
|
||||
if (getKind().isWriteable() && !getKind().isReadOnlyWithRel())
|
||||
OS << 'w';
|
||||
else
|
||||
OS << 'r';
|
||||
|
8
test/MC/COFF/const-gv-with-rel-init.ll
Normal file
8
test/MC/COFF/const-gv-with-rel-init.ll
Normal file
@ -0,0 +1,8 @@
|
||||
; RUN: llc -mtriple x86_64-pc-windows-msvc < %s | FileCheck %s
|
||||
|
||||
define void @f() {
|
||||
ret void
|
||||
}
|
||||
|
||||
@ptr = constant void ()* @f, section ".CRT$XLB", align 8
|
||||
; CHECK: .section .CRT$XLB,"rd"
|
Loading…
x
Reference in New Issue
Block a user