Skip to content
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

emitElf::createLoadableSections uses hard-coded sh_info #405

Closed
nedwill opened this issue Sep 27, 2017 · 3 comments
Closed

emitElf::createLoadableSections uses hard-coded sh_info #405

nedwill opened this issue Sep 27, 2017 · 3 comments

Comments

@nedwill
Copy link
Contributor

nedwill commented Sep 27, 2017

sh_info should contain the number of needed versions for the verneed table, but instead always claims to have 2 needed versions. It looks like this was a regression when code in this area was refactored according to a git blame since this information is already in scope with verneednum.

On a shared library with more than 2 dependencies, this issue should present itself. The following patch fixes the problem for me:

diff --git a/symtabAPI/src/emitElf.C b/symtabAPI/src/emitElf.C
index 342e04d7e..46935067d 100644
--- a/symtabAPI/src/emitElf.C
+++ b/symtabAPI/src/emitElf.C
@@ -1438,7 +1438,7 @@ bool emitElf<ElfTypes>::createLoadableSections(Elf_Shdr *&shdr, unsigned &extraA
             newdata->d_align = 4;
             updateStrLinkShdr.push_back(newshdr);
             newshdr->sh_flags = SHF_ALLOC;
-            newshdr->sh_info = 2;
+            newshdr->sh_info = verneednum;
             updateDynamic(DT_VERNEED, newshdr->sh_addr);
         }
         else if (newSecs[i]->getRegionType() == Region::RT_SYMVERDEF) {
@wrwilliams
Copy link
Member

Looks good to me; mind submitting this as a PR so it gets a spin through Jenkins?

@wrwilliams
Copy link
Member

@nedwill ping? I really dislike copy-pasting contributor patches; it muddies proper attribution.

@nedwill
Copy link
Contributor Author

nedwill commented Dec 11, 2017

Sorry, I forgot to tend to this! I appreciate the sentiment. I'll take a look tonight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants