[PATCH] D74764: [yaml2obj] - Automatically assign sh_addr for allocatable sections.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 20 14:11:50 PST 2020


MaskRay added inline comments.


================
Comment at: llvm/lib/ObjectYAML/ELFEmitter.cpp:528
+  // It does not make sense and follows the behavior of a linker.
+  if (Doc.Header.Type.value == ELF::ET_REL)
+    return;
----------------
The two conditions can be combined.

sh_addr represents the address in the memory image of a process. Sections in a relocatable object file or non-allocatable sections do not need sh_addr assignment.


================
Comment at: llvm/test/tools/yaml2obj/ELF/section-address-assign.yaml:1
+## This test shows how yaml2obj automatically assigns virtual addresses for sections.
+
----------------
Test that yaml2obj automatically assigns sh_addr to allocatable sections for ET_EXEC/ET_DYN files.



(ET_CORE is possible but they don't usually have the section header table.)


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

https://reviews.llvm.org/D74764





More information about the llvm-commits mailing list