Skip to contentSkip to conversation

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

PATCH In review Jan Beulich 2 participants 2 messages Aug 11, 2022

lore
Share & tools
lore
#0 lore raw

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

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.

---
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).

config/FreeBSD.mk +2 -0
@@ -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
config/OpenBSD.mk +2 -0
@@ -1 +1,3 @@
 include $(XEN_ROOT)/config/StdGNU.mk
+
+LDFLAGS_DIRECT_OpenBSD = _obsd
config/x86_32.mk +0 -2
@@ -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
config/x86_64.mk +1 -9
@@ -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
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Jan Beulich

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.

Quoted 4 lines

---
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.