summaryrefslogtreecommitdiffstats
path: root/llvm/tools/yaml2obj/yaml2elf.cpp
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2019-07-02 10:20:12 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2019-07-02 10:20:12 +0000
commit9df825f4297ff1cd716c8b5fc838166c99d3ee8c (patch)
treeaff7c72e7e6dfeef72a62e2e3e4761c3baed6466 /llvm/tools/yaml2obj/yaml2elf.cpp
parent7928fea4a75da7e48d13e5b165a3388b9667df25 (diff)
downloadbcm5719-llvm-9df825f4297ff1cd716c8b5fc838166c99d3ee8c.tar.gz
bcm5719-llvm-9df825f4297ff1cd716c8b5fc838166c99d3ee8c.zip
[yaml2obj] - Allow overriding sh_offset field from the YAML.
Some of our test cases are using objects which has sections with a broken sh_offset field. There was no way to set it from YAML until this patch. Differential revision: https://reviews.llvm.org/D63879 llvm-svn: 364898
Diffstat (limited to 'llvm/tools/yaml2obj/yaml2elf.cpp')
-rw-r--r--llvm/tools/yaml2obj/yaml2elf.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/tools/yaml2obj/yaml2elf.cpp b/llvm/tools/yaml2obj/yaml2elf.cpp
index e093ed8d72f..735057f6e7d 100644
--- a/llvm/tools/yaml2obj/yaml2elf.cpp
+++ b/llvm/tools/yaml2obj/yaml2elf.cpp
@@ -269,6 +269,11 @@ bool ELFState<ELFT>::initImplicitHeader(ELFState<ELFT> &State,
YAMLSec);
else
return false;
+
+ // Override the sh_offset field if requested.
+ if (YAMLSec && YAMLSec->ShOffset)
+ Header.sh_offset = *YAMLSec->ShOffset;
+
return true;
}
@@ -358,6 +363,10 @@ bool ELFState<ELFT>::initSectionHeaders(ELFState<ELFT> &State,
return false;
} else
llvm_unreachable("Unknown section type");
+
+ // Override the sh_offset field if requested.
+ if (Sec && Sec->ShOffset)
+ SHeader.sh_offset = *Sec->ShOffset;
}
return true;
OpenPOWER on IntegriCloud