Having fixed the other archs, arm's now the last arch that doesn't pass 
&_DYNAMIC to _dl_boot_bind().  This is the diff I'm running with, moving 
up the calculation of &_GLOBAL_OFFSET_TABLE_ slightly and then using 
_DYNAMIC(GOTOFF) to get the address we want from there.  Is there a better 
way, or should I just commit this?


Philip


Index: arm/ldasm.S
===================================================================
RCS file: /cvs/src/libexec/ld.so/arm/ldasm.S,v
retrieving revision 1.22
diff -u -p -r1.22 ldasm.S
--- arm/ldasm.S 7 May 2016 19:05:23 -0000       1.22
+++ arm/ldasm.S 7 Aug 2016 03:07:57 -0000
@@ -41,6 +41,12 @@ ENTRY(_dl_start)
        mov     r0, fp                          @ original stack
        mov     r1, r7                          @ dl_data
 
+       ldr     r8, .L_GOT                      @ calculate address of GOT...
+1:     add     r8, pc, r8                      @ into r8
+
+       ldr     r2, .L__DYNAMIC                 @ &_DYNAMIC
+       add     r2, r2, r8 
+
        bl      _dl_boot_bind
 
        add     r0, r5, #4                      @ argv
@@ -56,14 +62,13 @@ ENTRY(_dl_start)
        mov     lr, r6
 
        mov     r1, r0
-       ldr     r2, .L_GOT
-1:
-       add     r2, pc, r2
        ldr     r0, .L_dl_dtors
-       add     r0, r0, r2 
+       add     r0, r0, r8 
        mov     pc, r1
 .L_GOT:
        .long   _GLOBAL_OFFSET_TABLE_-(1b+8)
+.L__DYNAMIC:
+       .long   _DYNAMIC(GOTOFF)
 .L_dl_dtors:
        .long   _dl_dtors(GOTOFF)
 
Index: boot.c
===================================================================
RCS file: /cvs/src/libexec/ld.so/boot.c,v
retrieving revision 1.12
diff -u -p -r1.12 boot.c
--- boot.c      7 Aug 2016 03:05:23 -0000       1.12
+++ boot.c      7 Aug 2016 03:07:57 -0000
@@ -126,12 +126,7 @@ _dl_boot_bind(const long sp, long *dl_da
         * Scan the DYNAMIC section for the loader.
         * Cache the data for easier access.
         */
-
-#if defined(__arm__)
-       dynp = (Elf_Dyn *)((long)_DYNAMIC + loff);
-#else
        dynp = dynamicp;
-#endif
 
        _dl_memset(&dynld, 0, sizeof(dynld));
        while (dynp->d_tag != DT_NULL) {

Reply via email to