Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zfs 2.1.0 needlessly links in libatomic #12345

Closed
hvdijk opened this issue Jul 9, 2021 · 3 comments
Closed

zfs 2.1.0 needlessly links in libatomic #12345

hvdijk opened this issue Jul 9, 2021 · 3 comments
Labels
Type: Building Indicates an issue related to building binaries Type: Defect Incorrect behavior (e.g. crash, hang)

Comments

@hvdijk
Copy link
Contributor

hvdijk commented Jul 9, 2021

System information

Type Version/Name
Distribution Name
Distribution Version
Linux Kernel 5.13.1
Architecture x86_64 (x32)
ZFS Version 2.1.0
SPL Version

Describe the problem you're observing

zpool fails to start unless libatomic.so is present.

Describe how to reproduce the problem

Install zfs 2.1.0.

Include any warning/errors/backtraces from the system logs

N/A

https://github.com/openzfs/zfs/blob/master/config/user-libatomic.m4#L14 claims:

dnl # Technically, we could check if the platform *actually* needs -latomic,
dnl # or if it has native support for all the intrinsics we use,
dnl # but it /really/ doesn't matter, and C11 recommends to always link it.

It really does matter. When using zfs for the root partition, zfs needs to be installed on initramfs. initramfs should be small; it seems silly to force a shared library to be included there that is completely unused.

Workaround: build zfs in a chroot where libatomic.so is not available.

P.S.: The "C11 recommends to always link it" cannot be right, C11 does not acknowledge the existence of any libatomic library. I imagine it is intended to say something else, but I do not quite know what. It would be useful if this could be reworded.

@hvdijk hvdijk added Status: Triage Needed New issue which needs to be triaged Type: Defect Incorrect behavior (e.g. crash, hang) labels Jul 9, 2021
@behlendorf behlendorf added Type: Building Indicates an issue related to building binaries and removed Status: Triage Needed New issue which needs to be triaged labels Jul 13, 2021
@behlendorf
Copy link
Contributor

Thanks for filing this, it does seem like we could be a bit smarter about this. cc: @nabijaczleweli

nabijaczleweli added a commit to nabijaczleweli/zfs that referenced this issue Jul 13, 2021
In absence of LTO, and dynamic libatomic, la.so ends up in the needs
section of every toolchain executable; some consider this an issue

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes openzfs#12345
@nabijaczleweli
Copy link
Contributor

nabijaczleweli commented Jul 13, 2021

I mean, it's 31k, but I can see how that's an annoyance in absence of LTO; see #12359

@hvdijk
Copy link
Contributor Author

hvdijk commented Jul 13, 2021

Thanks, tested on top of 2.1.0 and can confirm it correctly detects that -latomic is not needed on my system, the resulting binaries are the same as when vanilla 2.1.0 is built in a chroot without libatomic.

behlendorf pushed a commit to behlendorf/zfs that referenced this issue Aug 23, 2021
In absence of LTO, and dynamic libatomic, la.so ends up in the needs
section of every toolchain executable; some consider this an issue.

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes openzfs#12345 
Closes openzfs#12359
behlendorf pushed a commit to behlendorf/zfs that referenced this issue Aug 24, 2021
In absence of LTO, and dynamic libatomic, la.so ends up in the needs
section of every toolchain executable; some consider this an issue.

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes openzfs#12345 
Closes openzfs#12359
behlendorf pushed a commit to behlendorf/zfs that referenced this issue Aug 24, 2021
In absence of LTO, and dynamic libatomic, la.so ends up in the needs
section of every toolchain executable; some consider this an issue.

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes openzfs#12345 
Closes openzfs#12359
behlendorf pushed a commit to behlendorf/zfs that referenced this issue Aug 24, 2021
In absence of LTO, and dynamic libatomic, la.so ends up in the needs
section of every toolchain executable; some consider this an issue.

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes openzfs#12345
Closes openzfs#12359
behlendorf pushed a commit that referenced this issue Aug 31, 2021
In absence of LTO, and dynamic libatomic, la.so ends up in the needs
section of every toolchain executable; some consider this an issue.

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12345
Closes #12359
tonyhutter pushed a commit to tonyhutter/zfs that referenced this issue Sep 15, 2021
In absence of LTO, and dynamic libatomic, la.so ends up in the needs
section of every toolchain executable; some consider this an issue.

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes openzfs#12345
Closes openzfs#12359
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Building Indicates an issue related to building binaries Type: Defect Incorrect behavior (e.g. crash, hang)
Projects
None yet
Development

No branches or pull requests

3 participants