summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/ObjectYAML/ELFEmitter.cpp8
-rw-r--r--llvm/lib/ObjectYAML/ELFYAML.cpp5
2 files changed, 9 insertions, 4 deletions
diff --git a/llvm/lib/ObjectYAML/ELFEmitter.cpp b/llvm/lib/ObjectYAML/ELFEmitter.cpp
index 44af64eadef..9c74d8ba205 100644
--- a/llvm/lib/ObjectYAML/ELFEmitter.cpp
+++ b/llvm/lib/ObjectYAML/ELFEmitter.cpp
@@ -292,8 +292,10 @@ bool ELFState<ELFT>::initImplicitHeader(ELFState<ELFT> &State,
else
return false;
- // Override the sh_offset/sh_size fields if requested.
+ // Override the fields if requested.
if (YAMLSec) {
+ if (YAMLSec->ShName)
+ Header.sh_name = *YAMLSec->ShName;
if (YAMLSec->ShOffset)
Header.sh_offset = *YAMLSec->ShOffset;
if (YAMLSec->ShSize)
@@ -395,8 +397,10 @@ bool ELFState<ELFT>::initSectionHeaders(ELFState<ELFT> &State,
} else
llvm_unreachable("Unknown section type");
- // Override the sh_offset/sh_size fields if requested.
+ // Override the fields if requested.
if (Sec) {
+ if (Sec->ShName)
+ SHeader.sh_name = *Sec->ShName;
if (Sec->ShOffset)
SHeader.sh_offset = *Sec->ShOffset;
if (Sec->ShSize)
diff --git a/llvm/lib/ObjectYAML/ELFYAML.cpp b/llvm/lib/ObjectYAML/ELFYAML.cpp
index 04084e990c0..6f05d7ddc1a 100644
--- a/llvm/lib/ObjectYAML/ELFYAML.cpp
+++ b/llvm/lib/ObjectYAML/ELFYAML.cpp
@@ -986,10 +986,11 @@ static void commonSectionMapping(IO &IO, ELFYAML::Section &Section) {
IO.mapOptional("EntSize", Section.EntSize);
// obj2yaml does not dump these fields. They are expected to be empty when we
- // are producing YAML, because yaml2obj sets appropriate values for sh_offset
- // and sh_size automatically when they are not explicitly defined.
+ // are producing YAML, because yaml2obj sets appropriate values for them
+ // automatically when they are not explicitly defined.
assert(!IO.outputting() ||
(!Section.ShOffset.hasValue() && !Section.ShSize.hasValue()));
+ IO.mapOptional("ShName", Section.ShName);
IO.mapOptional("ShOffset", Section.ShOffset);
IO.mapOptional("ShSize", Section.ShSize);
}
OpenPOWER on IntegriCloud