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

samba4: Files installed unstripped #16528

Open
daniel-santos opened this issue Sep 4, 2021 · 4 comments
Open

samba4: Files installed unstripped #16528

daniel-santos opened this issue Sep 4, 2021 · 4 comments

Comments

@daniel-santos
Copy link
Contributor

Maintainer: @Andy2244 (Andy Walsh andy.walsh44+github@gmail.com)
Environment: mipsel_24kc_musl (mt7620a) v21.02

Samba's executables are making it to squashfs unstripped. I'm running with -g3, so it was more noticeable:

debug_size               file
772181      (0x000bc855) build_dir/target-mipsel_24kc_musl/root-ramips/usr/bin/pdbedit
868903      (0x000d4227) build_dir/target-mipsel_24kc_musl/root-ramips/usr/bin/smbpasswd
994409      (0x000f2c69) build_dir/target-mipsel_24kc_musl/root-ramips/usr/sbin/smbd
1037067     (0x000fd30b) build_dir/target-mipsel_24kc_musl/root-ramips/usr/bin/nmblookup
1366895     (0x0014db6f) build_dir/target-mipsel_24kc_musl/root-ramips/usr/sbin/nmbd
@daniel-santos
Copy link
Contributor Author

Hrm, was using binutils 2.35.1 with strip --strip-unneeded --remove-section=.comment --remove-section=.note. When I run this manually, I get no change, so this is likely a binutils bug.

@daniel-santos
Copy link
Contributor Author

daniel-santos commented Sep 4, 2021

OK, so the problem still exists with binutils 2.32, so re-opening. Everything in my build_dir/target*/root-ramips directory is stripped except for samba4 and libperl.so. Being that I've built with CONFIG_DEBUG, the result is 129.5MiB of total debug information in my rootfs.

@daniel-santos daniel-santos reopened this Sep 4, 2021
@daniel-santos
Copy link
Contributor Author

Here's my ugly fix for you:

diff --git a/net/samba4/Makefile b/net/samba4/Makefile
index f3108fc58..af2c9296c 100644
--- a/net/samba4/Makefile
+++ b/net/samba4/Makefile
@@ -130,7 +130,7 @@ endef
 TARGET_CFLAGS += $(FPIC) -ffunction-sections -fdata-sections
 TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed
 # dont mess with sambas private rpath!
-RSTRIP:=:
+RSTRIP:=do_strip() { find $$$$* -type f -executable | xargs -d '\n' $(TARGET_CROSS)strip --strip-unneeded || true; }; do_strip
 
 CONFIGURE_VARS += \
        CPP="$(TARGET_CROSS)cpp" \

I think I should really clean up the whole stripping mechanism and present it upstream. You can't just run around and snip out crap you don't like at random. I argued last year about the --strip-all being wrong, but now I see why that isn't breaking things -- if the rstrip.sh script detects it's relocatable, it treats it like a kernel module -- ugly.

@Andy2244
Copy link
Contributor

Andy2244 commented Sep 8, 2021

Its related to this bug: #10783 and #10769

I had to disable the default rstrip script, since it breaks sambas private rpath.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants