Skip to content

Commit

Permalink
linux: Use --as-needed when linking
Browse files Browse the repository at this point in the history
Using this flag will cause the linker to ignore any libraries
that have been listed on the command line but whose symbols are
not actually used.

Right now, it just gets rid of the unnecessary linking against
xcb-render (see https://bugs.debian.org/829709), but it might
catch missing dependencies in the future, and it will generally
keep the resulting binaries nice and tidy.

Ubuntu and Arch are both using --as-needed by default already,
and other distributions will probably switch at some point.
  • Loading branch information
andreabolognani committed Jul 5, 2016
1 parent 8578207 commit ac94511
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions linux/Makefile
Expand Up @@ -10,6 +10,7 @@ LIBVERSION = $(shell . $(CURDIR)/../lib/shlib_version; echo $$major.$$mino
LIBMAJORVERSION = $(shell . $(CURDIR)/../lib/shlib_version; echo $$major)

MAINT_CFLAGS = -std=c99 -Wmissing-prototypes -Wall -Wextra -Wshadow -Wno-uninitialized -g
MAINT_LDFLAGS = -Wl,--as-needed
MAINT_CPPFLAGS = -I. -D_GNU_SOURCE -DSWM_LIB=\"$(LIBDIR)/libswmhack.so.$(LIBVERSION)\"

ifneq ("${BUILDVERSION}", "")
Expand Down

0 comments on commit ac94511

Please sign in to comment.