Move elf class marker figuring to helper function, generalize a bit
- Determine arch-specific issues by looking at the elf header instead of compile-time #ifdefs, so we'll generate correct dependencies for non-native elf binaries too. Currently this is just alpha which despite being a 64bit system, never had the (64bit) markers in its dependencies. Of course alpha has pretty much already met its mark^H^H er maker by now, but doing the right thing is cheap... Also we'll need similar special cases sooner or later for other archs (such as x32).
This commit is contained in:
parent
e7489abd66
commit
f84a71cdc7
|
@ -35,6 +35,24 @@ static int skipPrivate(const char *s)
|
||||||
return (filter_private && rstreq(s, "GLIBC_PRIVATE"));
|
return (filter_private && rstreq(s, "GLIBC_PRIVATE"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *mkmarker(GElf_Ehdr *ehdr)
|
||||||
|
{
|
||||||
|
const char *marker = NULL;
|
||||||
|
|
||||||
|
if (ehdr->e_ident[EI_CLASS] == ELFCLASS64) {
|
||||||
|
switch (ehdr->e_machine) {
|
||||||
|
case EM_ALPHA:
|
||||||
|
case EM_FAKE_ALPHA:
|
||||||
|
/* alpha doesn't traditionally have 64bit markers */
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
marker = "(64bit)";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return marker;
|
||||||
|
}
|
||||||
|
|
||||||
static void addDep(ARGV_t *deps,
|
static void addDep(ARGV_t *deps,
|
||||||
const char *soname, const char *ver, const char *marker)
|
const char *soname, const char *ver, const char *marker)
|
||||||
{
|
{
|
||||||
|
@ -220,11 +238,7 @@ static int processFile(const char *fn, int dtype)
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
if (ehdr->e_type == ET_DYN || ehdr->e_type == ET_EXEC) {
|
if (ehdr->e_type == ET_DYN || ehdr->e_type == ET_EXEC) {
|
||||||
/* on alpha, everything is 64bit but we dont want the (64bit) markers */
|
ei->marker = mkmarker(ehdr);
|
||||||
#if !defined(__alpha__)
|
|
||||||
if (ehdr->e_ident[EI_CLASS] == ELFCLASS64)
|
|
||||||
ei->marker = "(64bit)";
|
|
||||||
#endif
|
|
||||||
ei->isDSO = (ehdr->e_type == ET_DYN);
|
ei->isDSO = (ehdr->e_type == ET_DYN);
|
||||||
ei->isExec = (st.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH));
|
ei->isExec = (st.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue