summaryrefslogtreecommitdiff
path: root/src/internal
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2015-09-22 03:54:42 +0000
committerRich Felker <dalias@aerifal.cx>2015-09-22 03:54:42 +0000
commit7a9669e977e5f750cf72ccbd2614f8b72ce02c4c (patch)
treed06ed21dee895141171fda5d73998df3d1cb9282 /src/internal
parent3958144ede01a7e64a56c0430f053bfd80ff02eb (diff)
downloadmusl-7a9669e977e5f750cf72ccbd2614f8b72ce02c4c.tar.gz
add general fdpic support in dynamic linker and arch support for sh
at this point not all functionality is complete. the dynamic linker itself, and main app if it is also loaded by the kernel, take advantage of fdpic and do not need constant displacement between segments, but additional libraries loaded by the dynamic linker follow normal ELF semantics for mapping still. this fully works, but does not admit shared text on nommu. in terms of actual functional correctness, dlsym's results are presently incorrect for function symbols, RTLD_NEXT fails to identify the caller correctly, and dladdr fails almost entirely. with the dynamic linker entry point working, support for static pie is automatically included, but linking the main application as ET_DYN (pie) probably does not make sense for fdpic anyway. ET_EXEC is equally relocatable but more efficient at representing relocations.
Diffstat (limited to 'src/internal')
-rw-r--r--src/internal/dynlink.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/internal/dynlink.h b/src/internal/dynlink.h
index 369f183e..b9333926 100644
--- a/src/internal/dynlink.h
+++ b/src/internal/dynlink.h
@@ -49,16 +49,27 @@ struct fdpic_loadmap {
struct fdpic_loadseg segs[];
};
+struct fdpic_dummy_loadmap {
+ unsigned short version, nsegs;
+ struct fdpic_loadseg segs[1];
+};
+
#include "reloc.h"
-#define IS_RELATIVE(x) ( \
+#ifndef DL_FDPIC
+#define DL_FDPIC 0
+#endif
+
+#if !DL_FDPIC
+#define IS_RELATIVE(x,s) ( \
(R_TYPE(x) == REL_RELATIVE) || \
(R_TYPE(x) == REL_SYM_OR_REL && !R_SYM(x)) )
-
-#define IS_FDPIC_RELATIVE(x,s) ( ( \
+#else
+#define IS_RELATIVE(x,s) ( ( \
(R_TYPE(x) == REL_FUNCDESC_VAL) || \
(R_TYPE(x) == REL_SYMBOLIC) ) \
&& (((s)[R_SYM(x)].st_info & 0xf) == STT_SECTION) )
+#endif
#ifndef NEED_MIPS_GOT_RELOCS
#define NEED_MIPS_GOT_RELOCS 0