Skip to content

Commit

Permalink
dso: use uname -p to set arch name on *BSD
Browse files Browse the repository at this point in the history
  • Loading branch information
gportay committed Mar 12, 2024
1 parent 9697f20 commit 10e4efb
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 27 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ export IAMROOT_LIB_AARCH64_MUSL_AARCH64_1
IAMROOT_LIB_RISCV64_MUSL_RISCV64_1 ?= $(IAMROOT_LIB)
export IAMROOT_LIB_RISCV64_MUSL_RISCV64_1

IAMROOT_LIB_AMD64_ELF_1 ?= $(IAMROOT_LIB)
export IAMROOT_LIB_AMD64_ELF_1
IAMROOT_LIB_X86_64_ELF_1 ?= $(IAMROOT_LIB)
export IAMROOT_LIB_X86_64_ELF_1

IAMROOT_LIB_ARM64_ELF_1 ?= $(IAMROOT_LIB)
export IAMROOT_LIB_ARM64_ELF_1
IAMROOT_LIB_AARCH64_ELF_1 ?= $(IAMROOT_LIB)
export IAMROOT_LIB_AARCH64_ELF_1

IAMROOT_EXEC ?= $(CURDIR)/exec.sh
export IAMROOT_EXEC
Expand Down
14 changes: 2 additions & 12 deletions dso.c
Original file line number Diff line number Diff line change
Expand Up @@ -1859,23 +1859,13 @@ static const char *__machine(Elf64_Ehdr *ehdr, const char *ldso, int abi)
/* Assuming it is a *BSD */
return __set_errno(errno_save, "i386");
} else if (__is_x86_64(ehdr, ldso, abi)) {
if (__is_gnu_linux(ehdr, ldso, abi) ||
__is_musl(ehdr, ldso, abi))
return __set_errno(errno_save, "x86_64");

/* Assuming it is a *BSD */
return __set_errno(errno_save, "amd64");
return __set_errno(errno_save, "x86_64");
} else if (__is_arm(ehdr, ldso, abi)) {
return __set_errno(errno_save, "arm");
} else if (__is_armhf(ehdr, ldso, abi)) {
return __set_errno(errno_save, "armhf");
} else if (__is_aarch64(ehdr, ldso, abi)) {
if (__is_gnu_linux(ehdr, ldso, abi) ||
__is_musl(ehdr, ldso, abi))
return __set_errno(errno_save, "aarch64");

/* Assuming it is a *BSD */
return __set_errno(errno_save, "arm64");
return __set_errno(errno_save, "aarch64");
} else if (__is_aarch64_be(ehdr, ldso, abi)) {
return __set_errno(errno_save, "aarch64_be");
} else if (__is_riscv(ehdr, ldso, abi)) {
Expand Down
10 changes: 5 additions & 5 deletions support/freebsd.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
#

O ?= output
ARCH ?= $(shell uname -m 2>/dev/null)
ARCH ?= $(shell uname -p 2>/dev/null)

IAMROOT_LIB ?= $(CURDIR)/$(ARCH)/libiamroot-elf.so.1
export IAMROOT_LIB

IAMROOT_LIB_AMD64_ELF_1 ?= $(CURDIR)/$(ARCH)/libiamroot-elf.so.1
export IAMROOT_LIB_AMD64_ELF_1
IAMROOT_LIB_X86_64_ELF_1 ?= $(CURDIR)/$(ARCH)/libiamroot-elf.so.1
export IAMROOT_LIB_X86_64_ELF_1

IAMROOT_LIB_ARM64_ELF_1 ?= $(CURDIR)/$(ARCH)/libiamroot-elf.so.1
export IAMROOT_LIB_ARM64_ELF_1
IAMROOT_LIB_AARCH64_ELF_1 ?= $(CURDIR)/$(ARCH)/libiamroot-elf.so.1
export IAMROOT_LIB_AARCH64_ELF_1

IAMROOT_PATH_RESOLUTION_IGNORE ?= ^/dev/|^/etc/resolv.conf
export IAMROOT_PATH_RESOLUTION_IGNORE
Expand Down
10 changes: 5 additions & 5 deletions support/netbsd.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ PREFIX ?= /usr/pkg
export PREFIX

O ?= output
ARCH ?= $(shell uname -m 2>/dev/null)
ARCH ?= $(shell uname -p 2>/dev/null)

IAMROOT_LIB ?= $(CURDIR)/$(ARCH)/libiamroot.elf_so
export IAMROOT_LIB

IAMROOT_LIB_AMD64_ELF ?= $(CURDIR)/$(ARCH)/libiamroot.elf_so
export IAMROOT_LIB_AMD64_ELF
IAMROOT_LIB_X86_64_ELF ?= $(CURDIR)/$(ARCH)/libiamroot.elf_so
export IAMROOT_LIB_X86_64_ELF

IAMROOT_LIB_ARM64_ELF ?= $(CURDIR)/$(ARCH)/libiamroot.elf_so
export IAMROOT_LIB_ARM64_ELF
IAMROOT_LIB_AARCH64_ELF ?= $(CURDIR)/$(ARCH)/libiamroot.elf_so
export IAMROOT_LIB_AARCH64_ELF

IAMROOT_PATH_RESOLUTION_IGNORE ?= ^/dev/|^/proc/
export IAMROOT_PATH_RESOLUTION_IGNORE
Expand Down
2 changes: 1 addition & 1 deletion support/openbsd.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#

O ?= output
ARCH ?= $(shell uname -m 2>/dev/null)
ARCH ?= $(shell uname -p 2>/dev/null)

IAMROOT_LIB ?= $(CURDIR)/$(ARCH)/libiamroot.so
export IAMROOT_LIB
Expand Down

0 comments on commit 10e4efb

Please sign in to comment.