From: "Mike Frysinger" <vapier@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/pax-utils:master commit in: /
Date: Sun, 22 Jan 2017 17:59:32 +0000 (UTC) [thread overview]
Message-ID: <1479945678.b091c4764133a1eab7921809f3b4aee938faa194.vapier@gentoo> (raw)
commit: b091c4764133a1eab7921809f3b4aee938faa194
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 24 00:01:18 2016 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Nov 24 00:01:18 2016 +0000
URL: https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=b091c476
scanelf: standardize macro indentation levels
The style for indentation of ELF macros has drifted over time.
Realign them all to follow the same style. No functional changes.
scanelf.c | 509 +++++++++++++++++++++++++++++++-------------------------------
1 file changed, 254 insertions(+), 255 deletions(-)
diff --git a/scanelf.c b/scanelf.c
index 71288fc..5632527 100644
--- a/scanelf.c
+++ b/scanelf.c
@@ -690,114 +690,114 @@ static void scanelf_file_rpath(elfobj *elf, char *found_rpath, char **ret, size_
rpath = runpath = NULL;
#define SHOW_RPATH(B) \
- Elf ## B ## _Dyn *dyn; \
- Elf ## B ## _Ehdr *ehdr = EHDR ## B (elf->ehdr); \
- Elf ## B ## _Phdr *phdr = PHDR ## B (elf->phdr); \
- Elf ## B ## _Shdr *strtbl = SHDR ## B (strtbl_void); \
- Elf ## B ## _Off offset; \
- Elf ## B ## _Xword word; \
- /* Scan all the program headers */ \
- for (i = 0; i < EGET(ehdr->e_phnum); i++) { \
- /* Just scan dynamic headers */ \
- if (EGET(phdr[i].p_type) != PT_DYNAMIC || EGET(phdr[i].p_filesz) == 0) continue; \
- offset = EGET(phdr[i].p_offset); \
- if (offset >= elf->len - sizeof(Elf ## B ## _Dyn)) continue; \
- /* Just scan dynamic RPATH/RUNPATH headers */ \
- dyn = DYN ## B (elf->vdata + offset); \
- while ((word=EGET(dyn->d_tag)) != DT_NULL) { \
- if (word == DT_RPATH) { \
- r = &rpath; \
- } else if (word == DT_RUNPATH) { \
- r = &runpath; \
- } else { \
- ++dyn; \
- continue; \
+ Elf ## B ## _Dyn *dyn; \
+ Elf ## B ## _Ehdr *ehdr = EHDR ## B (elf->ehdr); \
+ Elf ## B ## _Phdr *phdr = PHDR ## B (elf->phdr); \
+ Elf ## B ## _Shdr *strtbl = SHDR ## B (strtbl_void); \
+ Elf ## B ## _Off offset; \
+ Elf ## B ## _Xword word; \
+ /* Scan all the program headers */ \
+ for (i = 0; i < EGET(ehdr->e_phnum); i++) { \
+ /* Just scan dynamic headers */ \
+ if (EGET(phdr[i].p_type) != PT_DYNAMIC || EGET(phdr[i].p_filesz) == 0) continue; \
+ offset = EGET(phdr[i].p_offset); \
+ if (offset >= elf->len - sizeof(Elf ## B ## _Dyn)) continue; \
+ /* Just scan dynamic RPATH/RUNPATH headers */ \
+ dyn = DYN ## B (elf->vdata + offset); \
+ while ((word=EGET(dyn->d_tag)) != DT_NULL) { \
+ if (word == DT_RPATH) { \
+ r = &rpath; \
+ } else if (word == DT_RUNPATH) { \
+ r = &runpath; \
+ } else { \
+ ++dyn; \
+ continue; \
+ } \
+ /* Verify the memory is somewhat sane */ \
+ offset = EGET(strtbl->sh_offset) + EGET(dyn->d_un.d_ptr); \
+ if (offset < (Elf ## B ## _Off)elf->len) { \
+ if (*r) warn("ELF has multiple %s's !?", get_elfdtype(word)); \
+ *r = elf->data + offset; \
+ /* cache the length in case we need to nuke this section later on */ \
+ if (fix_elf) \
+ offset = strlen(*r); \
+ /* If quiet, don't output paths in ld.so.conf */ \
+ if (be_quiet) { \
+ size_t len; \
+ char *start, *end; \
+ /* note that we only 'chop' off leading known paths. */ \
+ /* since *r is read-only memory, we can only move the ptr forward. */ \
+ start = *r; \
+ /* scan each path in : delimited list */ \
+ while (start) { \
+ rpath_security_checks(elf, start, get_elfdtype(word)); \
+ end = strchr(start, ':'); \
+ len = (end ? abs(end - start) : strlen(start)); \
+ if (use_ldcache) { \
+ size_t n; \
+ const char *ldpath; \
+ array_for_each(ldpaths, n, ldpath) \
+ if (!strncmp(ldpath, start, len) && !ldpath[len]) { \
+ *r = end; \
+ /* corner case ... if RPATH reads "/usr/lib:", we want \
+ * to show ':' rather than '' */ \
+ if (end && end[1] != '\0') \
+ (*r)++; \
+ break; \
+ } \
+ } \
+ if (!*r || !end) \
+ break; \
+ else \
+ start = start + len + 1; \
+ } \
} \
- /* Verify the memory is somewhat sane */ \
- offset = EGET(strtbl->sh_offset) + EGET(dyn->d_un.d_ptr); \
- if (offset < (Elf ## B ## _Off)elf->len) { \
- if (*r) warn("ELF has multiple %s's !?", get_elfdtype(word)); \
- *r = elf->data + offset; \
- /* cache the length in case we need to nuke this section later on */ \
- if (fix_elf) \
- offset = strlen(*r); \
- /* If quiet, don't output paths in ld.so.conf */ \
- if (be_quiet) { \
- size_t len; \
+ if (*r) { \
+ if (fix_elf > 2 || (fix_elf && **r == '\0')) { \
+ /* just nuke it */ \
+ nuke_it##B: \
+ memset(*r, 0x00, offset); \
+ *r = NULL; \
+ ESET(dyn->d_tag, DT_DEBUG); \
+ ESET(dyn->d_un.d_ptr, 0); \
+ } else if (fix_elf) { \
+ /* try to clean "bad" paths */ \
+ size_t len, tmpdir_len; \
char *start, *end; \
- /* note that we only 'chop' off leading known paths. */ \
- /* since *r is read-only memory, we can only move the ptr forward. */ \
+ const char *tmpdir; \
start = *r; \
- /* scan each path in : delimited list */ \
- while (start) { \
- rpath_security_checks(elf, start, get_elfdtype(word)); \
+ tmpdir = (getenv("TMPDIR") ? : "."); \
+ tmpdir_len = strlen(tmpdir); \
+ while (1) { \
end = strchr(start, ':'); \
- len = (end ? abs(end - start) : strlen(start)); \
- if (use_ldcache) { \
- size_t n; \
- const char *ldpath; \
- array_for_each(ldpaths, n, ldpath) \
- if (!strncmp(ldpath, start, len) && !ldpath[len]) { \
- *r = end; \
- /* corner case ... if RPATH reads "/usr/lib:", we want \
- * to show ':' rather than '' */ \
- if (end && end[1] != '\0') \
- (*r)++; \
- break; \
- } \
+ if (start == end) { \
+ eat_this_path##B: \
+ len = strlen(end); \
+ memmove(start, end+1, len); \
+ start[len-1] = '\0'; \
+ end = start - 1; \
+ } else if (tmpdir && !strncmp(start, tmpdir, tmpdir_len)) { \
+ if (!end) { \
+ if (start == *r) \
+ goto nuke_it##B; \
+ *--start = '\0'; \
+ } else \
+ goto eat_this_path##B; \
} \
- if (!*r || !end) \
+ if (!end) \
break; \
- else \
- start = start + len + 1; \
+ start = end + 1; \
} \
+ if (**r == '\0') \
+ goto nuke_it##B; \
} \
- if (*r) { \
- if (fix_elf > 2 || (fix_elf && **r == '\0')) { \
- /* just nuke it */ \
- nuke_it##B: \
- memset(*r, 0x00, offset); \
- *r = NULL; \
- ESET(dyn->d_tag, DT_DEBUG); \
- ESET(dyn->d_un.d_ptr, 0); \
- } else if (fix_elf) { \
- /* try to clean "bad" paths */ \
- size_t len, tmpdir_len; \
- char *start, *end; \
- const char *tmpdir; \
- start = *r; \
- tmpdir = (getenv("TMPDIR") ? : "."); \
- tmpdir_len = strlen(tmpdir); \
- while (1) { \
- end = strchr(start, ':'); \
- if (start == end) { \
- eat_this_path##B: \
- len = strlen(end); \
- memmove(start, end+1, len); \
- start[len-1] = '\0'; \
- end = start - 1; \
- } else if (tmpdir && !strncmp(start, tmpdir, tmpdir_len)) { \
- if (!end) { \
- if (start == *r) \
- goto nuke_it##B; \
- *--start = '\0'; \
- } else \
- goto eat_this_path##B; \
- } \
- if (!end) \
- break; \
- start = end + 1; \
- } \
- if (**r == '\0') \
- goto nuke_it##B; \
- } \
- if (*r) \
- *found_rpath = 1; \
- } \
+ if (*r) \
+ *found_rpath = 1; \
} \
- ++dyn; \
} \
- }
+ ++dyn; \
+ } \
+ }
if (elf->phdr && strtbl_void)
SCANELF_ELF_SIZED(SHOW_RPATH);
@@ -852,65 +852,65 @@ static const char *scanelf_file_needed_lib(elfobj *elf, char *found_needed, char
strtbl_void = elf_findsecbyname(elf, ".dynstr");
#define SHOW_NEEDED(B) \
- Elf ## B ## _Dyn *dyn; \
- Elf ## B ## _Ehdr *ehdr = EHDR ## B (elf->ehdr); \
- Elf ## B ## _Phdr *phdr = PHDR ## B (elf->phdr); \
- Elf ## B ## _Shdr *strtbl = SHDR ## B (strtbl_void); \
- Elf ## B ## _Off offset; \
- size_t matched = 0; \
- /* Walk all the program headers to find the PT_DYNAMIC */ \
- for (i = 0; i < EGET(ehdr->e_phnum); i++) { \
- if (EGET(phdr[i].p_type) != PT_DYNAMIC || EGET(phdr[i].p_filesz) == 0) \
- continue; \
- offset = EGET(phdr[i].p_offset); \
- if (offset >= elf->len - sizeof(Elf ## B ## _Dyn)) \
- continue; \
- /* Walk all the dynamic tags to find NEEDED entries */ \
- dyn = DYN ## B (elf->vdata + offset); \
- while (EGET(dyn->d_tag) != DT_NULL) { \
- if (EGET(dyn->d_tag) == DT_NEEDED) { \
- offset = EGET(strtbl->sh_offset) + EGET(dyn->d_un.d_ptr); \
- if (offset >= (Elf ## B ## _Off)elf->len) { \
- ++dyn; \
- continue; \
- } \
- needed = elf->data + offset; \
- if (op == 0) { \
- /* -n -> print all entries */ \
- if (!be_wewy_wewy_quiet) { \
- if (*found_needed) xchrcat(ret, ',', ret_len); \
- if (use_ldpath) { \
- if ((p = lookup_config_lib(needed)) != NULL) \
- needed = p; \
- } else if (use_ldcache) { \
- if ((p = ldso_cache_lookup_lib(elf, needed)) != NULL) \
- needed = p; \
- } \
- xstrcat(ret, needed, ret_len); \
- } \
- *found_needed = 1; \
- } else { \
- /* -N -> print matching entries */ \
- size_t n; \
- const char *find_lib_name; \
- \
- array_for_each(find_lib_arr, n, find_lib_name) { \
- int invert = 1; \
- if (find_lib_name[0] == '!') \
- invert = 0, ++find_lib_name; \
- if ((!strcmp(find_lib_name, needed)) == invert) \
- ++matched; \
- } \
- \
- if (matched == array_cnt(find_lib_arr)) { \
- *found_lib = 1; \
- return (be_wewy_wewy_quiet ? NULL : find_lib); \
+ Elf ## B ## _Dyn *dyn; \
+ Elf ## B ## _Ehdr *ehdr = EHDR ## B (elf->ehdr); \
+ Elf ## B ## _Phdr *phdr = PHDR ## B (elf->phdr); \
+ Elf ## B ## _Shdr *strtbl = SHDR ## B (strtbl_void); \
+ Elf ## B ## _Off offset; \
+ size_t matched = 0; \
+ /* Walk all the program headers to find the PT_DYNAMIC */ \
+ for (i = 0; i < EGET(ehdr->e_phnum); i++) { \
+ if (EGET(phdr[i].p_type) != PT_DYNAMIC || EGET(phdr[i].p_filesz) == 0) \
+ continue; \
+ offset = EGET(phdr[i].p_offset); \
+ if (offset >= elf->len - sizeof(Elf ## B ## _Dyn)) \
+ continue; \
+ /* Walk all the dynamic tags to find NEEDED entries */ \
+ dyn = DYN ## B (elf->vdata + offset); \
+ while (EGET(dyn->d_tag) != DT_NULL) { \
+ if (EGET(dyn->d_tag) == DT_NEEDED) { \
+ offset = EGET(strtbl->sh_offset) + EGET(dyn->d_un.d_ptr); \
+ if (offset >= (Elf ## B ## _Off)elf->len) { \
+ ++dyn; \
+ continue; \
+ } \
+ needed = elf->data + offset; \
+ if (op == 0) { \
+ /* -n -> print all entries */ \
+ if (!be_wewy_wewy_quiet) { \
+ if (*found_needed) xchrcat(ret, ',', ret_len); \
+ if (use_ldpath) { \
+ if ((p = lookup_config_lib(needed)) != NULL) \
+ needed = p; \
+ } else if (use_ldcache) { \
+ if ((p = ldso_cache_lookup_lib(elf, needed)) != NULL) \
+ needed = p; \
} \
+ xstrcat(ret, needed, ret_len); \
+ } \
+ *found_needed = 1; \
+ } else { \
+ /* -N -> print matching entries */ \
+ size_t n; \
+ const char *find_lib_name; \
+ \
+ array_for_each(find_lib_arr, n, find_lib_name) { \
+ int invert = 1; \
+ if (find_lib_name[0] == '!') \
+ invert = 0, ++find_lib_name; \
+ if ((!strcmp(find_lib_name, needed)) == invert) \
+ ++matched; \
+ } \
+ \
+ if (matched == array_cnt(find_lib_arr)) { \
+ *found_lib = 1; \
+ return (be_wewy_wewy_quiet ? NULL : find_lib); \
} \
} \
- ++dyn; \
} \
- }
+ ++dyn; \
+ } \
+ }
if (elf->phdr && strtbl_void) {
SCANELF_ELF_SIZED(SHOW_NEEDED);
if (op == 0 && !*found_needed && be_verbose)
@@ -928,23 +928,23 @@ static char *scanelf_file_interp(elfobj *elf, char *found_interp)
if (elf->phdr) {
/* Walk all the program headers to find the PT_INTERP */
#define SHOW_PT_INTERP(B) \
- size_t i; \
- Elf ## B ## _Ehdr *ehdr = EHDR ## B (elf->ehdr); \
- Elf ## B ## _Phdr *phdr = PHDR ## B (elf->phdr); \
- for (i = 0; i < EGET(ehdr->e_phnum); ++i) { \
- if (EGET(phdr[i].p_type) == PT_INTERP) { \
- offset = EGET(phdr[i].p_offset); \
- break; \
- } \
- }
+ size_t i; \
+ Elf ## B ## _Ehdr *ehdr = EHDR ## B (elf->ehdr); \
+ Elf ## B ## _Phdr *phdr = PHDR ## B (elf->phdr); \
+ for (i = 0; i < EGET(ehdr->e_phnum); ++i) { \
+ if (EGET(phdr[i].p_type) == PT_INTERP) { \
+ offset = EGET(phdr[i].p_offset); \
+ break; \
+ } \
+ }
SCANELF_ELF_SIZED(SHOW_PT_INTERP);
} else if (elf->shdr) {
/* Use the section headers to find it */
void *strtbl_void = elf_findsecbyname(elf, ".interp");
#define SHOW_INTERP(B) \
- Elf ## B ## _Shdr *strtbl = SHDR ## B (strtbl_void); \
- offset = EGET(strtbl->sh_offset);
+ Elf ## B ## _Shdr *strtbl = SHDR ## B (strtbl_void); \
+ offset = EGET(strtbl->sh_offset);
if (strtbl_void)
SCANELF_ELF_SIZED(SHOW_INTERP);
}
@@ -973,27 +973,27 @@ static const char *scanelf_file_bind(elfobj *elf, char *found_bind)
if (!elf->phdr) return NULL;
#define SHOW_BIND(B) \
- Elf ## B ## _Dyn *dyn; \
- Elf ## B ## _Ehdr *ehdr = EHDR ## B (elf->ehdr); \
- Elf ## B ## _Phdr *phdr = PHDR ## B (elf->phdr); \
- Elf ## B ## _Off offset; \
- for (i = 0; i < EGET(ehdr->e_phnum); i++) { \
- if (EGET(phdr[i].p_type) != PT_DYNAMIC || EGET(phdr[i].p_filesz) == 0) continue; \
- dynamic = true; \
- offset = EGET(phdr[i].p_offset); \
- if (offset >= elf->len - sizeof(Elf ## B ## _Dyn)) continue; \
- dyn = DYN ## B (elf->vdata + offset); \
- while (EGET(dyn->d_tag) != DT_NULL) { \
- if (EGET(dyn->d_tag) == DT_BIND_NOW || \
- (EGET(dyn->d_tag) == DT_FLAGS && EGET(dyn->d_un.d_val) & DF_BIND_NOW)) \
- { \
- if (be_quiet) return NULL; \
- *found_bind = 1; \
- return (char *)(be_wewy_wewy_quiet ? NULL : "NOW"); \
- } \
- ++dyn; \
+ Elf ## B ## _Dyn *dyn; \
+ Elf ## B ## _Ehdr *ehdr = EHDR ## B (elf->ehdr); \
+ Elf ## B ## _Phdr *phdr = PHDR ## B (elf->phdr); \
+ Elf ## B ## _Off offset; \
+ for (i = 0; i < EGET(ehdr->e_phnum); i++) { \
+ if (EGET(phdr[i].p_type) != PT_DYNAMIC || EGET(phdr[i].p_filesz) == 0) continue; \
+ dynamic = true; \
+ offset = EGET(phdr[i].p_offset); \
+ if (offset >= elf->len - sizeof(Elf ## B ## _Dyn)) continue; \
+ dyn = DYN ## B (elf->vdata + offset); \
+ while (EGET(dyn->d_tag) != DT_NULL) { \
+ if (EGET(dyn->d_tag) == DT_BIND_NOW || \
+ (EGET(dyn->d_tag) == DT_FLAGS && EGET(dyn->d_un.d_val) & DF_BIND_NOW)) \
+ { \
+ if (be_quiet) return NULL; \
+ *found_bind = 1; \
+ return (char *)(be_wewy_wewy_quiet ? NULL : "NOW"); \
} \
- }
+ ++dyn; \
+ } \
+ }
SCANELF_ELF_SIZED(SHOW_BIND);
if (be_wewy_wewy_quiet) return NULL;
@@ -1017,33 +1017,33 @@ static char *scanelf_file_soname(elfobj *elf, char *found_soname)
strtbl_void = elf_findsecbyname(elf, ".dynstr");
#define SHOW_SONAME(B) \
- Elf ## B ## _Dyn *dyn; \
- Elf ## B ## _Ehdr *ehdr = EHDR ## B (elf->ehdr); \
- Elf ## B ## _Phdr *phdr = PHDR ## B (elf->phdr); \
- Elf ## B ## _Shdr *strtbl = SHDR ## B (strtbl_void); \
- Elf ## B ## _Off offset; \
- /* only look for soname in shared objects */ \
- if (EGET(ehdr->e_type) != ET_DYN) \
- return NULL; \
- for (i = 0; i < EGET(ehdr->e_phnum); i++) { \
- if (EGET(phdr[i].p_type) != PT_DYNAMIC || EGET(phdr[i].p_filesz) == 0) continue; \
- offset = EGET(phdr[i].p_offset); \
- if (offset >= elf->len - sizeof(Elf ## B ## _Dyn)) continue; \
- dyn = DYN ## B (elf->vdata + offset); \
- while (EGET(dyn->d_tag) != DT_NULL) { \
- if (EGET(dyn->d_tag) == DT_SONAME) { \
- offset = EGET(strtbl->sh_offset) + EGET(dyn->d_un.d_ptr); \
- if (offset >= (Elf ## B ## _Off)elf->len) { \
- ++dyn; \
- continue; \
- } \
- soname = elf->data + offset; \
- *found_soname = 1; \
- return (be_wewy_wewy_quiet ? NULL : soname); \
+ Elf ## B ## _Dyn *dyn; \
+ Elf ## B ## _Ehdr *ehdr = EHDR ## B (elf->ehdr); \
+ Elf ## B ## _Phdr *phdr = PHDR ## B (elf->phdr); \
+ Elf ## B ## _Shdr *strtbl = SHDR ## B (strtbl_void); \
+ Elf ## B ## _Off offset; \
+ /* only look for soname in shared objects */ \
+ if (EGET(ehdr->e_type) != ET_DYN) \
+ return NULL; \
+ for (i = 0; i < EGET(ehdr->e_phnum); i++) { \
+ if (EGET(phdr[i].p_type) != PT_DYNAMIC || EGET(phdr[i].p_filesz) == 0) continue; \
+ offset = EGET(phdr[i].p_offset); \
+ if (offset >= elf->len - sizeof(Elf ## B ## _Dyn)) continue; \
+ dyn = DYN ## B (elf->vdata + offset); \
+ while (EGET(dyn->d_tag) != DT_NULL) { \
+ if (EGET(dyn->d_tag) == DT_SONAME) { \
+ offset = EGET(strtbl->sh_offset) + EGET(dyn->d_un.d_ptr); \
+ if (offset >= (Elf ## B ## _Off)elf->len) { \
+ ++dyn; \
+ continue; \
} \
- ++dyn; \
+ soname = elf->data + offset; \
+ *found_soname = 1; \
+ return (be_wewy_wewy_quiet ? NULL : soname); \
} \
- }
+ ++dyn; \
+ } \
+ }
if (elf->phdr && strtbl_void)
SCANELF_ELF_SIZED(SHOW_SONAME);
@@ -1226,39 +1226,38 @@ static char *scanelf_file_sym(elfobj *elf, char *found_sym)
scanelf_file_get_symtabs(elf, &symtab_void, &strtab_void);
- if (symtab_void && strtab_void) {
#define FIND_SYM(B) \
- Elf ## B ## _Shdr *symtab = SHDR ## B (symtab_void); \
- Elf ## B ## _Shdr *strtab = SHDR ## B (strtab_void); \
- Elf ## B ## _Sym *sym = SYM ## B (elf->vdata + EGET(symtab->sh_offset)); \
- Elf ## B ## _Word i, cnt = EGET(symtab->sh_entsize); \
- char *symname; \
- size_t ret_len = 0; \
- if (cnt) \
- cnt = EGET(symtab->sh_size) / cnt; \
- for (i = 0; i < cnt; ++i) { \
- if ((void *)sym >= elf->data_end - sizeof(*sym)) \
- goto break_out; \
- if (sym->st_name) { \
- /* make sure the symbol name is in acceptable memory range */ \
- symname = elf->data + EGET(strtab->sh_offset) + EGET(sym->st_name); \
- if (EGET(sym->st_name) >= (uint64_t)elf->len || \
- EGET(strtab->sh_offset) + EGET(sym->st_name) >= (uint64_t)elf->len || \
- !memchr(symname, 0, elf->len - EGET(strtab->sh_offset) + EGET(sym->st_name))) \
- goto break_out; \
- scanelf_match_symname(elf, found_sym, \
- &ret, &ret_len, symname, \
- ELF##B##_ST_TYPE(EGET(sym->st_info)), \
- ELF##B##_ST_BIND(EGET(sym->st_info)), \
- ELF##B##_ST_VISIBILITY(EGET(sym->st_other)), \
- EGET(sym->st_shndx), \
- /* st_size can be 64bit, but no one is really that big, so screw em */ \
- EGET(sym->st_size)); \
- } \
- ++sym; \
- }
- SCANELF_ELF_SIZED(FIND_SYM);
+ Elf ## B ## _Shdr *symtab = SHDR ## B (symtab_void); \
+ Elf ## B ## _Shdr *strtab = SHDR ## B (strtab_void); \
+ Elf ## B ## _Sym *sym = SYM ## B (elf->vdata + EGET(symtab->sh_offset)); \
+ Elf ## B ## _Word i, cnt = EGET(symtab->sh_entsize); \
+ char *symname; \
+ size_t ret_len = 0; \
+ if (cnt) \
+ cnt = EGET(symtab->sh_size) / cnt; \
+ for (i = 0; i < cnt; ++i) { \
+ if ((void *)sym >= elf->data_end - sizeof(*sym)) \
+ goto break_out; \
+ if (sym->st_name) { \
+ /* make sure the symbol name is in acceptable memory range */ \
+ symname = elf->data + EGET(strtab->sh_offset) + EGET(sym->st_name); \
+ if (EGET(sym->st_name) >= (uint64_t)elf->len || \
+ EGET(strtab->sh_offset) + EGET(sym->st_name) >= (uint64_t)elf->len || \
+ !memchr(symname, 0, elf->len - EGET(strtab->sh_offset) + EGET(sym->st_name))) \
+ goto break_out; \
+ scanelf_match_symname(elf, found_sym, \
+ &ret, &ret_len, symname, \
+ ELF##B##_ST_TYPE(EGET(sym->st_info)), \
+ ELF##B##_ST_BIND(EGET(sym->st_info)), \
+ ELF##B##_ST_VISIBILITY(EGET(sym->st_other)), \
+ EGET(sym->st_shndx), \
+ /* st_size can be 64bit, but no one is really that big, so screw em */ \
+ EGET(sym->st_size)); \
+ } \
+ ++sym; \
}
+ if (symtab_void && strtab_void)
+ SCANELF_ELF_SIZED(FIND_SYM);
if (be_wewy_wewy_quiet) {
free(ret);
@@ -1286,21 +1285,21 @@ static const char *scanelf_file_sections(elfobj *elf, char *found_section)
return NULL;
#define FIND_SECTION(B) \
- size_t matched, n; \
- int invert; \
- const char *section_name; \
- Elf ## B ## _Shdr *section; \
- \
- matched = 0; \
- array_for_each(find_section_arr, n, section_name) { \
- invert = (*section_name == '!' ? 1 : 0); \
- section = SHDR ## B (elf_findsecbyname(elf, section_name + invert)); \
- if ((section == NULL && invert) || (section != NULL && !invert)) \
- ++matched; \
- } \
- \
- if (matched == array_cnt(find_section_arr)) \
- *found_section = 1;
+ size_t matched, n; \
+ int invert; \
+ const char *section_name; \
+ Elf ## B ## _Shdr *section; \
+ \
+ matched = 0; \
+ array_for_each(find_section_arr, n, section_name) { \
+ invert = (*section_name == '!' ? 1 : 0); \
+ section = SHDR ## B (elf_findsecbyname(elf, section_name + invert)); \
+ if ((section == NULL && invert) || (section != NULL && !invert)) \
+ ++matched; \
+ } \
+ \
+ if (matched == array_cnt(find_section_arr)) \
+ *found_section = 1;
SCANELF_ELF_SIZED(FIND_SECTION);
if (be_wewy_wewy_quiet)
next reply other threads:[~2017-01-22 17:59 UTC|newest]
Thread overview: 253+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-22 17:59 Mike Frysinger [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-09-22 4:33 [gentoo-commits] proj/pax-utils:master commit in: / Sam James
2024-09-22 4:30 Sam James
2024-08-09 10:06 Sam James
2024-08-09 10:06 Sam James
2024-08-09 10:06 Sam James
2024-08-09 10:06 Sam James
2024-08-09 10:06 Sam James
2024-08-09 10:06 Sam James
2024-08-09 10:02 Sam James
2024-07-22 21:07 Mike Gilbert
2024-07-22 20:08 Mike Gilbert
2024-01-25 6:52 Mike Frysinger
2024-01-25 5:57 Mike Frysinger
2024-01-25 5:57 Mike Frysinger
2024-01-25 5:36 Mike Frysinger
2024-01-25 5:21 Mike Frysinger
2024-01-25 5:06 Mike Frysinger
2024-01-25 5:06 Mike Frysinger
2024-01-25 4:44 Mike Frysinger
2024-01-25 2:53 Mike Frysinger
2024-01-25 2:53 Mike Frysinger
2024-01-25 2:53 Mike Frysinger
2024-01-25 2:14 Mike Frysinger
2024-01-24 22:53 Mike Frysinger
2024-01-24 22:15 Mike Frysinger
2024-01-24 15:44 Mike Frysinger
2024-01-16 5:13 Mike Frysinger
2024-01-16 5:13 Mike Frysinger
2024-01-10 8:05 Mike Frysinger
2024-01-10 8:02 Mike Frysinger
2024-01-10 8:02 Mike Frysinger
2024-01-10 7:58 Mike Frysinger
2024-01-02 18:03 Mike Frysinger
2024-01-02 18:03 Mike Frysinger
2024-01-02 18:03 Mike Frysinger
2024-01-02 18:03 Mike Frysinger
2024-01-02 16:28 Mike Frysinger
2024-01-01 15:43 Mike Frysinger
2024-01-01 15:43 Mike Frysinger
2023-12-22 5:31 Mike Frysinger
2023-12-22 5:31 Mike Frysinger
2023-12-22 5:31 Mike Frysinger
2023-12-22 2:31 Mike Frysinger
2023-12-22 2:31 Mike Frysinger
2023-12-22 2:31 Mike Frysinger
2023-12-14 21:28 Mike Frysinger
2023-12-14 21:28 Mike Frysinger
2023-12-14 19:57 Mike Frysinger
2023-11-23 13:31 Sam James
2023-02-13 5:26 Sam James
2023-02-13 5:26 Sam James
2023-01-29 5:56 Sam James
2023-01-29 5:56 Sam James
2023-01-29 5:56 Sam James
2023-01-29 3:41 Sam James
2023-01-29 3:36 Sam James
2023-01-29 3:36 Sam James
2023-01-26 21:46 Sam James
2023-01-06 7:15 Sam James
2022-09-28 7:42 Mike Frysinger
2022-09-28 7:42 Mike Frysinger
2022-09-28 7:42 Mike Frysinger
2022-09-28 7:42 Mike Frysinger
2022-09-28 7:42 Mike Frysinger
2022-09-28 7:42 Mike Frysinger
2022-09-28 7:42 Mike Frysinger
2022-09-21 8:28 Mike Frysinger
2022-09-21 8:26 Mike Frysinger
2022-09-21 8:20 Mike Frysinger
2022-07-31 4:56 Sam James
2022-07-12 6:33 Sam James
2022-07-12 6:33 Sam James
2022-04-25 1:20 WANG Xuerui
2022-03-24 15:42 Sam James
2022-03-09 8:01 Mike Frysinger
2022-02-07 7:18 Fabian Groffen
2022-01-23 2:47 Mike Frysinger
2021-12-24 1:45 Sam James
2021-12-17 5:19 Mike Frysinger
2021-10-17 5:15 Mike Frysinger
2021-10-05 1:05 Mike Frysinger
2021-10-04 22:05 Mike Frysinger
2021-09-20 4:51 Sam James
2021-07-22 21:31 Sergei Trofimovich
2021-07-22 21:16 Sergei Trofimovich
2021-07-02 22:04 Sergei Trofimovich
2021-06-10 7:07 Sergei Trofimovich
2021-06-10 7:02 Sergei Trofimovich
2021-04-19 4:58 Mike Frysinger
2021-04-18 18:29 Mike Frysinger
2021-04-17 5:39 Mike Frysinger
2021-04-17 5:39 Mike Frysinger
2021-04-17 0:38 Mike Frysinger
2021-04-16 19:26 Mike Frysinger
2021-04-16 19:26 Mike Frysinger
2021-04-16 19:26 Mike Frysinger
2021-04-16 19:03 Mike Frysinger
2021-04-16 19:03 Mike Frysinger
2021-04-16 15:08 Mike Frysinger
2021-04-16 15:08 Mike Frysinger
2021-04-16 15:08 Mike Frysinger
2021-04-16 3:41 Mike Frysinger
2021-04-16 3:39 Mike Frysinger
2021-04-16 3:39 Mike Frysinger
2021-04-16 1:56 Mike Frysinger
2021-04-16 1:56 Mike Frysinger
2021-04-16 0:48 Mike Frysinger
2021-04-16 0:48 Mike Frysinger
2021-02-26 11:51 Sergei Trofimovich
2021-02-04 18:51 Sergei Trofimovich
2021-02-03 20:41 Sergei Trofimovich
2021-02-03 20:17 Sergei Trofimovich
2021-02-03 19:46 Sergei Trofimovich
2021-01-01 14:08 Fabian Groffen
2021-01-01 14:08 Fabian Groffen
2020-12-20 19:53 Sergei Trofimovich
2020-10-05 17:46 Sergei Trofimovich
2020-08-14 22:17 Sergei Trofimovich
2020-04-13 10:41 Sergei Trofimovich
2020-04-06 18:00 Sergei Trofimovich
2020-03-26 19:27 Mike Frysinger
2020-03-26 17:09 Mike Frysinger
2020-03-26 17:09 Mike Frysinger
2020-03-19 0:00 Sergei Trofimovich
2020-03-18 23:39 Sergei Trofimovich
2020-02-16 10:57 Sergei Trofimovich
2020-02-16 10:50 Sergei Trofimovich
2020-02-16 10:48 Sergei Trofimovich
2020-02-16 10:17 Sergei Trofimovich
2019-01-14 22:53 Sergei Trofimovich
2018-11-19 22:20 Sergei Trofimovich
2018-06-07 14:09 Mike Frysinger
2018-06-07 14:09 Mike Frysinger
2018-06-07 14:09 Mike Frysinger
2018-06-07 14:09 Mike Frysinger
2018-06-07 14:09 Mike Frysinger
2018-06-07 14:09 Mike Frysinger
2018-06-07 14:09 Mike Frysinger
2018-06-07 14:09 Mike Frysinger
2018-06-07 14:09 Mike Frysinger
2018-06-07 4:44 Mike Frysinger
2018-06-07 4:44 Mike Frysinger
2018-06-07 4:44 Mike Frysinger
2018-02-24 10:16 Sergei Trofimovich
2017-09-18 9:27 Fabian Groffen
2017-09-18 9:27 Fabian Groffen
2017-09-18 7:06 Fabian Groffen
2017-03-14 7:19 Mike Frysinger
2017-02-16 21:24 Mike Frysinger
2017-02-16 21:24 Mike Frysinger
2017-02-16 21:24 Mike Frysinger
2017-02-11 7:06 Mike Frysinger
2017-02-01 23:08 Mike Frysinger
2017-02-01 23:08 Mike Frysinger
2017-02-01 23:08 Mike Frysinger
2017-01-24 20:39 Mike Frysinger
2017-01-24 20:39 Mike Frysinger
2017-01-24 6:50 Mike Frysinger
2017-01-24 6:50 Mike Frysinger
2017-01-24 6:50 Mike Frysinger
2017-01-24 6:50 Mike Frysinger
2017-01-22 17:59 Mike Frysinger
2017-01-22 17:59 Mike Frysinger
2017-01-22 17:59 Mike Frysinger
2017-01-22 17:59 Mike Frysinger
2017-01-22 17:59 Mike Frysinger
2017-01-22 17:59 Mike Frysinger
2017-01-22 17:59 Mike Frysinger
2017-01-22 17:59 Mike Frysinger
2016-11-27 3:43 Mike Frysinger
2016-11-15 4:02 Mike Frysinger
2016-11-15 4:02 Mike Frysinger
2016-11-14 14:57 Mike Frysinger
2016-11-12 7:15 Mike Frysinger
2016-11-12 7:15 Mike Frysinger
2016-11-12 7:15 Mike Frysinger
2016-11-12 7:15 Mike Frysinger
2016-11-12 7:15 Mike Frysinger
2016-11-12 7:15 Mike Frysinger
2016-11-08 20:47 Mike Gilbert
2016-06-20 17:46 Mike Frysinger
2016-06-20 4:03 Mike Frysinger
2016-06-20 4:03 Mike Frysinger
2016-06-20 3:22 Mike Frysinger
2016-06-20 3:22 Mike Frysinger
2016-06-20 3:08 Mike Frysinger
2016-06-20 3:08 Mike Frysinger
2016-06-20 3:08 Mike Frysinger
2016-06-20 3:08 Mike Frysinger
2016-06-20 3:08 Mike Frysinger
2016-06-20 3:08 Mike Frysinger
2016-06-20 3:08 Mike Frysinger
2016-06-20 3:08 Mike Frysinger
2016-06-20 3:08 Mike Frysinger
2016-06-20 3:08 Mike Frysinger
2016-06-20 3:08 Mike Frysinger
2016-05-31 22:27 Mike Frysinger
2016-03-03 21:15 Mike Frysinger
2016-02-10 19:41 Mike Frysinger
2016-02-10 18:54 Mike Frysinger
2016-01-28 22:42 Mike Frysinger
2016-01-03 22:23 Mike Frysinger
2016-01-03 22:23 Mike Frysinger
2016-01-03 22:01 Mike Frysinger
2016-01-02 15:26 Mike Frysinger
2016-01-02 3:52 Mike Frysinger
2015-12-19 19:41 Mike Frysinger
2015-12-17 3:24 Mike Frysinger
2015-12-17 3:24 Mike Frysinger
2015-12-17 3:24 Mike Frysinger
2015-12-17 3:24 Mike Frysinger
2015-12-12 22:45 Mike Frysinger
2015-12-12 22:45 Mike Frysinger
2015-12-12 22:45 Mike Frysinger
2015-12-12 22:45 Mike Frysinger
2015-12-12 22:45 Mike Frysinger
2015-12-12 22:45 Mike Frysinger
2015-11-26 8:43 Mike Frysinger
2015-10-26 4:35 Mike Frysinger
2015-10-08 20:31 Mike Frysinger
2015-09-19 6:27 Mike Frysinger
2015-09-19 6:27 Mike Frysinger
2015-09-12 4:17 Mike Frysinger
2015-08-28 0:33 Mike Frysinger
2015-08-26 6:29 Mike Frysinger
2015-08-24 21:22 Mike Frysinger
2015-08-24 21:22 Mike Frysinger
2015-08-24 21:22 Mike Frysinger
2015-08-20 14:39 Mike Frysinger
2015-08-20 14:39 Mike Frysinger
2015-08-20 14:39 Mike Frysinger
2015-08-20 14:33 Mike Frysinger
2015-08-20 14:33 Mike Frysinger
2015-08-20 13:32 Mike Frysinger
2015-08-18 15:56 Mike Frysinger
2015-08-18 15:35 Mike Frysinger
2015-08-18 15:35 Mike Frysinger
2015-08-18 14:39 Mike Frysinger
2015-08-18 14:38 Mike Frysinger
2015-07-13 9:14 Mike Frysinger
2015-07-13 9:14 Mike Frysinger
2015-07-13 9:14 Mike Frysinger
2015-05-24 3:22 Mike Frysinger
2015-03-29 20:07 Mike Frysinger
2015-03-29 20:07 Mike Frysinger
2015-03-29 20:07 Mike Frysinger
2015-03-10 5:31 Mike Frysinger
2015-03-10 5:31 Mike Frysinger
2015-03-10 4:19 Mike Frysinger
2015-03-10 3:36 Mike Frysinger
2015-03-06 11:52 Mike Frysinger
2015-03-04 22:35 Mike Frysinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1479945678.b091c4764133a1eab7921809f3b4aee938faa194.vapier@gentoo \
--to=vapier@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox