summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pkg
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2013-07-28 20:11:31 +0000
committerbapt <bapt@FreeBSD.org>2013-07-28 20:11:31 +0000
commitf16e768e50423709f9626287ec69995168c94f28 (patch)
tree887cd49542206cdfceea9d770b949e635199f686 /usr.sbin/pkg
parentb5502dd6eeec6c12bfc55a19796d907f9a0aad45 (diff)
downloadFreeBSD-src-f16e768e50423709f9626287ec69995168c94f28.zip
FreeBSD-src-f16e768e50423709f9626287ec69995168c94f28.tar.gz
Fix detection of arm ABIs
Submitted by: andrew Obtained from: pkg git
Diffstat (limited to 'usr.sbin/pkg')
-rw-r--r--usr.sbin/pkg/config.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/usr.sbin/pkg/config.c b/usr.sbin/pkg/config.c
index 5924d57..142fd1b 100644
--- a/usr.sbin/pkg/config.c
+++ b/usr.sbin/pkg/config.c
@@ -108,7 +108,7 @@ pkg_get_myabi(char *dest, size_t sz)
Elf_Note note;
Elf_Scn *scn;
char *src, *osname;
- const char *abi;
+ const char *abi, *fpu;
GElf_Ehdr elfhdr;
GElf_Shdr shdr;
int fd, i, ret;
@@ -187,13 +187,25 @@ pkg_get_myabi(char *dest, size_t sz)
switch (elfhdr.e_machine) {
case EM_ARM:
+ /* FreeBSD doesn't support the hard-float ABI yet */
+ fpu = "softfp";
+ if ((elfhdr.e_flags & 0xFF000000) != 0) {
+ /* This is an EABI file, the conformance level is set */
+ abi = "eabi";
+ } else if (elfhdr.e_ident[EI_OSABI] != ELFOSABI_NONE) {
+ /*
+ * EABI executables all have this field set to
+ * ELFOSABI_NONE, therefore it must be an oabi file.
+ */
+ abi = "oabi";
+ } else {
+ ret = 1;
+ goto cleanup;
+ }
snprintf(dest + strlen(dest), sz - strlen(dest),
":%s:%s:%s", elf_corres_to_string(endian_corres,
(int)elfhdr.e_ident[EI_DATA]),
- (elfhdr.e_flags & EF_ARM_NEW_ABI) > 0 ?
- "eabi" : "oabi",
- (elfhdr.e_flags & EF_ARM_VFP_FLOAT) > 0 ?
- "softfp" : "vfp");
+ abi, fpu);
break;
case EM_MIPS:
/*
OpenPOWER on IntegriCloud