[PATCH] D54965: [obj2yaml] [COFF] Write RVA instead of VA for sections, fix roundtripping executables

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 29 12:57:10 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL347916: [obj2yaml] [COFF] Write RVA instead of VA for sections, fix roundtripping… (authored by mstorsjo, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D54965?vs=175547&id=175941#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54965/new/

https://reviews.llvm.org/D54965

Files:
  llvm/trunk/test/tools/yaml2obj/coff-arm64.yaml
  llvm/trunk/tools/obj2yaml/coff2yaml.cpp


Index: llvm/trunk/test/tools/yaml2obj/coff-arm64.yaml
===================================================================
--- llvm/trunk/test/tools/yaml2obj/coff-arm64.yaml
+++ llvm/trunk/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 @@
 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:         []
Index: llvm/trunk/tools/obj2yaml/coff2yaml.cpp
===================================================================
--- llvm/trunk/tools/obj2yaml/coff2yaml.cpp
+++ llvm/trunk/tools/obj2yaml/coff2yaml.cpp
@@ -147,7 +147,7 @@
     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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54965.175941.patch
Type: text/x-patch
Size: 2033 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181129/6b93e29c/attachment.bin>


More information about the llvm-commits mailing list