Skip to contentSkip to conversation

daxctl: link against libndctl, in case its use doesn't get pruned

PATCH In review Adam Borowski 2 participants 3 messages Aug 1, 2019 – Aug 2, 2019 libnvdimm: non-volatile memory device

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 daxctl: link against libndctl, in case its use doesn't get pruned

util/json.c uses libndctl symbols, and is included by daxctl. These functions should then get pruned as unused, but on some platforms the toolchain fails to do so.

These platforms are ia64, hppa and 32-bit powerpc. It's generally a waste of our time to build ndctl there, but as the lack of a build-dependency requires annoying workarounds higher in the stack, this has been requested in https://bugs.debian.org/914348 -- and is trivially fixable on the ndctl side.

Thanks to -Wl,--as-needed there's no harm to architectures where the pruning works, thus let's not bother with detection.

As daxctl and libdaxctl are separate, there's no circular dependency.

---
 daxctl/Makefile.am | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
daxctl/Makefile.am +2 -1
index 94f73f9..a5487d6 100644
@@ -21,4 +21,5 @@ daxctl_LDADD =\
 	lib/libdaxctl.la \
 	../libutil.a \
 	$(UUID_LIBS) \
-	$(JSON_LIBS)
+	$(JSON_LIBS) \
+	../ndctl/lib/libndctl.la
Signature · 6 lines
2.23.0.rc0

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
maintainer
#1 lore raw
Quoted 13 lines · Adam Borowski

util/json.c uses libndctl symbols, and is included by daxctl. These functions should then get pruned as unused, but on some platforms the toolchain fails to do so.

These platforms are ia64, hppa and 32-bit powerpc. It's generally a waste of our time to build ndctl there, but as the lack of a build-dependency requires annoying workarounds higher in the stack, this has been requested in https://bugs.debian.org/914348 -- and is trivially fixable on the ndctl side.

Thanks to -Wl,--as-needed there's no harm to architectures where the pruning works, thus let's not bother with detection.

Quoted 6 lines

As daxctl and libdaxctl are separate, there's no circular dependency.

---
 daxctl/Makefile.am | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Hi Adam,

Thanks for the report and the patch - however, historically, we've avoided linking from daxctl to libndctl.

I think we can still avoid this by moving the libndctl users in util/json.c and util/filter.c into respective ndctl/util/ files.

The same goes for libdaxctl users in those files - they move into daxctl/util/

I think that would be a cleaner approach, and I can take a shot at making the split next week, however we're close to a v66 release, and it will have to be after that happens.

Perhaps the debian package can temporarily carry your patch for the archs that fail?

Thanks,
-Vishal

daxctl/Makefile.am daxctl_LDADD =\ · line 25

Quoted 12 lines
daxctl/Makefile.am +2 -1
index 94f73f9..a5487d6 100644
@@ -21,4 +21,5 @@ daxctl_LDADD =\
 	lib/libdaxctl.la \
 	../libutil.a \
 	$(UUID_LIBS) \
-	$(JSON_LIBS)
+	$(JSON_LIBS) \
+	../ndctl/lib/libndctl.la

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

#2 lore raw
Quoted 16 lines · Vishal L
Quoted 5 lines · Adam Borowski

util/json.c uses libndctl symbols, and is included by daxctl. These functions should then get pruned as unused, but on some platforms the toolchain fails to do so.

this has been requested in https://bugs.debian.org/914348

Thanks for the report and the patch - however, historically, we've avoided linking from daxctl to libndctl.

I think we can still avoid this by moving the libndctl users in util/json.c and util/filter.c into respective ndctl/util/ files.

The same goes for libdaxctl users in those files - they move into daxctl/util/

Quoted 6 lines

I think that would be a cleaner approach, and I can take a shot at making the split next week, however we're close to a v66 release, and it will have to be after that happens.

Perhaps the debian package can temporarily carry your patch for the archs that fail?

Sounds like a plan.

CCing the bug. Breno: could you please take this patch for v65 or v66, until it gets done a better (but more intrusive) way?

喵!

Signature · 8 lines
⢀⣴⠾⠻⢶⣦⠀ Latin:   meow 4 characters, 4 columns,  4 bytes
⣾⠁⢠⠒⠀⣿⡁ Greek:   μεου 4 characters, 4 columns,  8 bytes
⢿⡄⠘⠷⠚⠋  Runes:   ᛗᛖᛟᚹ 4 characters, 4 columns, 12 bytes
⠈⠳⣄⠀⠀⠀⠀ Chinese: 喵   1 character,  2 columns,  3 bytes <-- best!
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm