summaryrefslogtreecommitdiffstats
path: root/libs/libfaketime/libfaketime-0.9.1-fix-as-needed.patch
blob: 39ef4ddafde6a89ce0e5728fd56689e7ba634c2c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From f0ee2ee1e0a2fa5f11614a55ab8543380faa9695 Mon Sep 17 00:00:00 2001
From: Lukas Fleischer <info@cryptocrack.de>
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 <info@cryptocrack.de>
---
 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