dnsmasq: export tftp root to the procd jail
[openwrt.git] / toolchain / musl / patches / 020-ldso-fix-GDB-dynamic-linker-info-on-MIPS.patch
1 From: Felix Fietkau <nbd@openwrt.org>
2 Date: Sat, 30 Jan 2016 19:19:08 +0100
3 Subject: [PATCH] ldso: fix GDB dynamic linker info on MIPS
4
5 GDB is looking for a pointer to the ldso debug info in the data of the
6 .rld_map section.
7
8 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
9 ---
10
11 --- a/arch/mips/reloc.h
12 +++ b/arch/mips/reloc.h
13 @@ -24,7 +24,7 @@
14  #define REL_TPOFF       R_MIPS_TLS_TPREL32
15  
16  #define NEED_MIPS_GOT_RELOCS 1
17 -#define DYNAMIC_IS_RO 1
18 +#define DT_DEBUG_INDIRECT DT_MIPS_RLD_MAP
19  #define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT))
20  
21  #define CRTJMP(pc,sp) __asm__ __volatile__( \
22 --- a/ldso/dynlink.c
23 +++ b/ldso/dynlink.c
24 @@ -1582,11 +1582,14 @@ _Noreturn void __dls3(size_t *sp)
25         load_deps(&app);
26         make_global(&app);
27  
28 -#ifndef DYNAMIC_IS_RO
29 -       for (i=0; app.dynv[i]; i+=2)
30 -               if (app.dynv[i]==DT_DEBUG)
31 +       for (i=0; app.dynv[i]; i+=2) {
32 +               if (!DT_DEBUG_INDIRECT && app.dynv[i]==DT_DEBUG)
33                         app.dynv[i+1] = (size_t)&debug;
34 -#endif
35 +               if (DT_DEBUG_INDIRECT && app.dynv[i]==DT_DEBUG_INDIRECT) {
36 +                       size_t *ptr = (size_t *) app.dynv[i+1];
37 +                       *ptr = (size_t)&debug;
38 +               }
39 +       }
40  
41         /* The main program must be relocated LAST since it may contin
42          * copy relocations which depend on libraries' relocations. */
43 --- a/src/internal/dynlink.h
44 +++ b/src/internal/dynlink.h
45 @@ -83,6 +83,10 @@ struct fdpic_dummy_loadmap {
46  #define NEED_MIPS_GOT_RELOCS 0
47  #endif
48  
49 +#ifndef DT_DEBUG_INDIRECT
50 +#define DT_DEBUG_INDIRECT 0
51 +#endif
52 +
53  #define AUX_CNT 32
54  #define DYN_CNT 32
55