diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-07-23 23:34:24 (GMT) |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-07-23 23:34:24 (GMT) |
commit | e03e1644dc22b012c11f8b4e548358a30c251e43 (patch) | |
tree | 20785ecfaea11b43fb3f579d52cc85e21efa88a2 /src/patchelf.cc | |
parent | 884413a71229866c29a370db3c94b3d93716960c (diff) | |
parent | 45fc82678d89f3912fe70047b00ac23c5449e266 (diff) | |
download | patchelf-e03e1644dc22b012c11f8b4e548358a30c251e43.zip patchelf-e03e1644dc22b012c11f8b4e548358a30c251e43.tar.gz patchelf-e03e1644dc22b012c11f8b4e548358a30c251e43.tar.bz2 |
Merge branch 'skip-missing' of https://github.com/ttuegel/patchelf
Diffstat (limited to 'src/patchelf.cc')
-rw-r--r-- | src/patchelf.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/patchelf.cc b/src/patchelf.cc index b80f0a7..ac77107 100644 --- a/src/patchelf.cc +++ b/src/patchelf.cc @@ -836,11 +836,18 @@ void ElfFile<ElfFileParamNames>::rewriteHeaders(Elf_Addr phdrAddress) /* no idea if this makes sense, but it was needed for some program */ if (!shdr) shdr = findSection2(".rel.got"); - if (!shdr) error("cannot find .rel.dyn or .rel.got"); + /* some programs have neither section, but this doesn't seem + to be a problem */ + if (!shdr) continue; + dyn->d_un.d_ptr = shdr->sh_addr; + } + else if (d_tag == DT_RELA) { + Elf_Shdr * shdr = findSection2(".rela.dyn"); + /* some programs lack this section, but it doesn't seem to + be a problem */ + if (!shdr) continue; dyn->d_un.d_ptr = shdr->sh_addr; } - else if (d_tag == DT_RELA) - dyn->d_un.d_ptr = findSection(".rela.dyn").sh_addr; /* PPC Linux */ else if (d_tag == DT_VERNEED) dyn->d_un.d_ptr = findSection(".gnu.version_r").sh_addr; else if (d_tag == DT_VERSYM) |