diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2013-01-03 12:59:13 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2013-01-03 13:08:03 +0200 |
commit | f84a71cdc786a012fc9cbe16c5236c622ea970a4 (patch) | |
tree | ff06abb43cbe2a62890d8ee54ef2ca0122734094 /tools | |
parent | e7489abd6672e8c980d2d1b2ab32b963e1ea83b2 (diff) | |
download | rpm-f84a71cdc786a012fc9cbe16c5236c622ea970a4.tar.gz |
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).
Diffstat (limited to 'tools')
-rw-r--r-- | tools/elfdeps.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/tools/elfdeps.c b/tools/elfdeps.c index e501f1764..65ef4f511 100644 --- a/tools/elfdeps.c +++ b/tools/elfdeps.c @@ -35,6 +35,24 @@ static int skipPrivate(const char *s) 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, const char *soname, const char *ver, const char *marker) { @@ -220,11 +238,7 @@ static int processFile(const char *fn, int dtype) goto exit; if (ehdr->e_type == ET_DYN || ehdr->e_type == ET_EXEC) { -/* on alpha, everything is 64bit but we dont want the (64bit) markers */ -#if !defined(__alpha__) - if (ehdr->e_ident[EI_CLASS] == ELFCLASS64) - ei->marker = "(64bit)"; -#endif + ei->marker = mkmarker(ehdr); ei->isDSO = (ehdr->e_type == ET_DYN); ei->isExec = (st.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH)); |