diff options
author | Martin Storsjo <martin@martin.st> | 2018-11-29 20:53:57 +0000 |
---|---|---|
committer | Martin Storsjo <martin@martin.st> | 2018-11-29 20:53:57 +0000 |
commit | c1410635bfa8979862606056b5fc1eb5db4840e5 (patch) | |
tree | ea9918a2c256849eb51061de9a3558e12aa0a341 | |
parent | 2b40470c6181c6b513146424fb963076114bbdd1 (diff) | |
download | bcm5719-llvm-c1410635bfa8979862606056b5fc1eb5db4840e5.tar.gz bcm5719-llvm-c1410635bfa8979862606056b5fc1eb5db4840e5.zip |
[obj2yaml] [COFF] Write RVA instead of VA for sections, fix roundtripping executables
yaml2obj writes the yaml value as is to the output file.
Differential Revision: https://reviews.llvm.org/D54965
llvm-svn: 347916
-rw-r--r-- | llvm/test/tools/yaml2obj/coff-arm64.yaml | 11 | ||||
-rw-r--r-- | llvm/tools/obj2yaml/coff2yaml.cpp | 2 |
2 files changed, 9 insertions, 4 deletions
diff --git a/llvm/test/tools/yaml2obj/coff-arm64.yaml b/llvm/test/tools/yaml2obj/coff-arm64.yaml index 9115082b8c2..d734e300c04 100644 --- a/llvm/test/tools/yaml2obj/coff-arm64.yaml +++ b/llvm/test/tools/yaml2obj/coff-arm64.yaml @@ -1,8 +1,13 @@ # RUN: yaml2obj %s -o %t # RUN: llvm-readobj -file-headers %t | FileCheck %s +# RUN: obj2yaml %t | FileCheck %s --check-prefix=ROUNDTRIP # CHECK: OptionalHeaderSize: 240 +# ROUNDTRIP: VirtualAddress: 4096 +# ROUNDTRIP: VirtualAddress: 8192 +# ROUNDTRIP: VirtualAddress: 12288 + --- !COFF OptionalHeader: AddressOfEntryPoint: 4096 @@ -72,17 +77,17 @@ header: sections: - Name: .text Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] - VirtualAddress: 1073745920 + VirtualAddress: 4096 VirtualSize: 4 SectionData: C0035FD6 - Name: .rdata Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ] - VirtualAddress: 1073750016 + VirtualAddress: 8192 VirtualSize: 12 SectionData: 0100400800000000E4E3E3E3 - Name: .pdata Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ] - VirtualAddress: 1073754112 + VirtualAddress: 12288 VirtualSize: 8 SectionData: '0010000000200000' symbols: [] diff --git a/llvm/tools/obj2yaml/coff2yaml.cpp b/llvm/tools/obj2yaml/coff2yaml.cpp index 57fb1d04075..6835dcf71ff 100644 --- a/llvm/tools/obj2yaml/coff2yaml.cpp +++ b/llvm/tools/obj2yaml/coff2yaml.cpp @@ -147,7 +147,7 @@ void COFFDumper::dumpSections(unsigned NumSections) { COFFYAML::Section NewYAMLSection; ObjSection.getName(NewYAMLSection.Name); NewYAMLSection.Header.Characteristics = COFFSection->Characteristics; - NewYAMLSection.Header.VirtualAddress = ObjSection.getAddress(); + NewYAMLSection.Header.VirtualAddress = COFFSection->VirtualAddress; NewYAMLSection.Header.VirtualSize = COFFSection->VirtualSize; NewYAMLSection.Header.NumberOfLineNumbers = COFFSection->NumberOfLinenumbers; |