From: Harald Hoyer <har...@redhat.com> For libselinux and libcap the --as-needed linker flag does not seem to work. In fact, it seems to be turned off completly, if one of these libraries is used after --as-needed.
This patch reduces the amount of linked libraries. before: $ ldd /lib/systemd/systemd-timestamp linux-vdso.so.1 (0x00007fffe95ff000) libselinux.so.1 => /lib64/libselinux.so.1 (0x000000356d000000) libcap.so.2 => /lib64/libcap.so.2 (0x000000356d400000) librt.so.1 => /lib64/librt.so.1 (0x000000356cc00000) libc.so.6 => /lib64/libc.so.6 (0x000000356b400000) /lib64/ld-linux-x86-64.so.2 (0x000000356ac00000) libdl.so.2 => /lib64/libdl.so.2 (0x000000356bc00000) libattr.so.1 => /lib64/libattr.so.1 (0x000000357b000000) libpthread.so.0 => /lib64/libpthread.so.0 (0x000000356c000000) after: $ ldd systemd-timestamp linux-vdso.so.1 (0x00007fff4c333000) librt.so.1 => /lib64/librt.so.1 (0x000000356cc00000) libc.so.6 => /lib64/libc.so.6 (0x000000356b400000) /lib64/ld-linux-x86-64.so.2 (0x000000356ac00000) libpthread.so.0 => /lib64/libpthread.so.0 (0x000000356c000000) --- Makefile.am | 60 ++++++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 39 insertions(+), 21 deletions(-) diff --git a/Makefile.am b/Makefile.am index dabe32a..76e5329 100644 --- a/Makefile.am +++ b/Makefile.am @@ -631,10 +631,6 @@ libsystemd_basic_la_CFLAGS = \ $(AM_CFLAGS) \ $(SELINUX_CFLAGS) -libsystemd_basic_la_LIBADD = \ - $(SELINUX_LIBS) \ - $(CAP_LIBS) - libsystemd_core_la_SOURCES = \ src/unit.c \ src/job.c \ @@ -706,12 +702,13 @@ libsystemd_core_la_CFLAGS = \ libsystemd_core_la_LIBADD = \ libsystemd-basic.la \ + $(SELINUX_LIBS) \ $(DBUS_LIBS) \ $(UDEV_LIBS) \ $(LIBWRAP_LIBS) \ $(PAM_LIBS) \ $(AUDIT_LIBS) \ - $(CAP_LIBS) + $(CAP_LIBS) # This is needed because automake is buggy in how it generates the # rules for C programs, but not Vala programs. We therefore can't @@ -905,7 +902,8 @@ test_cgroup_CFLAGS = \ $(AM_CFLAGS) test_cgroup_LDADD = \ - libsystemd-basic.la + libsystemd-basic.la \ + $(SELINUX_LIBS) test_env_replace_SOURCES = \ src/test-env-replace.c @@ -934,7 +932,9 @@ test_login_CFLAGS = \ test_login_LDADD = \ libsystemd-basic.la \ - libsystemd-login.la + libsystemd-login.la \ + $(SELINUX_LIBS) \ + $(CAP_LIBS) test_install_SOURCES = \ src/test-install.c \ @@ -947,7 +947,8 @@ test_install_CFLAGS = \ $(DBUS_CFLAGS) test_install_LDADD = \ - libsystemd-basic.la + libsystemd-basic.la \ + $(SELINUX_LIBS) systemd_stdout_syslog_bridge_SOURCES = \ src/stdout-syslog-bridge.c \ @@ -993,7 +994,8 @@ systemd_random_seed_CFLAGS = \ $(AM_CFLAGS) systemd_random_seed_LDADD = \ - libsystemd-basic.la + libsystemd-basic.la \ + $(SELINUX_LIBS) systemd_shutdownd_SOURCES = \ src/utmp-wtmp.c \ @@ -1004,7 +1006,8 @@ systemd_shutdownd_CFLAGS = \ systemd_shutdownd_LDADD = \ libsystemd-basic.la \ - libsystemd-daemon.la + libsystemd-daemon.la \ + $(SELINUX_LIBS) systemd_hostnamed_SOURCES = \ src/hostnamed.c \ @@ -1032,7 +1035,8 @@ systemd_localed_CFLAGS = \ systemd_localed_LDADD = \ libsystemd-basic.la \ libsystemd-daemon.la \ - $(DBUS_LIBS) + $(DBUS_LIBS) \ + $(SELINUX_LIBS) dist_pkgdata_DATA = \ src/kbd-model-map @@ -1086,7 +1090,9 @@ systemd_logind_LDADD = \ libsystemd-daemon.la \ $(DBUS_LIBS) \ $(UDEV_LIBS) \ - $(ACL_LIBS) + $(ACL_LIBS) \ + $(CAP_LIBS) \ + $(SELINUX_LIBS) systemd_uaccess_SOURCES = \ src/uaccess.c @@ -1109,7 +1115,9 @@ systemd_uaccess_LDADD = \ libsystemd-daemon.la \ libsystemd-login.la \ $(UDEV_LIBS) \ - $(ACL_LIBS) + $(ACL_LIBS) \ + $(CAP_LIBS) \ + $(SELINUX_LIBS) systemd_shutdown_SOURCES = \ src/mount-setup.c \ @@ -1122,6 +1130,7 @@ systemd_shutdown_CFLAGS = \ systemd_shutdown_LDADD = \ libsystemd-basic.la \ + $(SELINUX_LIBS) \ $(UDEV_LIBS) systemd_modules_load_SOURCES = \ @@ -1140,7 +1149,8 @@ systemd_tmpfiles_CFLAGS = \ $(AM_CFLAGS) systemd_tmpfiles_LDADD = \ - libsystemd-basic.la + libsystemd-basic.la \ + $(SELINUX_LIBS) systemd_machine_id_setup_SOURCES = \ src/machine-id-setup.c \ @@ -1150,7 +1160,8 @@ systemd_machine_id_setup_CFLAGS = \ $(AM_CFLAGS) systemd_machine_id_setup_LDADD = \ - libsystemd-basic.la + libsystemd-basic.la \ + $(SELINUX_LIBS) systemd_sysctl_SOURCES = \ src/sysctl.c @@ -1234,7 +1245,8 @@ systemd_cryptsetup_CFLAGS = \ systemd_cryptsetup_LDADD = \ $(LIBCRYPTSETUP_LIBS) \ $(UDEV_LIBS) \ - libsystemd-basic.la + libsystemd-basic.la \ + $(SELINUX_LIBS) systemd_cryptsetup_generator_SOURCES = \ src/cryptsetup-generator.c \ @@ -1244,7 +1256,8 @@ systemd_cryptsetup_generator_CFLAGS = \ $(AM_CFLAGS) systemd_cryptsetup_generator_LDADD = \ - libsystemd-basic.la + libsystemd-basic.la \ + $(SELINUX_LIBS) systemd_getty_generator_SOURCES = \ src/getty-generator.c \ @@ -1254,7 +1267,8 @@ systemd_getty_generator_CFLAGS = \ $(AM_CFLAGS) systemd_getty_generator_LDADD = \ - libsystemd-basic.la + libsystemd-basic.la \ + $(SELINUX_LIBS) systemd_user_sessions_SOURCES = \ src/user-sessions.c \ @@ -1329,6 +1343,7 @@ systemctl_CFLAGS = \ systemctl_LDADD = \ libsystemd-basic.la \ libsystemd-daemon.la \ + $(SELINUX_LIBS) \ $(DBUS_LIBS) systemd_loginctl_SOURCES = \ @@ -1362,7 +1377,8 @@ systemd_ask_password_SOURCES = \ src/ask-password-api.c systemd_ask_password_LDADD = \ - libsystemd-basic.la + libsystemd-basic.la \ + $(SELINUX_LIBS) systemd_reply_password_SOURCES = \ src/reply-password.c @@ -1416,7 +1432,8 @@ systemd_nspawn_CFLAGS = \ systemd_nspawn_LDADD = \ libsystemd-basic.la \ - libsystemd-daemon.la + libsystemd-daemon.la \ + $(SELINUX_LIBS) systemd_stdio_bridge_SOURCES = \ src/bridge.c @@ -1479,7 +1496,8 @@ systemd_tty_ask_password_agent_SOURCES = \ src/utmp-wtmp.c systemd_tty_ask_password_agent_LDADD = \ - libsystemd-basic.la + libsystemd-basic.la \ + $(SELINUX_LIBS) pam_systemd_la_SOURCES = \ src/pam-module.c \ -- 1.7.6.4 _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel