From f0ee2ee1e0a2fa5f11614a55ab8543380faa9695 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Sun, 22 Jan 2012 21:47:52 +0100 Subject: [PATCH] Fix linking with "-Wl,--as-needed" Reorder linker flags in order to ensure proper linking when using "--Wl,--as-needed". Read http://www.gentoo.org/proj/en/qa/asneeded.xml, especially "Importance of linking order" for details: Basically, what the linker does is look for the symbols missing in a given file (either an object file, a static archive or a library) only in the files coming after it. When using the normal linking, without --as-needed, this is not a problem, although there might be some internal drawbacks on the linking stage, the files are linked together without considering ordering. But with the flag, the libraries that aren't used for resolving symbols are discarded and thus not linked. Signed-off-by: Lukas Fleischer --- src/Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/Makefile b/src/Makefile index 9118815..d4a04b5 100644 --- a/src/Makefile +++ b/src/Makefile @@ -69,7 +69,7 @@ ${OBJ}: faketime.c ${CC} -o $@ -c ${CFLAGS} ${EXTRA_FLAGS} $< lib%.so.${SONAME}: %.o - ${CC} -o $@ -Wl,-soname,$@ ${LDFLAGS} $< + ${CC} -o $@ -Wl,-soname,$@ $< ${LDFLAGS} clean: @rm -f ${OBJ} ${LIBS} -- 1.7.8.4