Skip to contentSkip to conversation

fio: a couple build fixes

PATCH Applied Eric Sandeen 2 participants 5 messages Jan 25, 2022 – Jan 26, 2022 Kbuild

lore
Share & tools
lore
#0 lore raw

cover fio: a couple build fixes

Maybe it's just me, but t/io_uring.c doesn't link for me without -laio when CONFIG_LIBAIO is set.

I also got a report that dynamic engines aren't properly picking up LDFLAGS set by the build system (in this case, -Wl,-z,now).

So these two patches try to resolve those issues.

#1 lore raw

PATCH 1/2 t/io_uring: link with libaio when necessary

When CONFIG_LIBAIO is enabled, we need t/io_uring to link with it. (libaio_LIBS only affects the aio engine, AFAICT.)

---

Makefile +1 -0
index 5d17bca..00e7953 100644
@@ -99,6 +99,7 @@ endif
 ifdef CONFIG_LIBAIO
   libaio_SRCS = engines/libaio.c
   cmdprio_SRCS = engines/cmdprio.c
+  LIBS += -laio
   libaio_LIBS = -laio
   ENGINES += libaio
 endif
#2 lore raw

PATCH 2/2 fio: use LDFLAGS when linking dynamic engines

In reply to Eric Sandeen

Without this, locally defined LDFLAGS won't be applied when linking the dynamically loaded IO engines.

---

Makefile +1 -1
index 5d17bca..00e7953 100644
@@ -294,7 +295,7 @@ define engine_template =
 $(1)_OBJS := $$($(1)_SRCS:.c=.o)
 $$($(1)_OBJS): CFLAGS := -fPIC $$($(1)_CFLAGS) $(CFLAGS)
 engines/fio-$(1).so: $$($(1)_OBJS)
-	$$(QUIET_LINK)$(CC) -shared -rdynamic -fPIC -Wl,-soname,fio-$(1).so.1 -o $$@ $$< $$($(1)_LIBS)
+	$$(QUIET_LINK)$(CC) $(LDFLAGS) -shared -rdynamic -fPIC -Wl,-soname,fio-$(1).so.1 -o $$@ $$< $$($(1)_LIBS)
 ENGS_OBJS += engines/fio-$(1).so
 endef
 else # !CONFIG_DYNAMIC_ENGINES
#3 lore raw

PATCH v2 2/2 fio: use LDFLAGS when linking dynamic engines

Without this, locally defined LDFLAGS won't be applied when linking the dynamically loaded IO engines.

---

V2: Seems like V1 inexplicably got whitespace damaged, sorry, let's try again :/

Makefile +1 -1
index 5d17bca..00e7953 100644
@@ -294,7 +295,7 @@ define engine_template =
 $(1)_OBJS := $$($(1)_SRCS:.c=.o)
 $$($(1)_OBJS): CFLAGS := -fPIC $$($(1)_CFLAGS) $(CFLAGS)
 engines/fio-$(1).so: $$($(1)_OBJS)
-	$$(QUIET_LINK)$(CC) -shared -rdynamic -fPIC -Wl,-soname,fio-$(1).so.1 -o $$@ $$< $$($(1)_LIBS)
+	$$(QUIET_LINK)$(CC) $(DYNAMIC) -shared -rdynamic -fPIC -Wl,-soname,fio-$(1).so.1 -o $$@ $$< $$($(1)_LIBS)
 ENGS_OBJS += engines/fio-$(1).so
 endef
 else # !CONFIG_DYNAMIC_ENGINES
Applied
#4 lore raw
In reply to Eric Sandeen
Quoted 7 lines · Eric Sandeen

Maybe it's just me, but t/io_uring.c doesn't link for me without -laio when CONFIG_LIBAIO is set.

I also got a report that dynamic engines aren't properly picking up LDFLAGS set by the build system (in this case, -Wl,-z,now).

So these two patches try to resolve those issues.

Applied, thanks Eric. On the patches, looks like format=flowed is set, which may explain why it ends up being borken.

Signature · 1 line
Jens Axboe