forked from OSchip/llvm-project
Resubmit "Fix bug in PE/COFF plugin."
The original commit was actually 2 unrelated bug fixes, but it turns out the second bug fix wasn't quite correct, so the entire patch was reverted. Resubmitting this half of the patch by itself, then will follow up with a new patch which fixes the rest of the issue in a more appropriate way. llvm-svn: 346505
This commit is contained in:
parent
458b7c0b39
commit
9cad24a7ee
|
@ -0,0 +1,3 @@
|
||||||
|
target variable GlobalVariable
|
||||||
|
|
||||||
|
quit
|
|
@ -90,15 +90,15 @@ Anonymous<A::B::C<int>>::D AnonABCVoidD;
|
||||||
// CHECK: (TrivialS) TS = {}
|
// CHECK: (TrivialS) TS = {}
|
||||||
// CHECK: (TrivialU) TU = {}
|
// CHECK: (TrivialU) TU = {}
|
||||||
// CHECK: (TrivialE) TE = <Unable to determine byte size.>
|
// CHECK: (TrivialE) TE = <Unable to determine byte size.>
|
||||||
// CHECK: (A::B::C<int>) ABCInt = (ABCMember = <read memory from {{.*}} failed>)
|
// CHECK: (A::B::C<int>) ABCInt = (ABCMember = 0)
|
||||||
// CHECK: (A::B::C<float>) ABCFloat = (ABCMember = <read memory from {{.*}} failed>)
|
// CHECK: (A::B::C<float>) ABCFloat = (ABCMember = 0)
|
||||||
// CHECK: (A::B::C<void>) ABCVoid = (ABCSpecializationMember = <read memory from {{.*}} failed>)
|
// CHECK: (A::B::C<void>) ABCVoid = (ABCSpecializationMember = 0x0000000000000000)
|
||||||
// CHECK: (A::C<0>) AC0 = {}
|
// CHECK: (A::C<0>) AC0 = {}
|
||||||
// CHECK: (A::C<-1>) ACNeg1 = {}
|
// CHECK: (A::C<-1>) ACNeg1 = {}
|
||||||
// CHECK: (A::C<0>::D) AC0D = (ACDMember = <read memory from {{.*}} failed>, CPtr = <read memory from {{.*}} failed>)
|
// CHECK: (A::C<0>::D) AC0D = (ACDMember = 0, CPtr = 0x0000000000000000)
|
||||||
// CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember = <read memory from {{.*}} failed>, CPtr = <read memory from {{.*}} failed>)
|
// CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember = 0, CPtr = 0x0000000000000000)
|
||||||
// CHECK: (A::D) AD = {}
|
// CHECK: (A::D) AD = {}
|
||||||
// CHECK: (A::D::E) ADE = (ADDMember = <read memory from {{.*}} failed>)
|
// CHECK: (A::D::E) ADE = (ADDMember = 0)
|
||||||
// CHECK: Dumping clang ast for 1 modules.
|
// CHECK: Dumping clang ast for 1 modules.
|
||||||
// CHECK: TranslationUnitDecl {{.*}}
|
// CHECK: TranslationUnitDecl {{.*}}
|
||||||
// CHECK: |-CXXRecordDecl {{.*}} class TrivialC definition
|
// CHECK: |-CXXRecordDecl {{.*}} class TrivialC definition
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
// clang-format off
|
||||||
|
// REQUIRES: lld
|
||||||
|
|
||||||
|
// Make sure we can read variables from BSS
|
||||||
|
// RUN: clang-cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s
|
||||||
|
// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj
|
||||||
|
// RUN: llvm-readobj -s %t.exe | FileCheck --check-prefix=BSS %s
|
||||||
|
// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
|
||||||
|
// RUN: %p/Inputs/globals-bss.lldbinit 2>&1 | FileCheck %s
|
||||||
|
|
||||||
|
int GlobalVariable = 0;
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// BSS: Section {
|
||||||
|
// BSS: Number: 3
|
||||||
|
// BSS: Name: .data
|
||||||
|
// BSS-NEXT: VirtualSize: 0x4
|
||||||
|
// BSS-NEXT: VirtualAddress:
|
||||||
|
// BSS-NEXT: RawDataSize: 0
|
||||||
|
// BSS-NEXT: PointerToRawData: 0x0
|
||||||
|
// BSS-NEXT: PointerToRelocations: 0x0
|
||||||
|
// BSS-NEXT: PointerToLineNumbers: 0x0
|
||||||
|
// BSS-NEXT: RelocationCount: 0
|
||||||
|
// BSS-NEXT: LineNumberCount: 0
|
||||||
|
// BSS-NEXT: Characteristics [ (0xC0000040)
|
||||||
|
// BSS-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
|
||||||
|
// BSS-NEXT: IMAGE_SCN_MEM_READ (0x40000000)
|
||||||
|
// BSS-NEXT: IMAGE_SCN_MEM_WRITE (0x80000000)
|
||||||
|
// BSS-NEXT: ]
|
||||||
|
// BSS-NEXT: }
|
||||||
|
|
||||||
|
// CHECK: (int) GlobalVariable = 0
|
|
@ -710,7 +710,10 @@ void ObjectFilePECOFF::CreateSections(SectionList &unified_section_list) {
|
||||||
llvm::COFF::IMAGE_SCN_CNT_INITIALIZED_DATA &&
|
llvm::COFF::IMAGE_SCN_CNT_INITIALIZED_DATA &&
|
||||||
((const_sect_name == g_data_sect_name) ||
|
((const_sect_name == g_data_sect_name) ||
|
||||||
(const_sect_name == g_DATA_sect_name))) {
|
(const_sect_name == g_DATA_sect_name))) {
|
||||||
section_type = eSectionTypeData;
|
if (m_sect_headers[idx].size == 0 && m_sect_headers[idx].offset == 0)
|
||||||
|
section_type = eSectionTypeZeroFill;
|
||||||
|
else
|
||||||
|
section_type = eSectionTypeData;
|
||||||
} else if (m_sect_headers[idx].flags &
|
} else if (m_sect_headers[idx].flags &
|
||||||
llvm::COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA &&
|
llvm::COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA &&
|
||||||
((const_sect_name == g_bss_sect_name) ||
|
((const_sect_name == g_bss_sect_name) ||
|
||||||
|
@ -1053,6 +1056,7 @@ ObjectFile::Type ObjectFilePECOFF::CalculateType() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectFile::Strata ObjectFilePECOFF::CalculateStrata() { return eStrataUser; }
|
ObjectFile::Strata ObjectFilePECOFF::CalculateStrata() { return eStrataUser; }
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// PluginInterface protocol
|
// PluginInterface protocol
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue