summaryrefslogtreecommitdiff
path: root/ldso/libdl
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2016-12-08 04:36:10 +0100
committerWaldemar Brodkorb <wbx@openadk.org>2016-12-10 15:14:29 +0100
commit569914be2e968a1bda8b4982ca97c1524635174e (patch)
tree9075ea282b8f8463fa12d016b3111642b22bb5a2 /ldso/libdl
parent1f79f41508d0f9c30be812bea9b84fd7900a273e (diff)
fix static linking for FDPIC toolchains
Fixes following problem, when trying to compile a simple C application statically with a FDPIC toolchain (for example with Blackfin architecture): lib/libc.a(libdl.os): In function `do_dlclose': (.text+0x6be): undefined reference to `_dl_free' ..
Diffstat (limited to 'ldso/libdl')
-rw-r--r--ldso/libdl/libdl.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c
index 0cf3b7037..04d7c432c 100644
--- a/ldso/libdl/libdl.c
+++ b/ldso/libdl/libdl.c
@@ -30,6 +30,14 @@
*/
+/* When libdl is linked in statically into libc.a, we need to replace
+ * these symbols that otherwise would have been loaded in from ldso.
+ * This must be before including ldso.h */
+#ifndef SHARED
+#define _dl_malloc malloc
+#define _dl_free free
+#endif
+
#include <ldso.h>
#include <stdio.h>
#include <string.h>
@@ -86,9 +94,6 @@ extern char *_dl_debug;
#else /* !SHARED */
-#define _dl_malloc malloc
-#define _dl_free free
-
/* When libdl is linked as a static library, we need to replace all
* the symbols that otherwise would have been loaded in from ldso... */