-
Couldn't load subscription status.
- Fork 15k
[llvm][yaml2obj] Modify section header overriding timing #130942
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
701efbe
f079240
9260c30
db32881
2b7f229
f943ab1
7908868
4d88fa5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -206,6 +206,9 @@ template <class ELFT> class ELFState { | |||||
| NameToIdxMap DynSymN2I; | ||||||
| ELFYAML::Object &Doc; | ||||||
|
|
||||||
| std::vector<std::pair<unsigned, ELFYAML::Section>> | ||||||
| SectionHeadersOverrideHelper; | ||||||
|
|
||||||
| StringSet<> ExcludedSectionHeaders; | ||||||
|
|
||||||
| uint64_t LocationCounter = 0; | ||||||
|
|
@@ -226,6 +229,7 @@ template <class ELFT> class ELFState { | |||||
| StringRef SecName, ELFYAML::Section *YAMLSec); | ||||||
| void initSectionHeaders(std::vector<Elf_Shdr> &SHeaders, | ||||||
| ContiguousBlobAccumulator &CBA); | ||||||
| void overrideSectionHeaders(std::vector<Elf_Shdr> &SHeaders); | ||||||
| void initSymtabSectionHeader(Elf_Shdr &SHeader, SymtabType STType, | ||||||
| ContiguousBlobAccumulator &CBA, | ||||||
| ELFYAML::Section *YAMLSec); | ||||||
|
|
@@ -845,7 +849,7 @@ void ELFState<ELFT>::initSectionHeaders(std::vector<Elf_Shdr> &SHeaders, | |||||
| } | ||||||
|
|
||||||
| LocationCounter += SHeader.sh_size; | ||||||
| overrideFields<ELFT>(Sec, SHeader); | ||||||
| SectionHeadersOverrideHelper.push_back({SN2I.get(Sec->Name), *Sec}); | ||||||
| continue; | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -899,12 +903,17 @@ void ELFState<ELFT>::initSectionHeaders(std::vector<Elf_Shdr> &SHeaders, | |||||
| } | ||||||
|
|
||||||
| LocationCounter += SHeader.sh_size; | ||||||
|
|
||||||
| // Override section fields if requested. | ||||||
| overrideFields<ELFT>(Sec, SHeader); | ||||||
| SectionHeadersOverrideHelper.push_back({SN2I.get(Sec->Name), *Sec}); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| template <class ELFT> | ||||||
| void ELFState<ELFT>::overrideSectionHeaders(std::vector<Elf_Shdr> &SHeaders) { | ||||||
| for (std::pair<unsigned, ELFYAML::Section> &IndexAndSec : | ||||||
| SectionHeadersOverrideHelper) | ||||||
| overrideFields<ELFT>(&IndexAndSec.second, SHeaders[IndexAndSec.first]); | ||||||
|
||||||
| } | ||||||
|
|
||||||
| template <class ELFT> | ||||||
| void ELFState<ELFT>::assignSectionAddress(Elf_Shdr &SHeader, | ||||||
| ELFYAML::Section *YAMLSec) { | ||||||
|
|
@@ -2090,6 +2099,9 @@ bool ELFState<ELFT>::writeELF(raw_ostream &OS, ELFYAML::Object &Doc, | |||||
| // Now we can decide segment offsets. | ||||||
| State.setProgramHeaderLayout(PHeaders, SHeaders); | ||||||
|
|
||||||
| // Override section fields if requested. | ||||||
|
||||||
| // Override section fields if requested. | |
| // Override section fields, if requested. This needs to happen after program header layout happens, because otherwise the layout will use the new values. |
(and reflow to column width rules of course)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm struggling to follow why you can't just store
SecandSHeaderin the vector (SHeaderas a pointer, obviously)?