[PATCH] config/x86: tidy {Free,Open}BSD LDFLAGS_DIRECT handling

Jan Beulich posted 1 patch 1 year, 8 months ago
Failed in applying to current master (apply log)
[PATCH] config/x86: tidy {Free,Open}BSD LDFLAGS_DIRECT handling
Posted by Jan Beulich 1 year, 8 months ago
It's not clear why for x86-64 a different approach was used than the
(shorter) one x86-32 has been using. Move the LDFLAGS_DIRECT_*BSD
setting to the respective OS files and reuse x86-32's approach for
x86-64.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
I was actually inclined to go further and rename the variable(s) as
well, to e.g. XEN_ELF_SUB_FLAVOR, at the same time eliminating the
indirection via $(XEN_OS).

--- a/config/FreeBSD.mk
+++ b/config/FreeBSD.mk
@@ -1,5 +1,7 @@
 include $(XEN_ROOT)/config/StdGNU.mk
 
+LDFLAGS_DIRECT_FreeBSD = _fbsd
+
 # No wget on FreeBSD base system
 WGET = ftp
 PKG_INSTALLDIR = ${prefix}/libdata/pkgconfig
--- a/config/OpenBSD.mk
+++ b/config/OpenBSD.mk
@@ -1 +1,3 @@
 include $(XEN_ROOT)/config/StdGNU.mk
+
+LDFLAGS_DIRECT_OpenBSD = _obsd
--- a/config/x86_32.mk
+++ b/config/x86_32.mk
@@ -8,8 +8,6 @@ CONFIG_XCUTILS := y
 CFLAGS += -m32 -march=i686
 
 # Use only if calling $(LD) directly.
-LDFLAGS_DIRECT_OpenBSD = _obsd
-LDFLAGS_DIRECT_FreeBSD = _fbsd
 LDFLAGS_DIRECT += -melf_i386$(LDFLAGS_DIRECT_$(XEN_OS))
 
 IOEMU_CPU_ARCH ?= i386
--- a/config/x86_64.mk
+++ b/config/x86_64.mk
@@ -14,14 +14,6 @@ SunOS_LIBDIR = $(SunOS_LIBDIR_x86_64)
 EFI_DIR ?= /usr/lib64/efi
 
 # Use only if calling $(LD) directly.
-ifeq ($(XEN_OS),OpenBSD)
-LDFLAGS_DIRECT += -melf_x86_64_obsd
-else
-ifeq ($(XEN_OS),FreeBSD)
-LDFLAGS_DIRECT += -melf_x86_64_fbsd
-else
-LDFLAGS_DIRECT += -melf_x86_64
-endif
-endif
+LDFLAGS_DIRECT += -melf_x86_64$(LDFLAGS_DIRECT_$(XEN_OS))
 
 IOEMU_CPU_ARCH ?= x86_64
Re: [PATCH] config/x86: tidy {Free,Open}BSD LDFLAGS_DIRECT handling
Posted by Andrew Cooper 1 year, 8 months ago
On 11/08/2022 13:14, Jan Beulich wrote:
> It's not clear why for x86-64 a different approach was used than the
> (shorter) one x86-32 has been using. Move the LDFLAGS_DIRECT_*BSD
> setting to the respective OS files and reuse x86-32's approach for
> x86-64.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>

> ---
> I was actually inclined to go further and rename the variable(s) as
> well, to e.g. XEN_ELF_SUB_FLAVOR, at the same time eliminating the
> indirection via $(XEN_OS).

Yeah, that looks neater.  My ack stands either way.