[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/8] ELF unexec: Symbol table patching
From: |
Alan Modra |
Subject: |
[PATCH 4/8] ELF unexec: Symbol table patching |
Date: |
Mon, 2 Nov 2015 12:26:46 +1030 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
No st_shndx value larger than SHN_LORESERVE should be changed.
* unexelf.c (unexec): Don't adjust any st_shndx larger than
SHN_LORESERVE. Error on SHN_XINDEX.
diff --git a/src/unexelf.c b/src/unexelf.c
index 0065491..286ba2e 100644
--- a/src/unexelf.c
+++ b/src/unexelf.c
@@ -1118,7 +1118,7 @@ temacs:
}
#endif /* __sgi */
- /* If it is the symbol table, its st_shndx field needs to be patched. */
+ /* Patch st_shndx field of symbol table. */
if (new_shdr->sh_type == SHT_SYMTAB
|| new_shdr->sh_type == SHT_DYNSYM)
{
@@ -1126,9 +1126,10 @@ temacs:
ElfW (Sym) *sym = (ElfW (Sym) *) (new_shdr->sh_offset + new_base);
for (; num--; sym++)
{
- if ((sym->st_shndx == SHN_UNDEF)
- || (sym->st_shndx == SHN_ABS)
- || (sym->st_shndx == SHN_COMMON))
+ if (sym->st_shndx == SHN_XINDEX)
+ fatal ("SHT_SYMTAB_SHNDX unsupported");
+ if (sym->st_shndx == SHN_UNDEF
+ || sym->st_shndx >= SHN_LORESERVE)
continue;
PATCH_INDEX (sym->st_shndx);
--
Alan Modra
Australia Development Lab, IBM
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH 4/8] ELF unexec: Symbol table patching,
Alan Modra <=