[email protected] wrote:
> As the former comment suggested, I added the HAVE_RELATIVE_RELOCS and
> and reduced the linker code size.
> 
>  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf 
> Al
> -[ 6] .text             PROGBITS        00000a2c 000a2c 00323e 00  AX  0   0  
> 4
> +[ 6] .text             PROGBITS        00000a2c 000a2c 003133 00  AX  0   0  
> 4
> 
> I suppose most of the linkers support -Bsymbolic,
> but I could verify only i386 and arm. 
> 
> Signed-off-by: Jiri Olsa <[email protected]>

Hi,
cool this patch was missing since a long time, thanks for posting.
Just a comment: probably the HAVE_RELATIVE_RELOCS macro should be defined
in the dl-sysdeps.h header.

cheers,
carmelo
> ---
> Index: ldso/ldso/arm/dl-startup.h
> ===================================================================
> --- ldso/ldso/arm/dl-startup.h        (revision 24692)
> +++ ldso/ldso/arm/dl-startup.h        (working copy)
> @@ -135,6 +135,9 @@
>   * do something a little more subtle here.  */
>  #define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long*)ARGS)+1)
>  
> +/* The linker supports relative relocations. */
> +#define HAVE_RELATIVE_RELOCS
> +
>  /* Handle relocation of the symbols in the dynamic loader. */
>  static __always_inline
>  void PERFORM_BOOTSTRAP_RELOC(ELF_RELOC *rpnt, unsigned long *reloc_addr,
> Index: ldso/ldso/dl-startup.c
> ===================================================================
> --- ldso/ldso/dl-startup.c    (revision 24692)
> +++ ldso/ldso/dl-startup.c    (working copy)
> @@ -250,16 +250,18 @@
>                       if (!rel_addr)
>                               continue;
>  
> -                     /* Now parse the relocation information */
> -                     /* Since ldso is linked with -Bsymbolic, all relocs 
> will be RELATIVE(for those archs that have
> -                        RELATIVE relocs) which means that the for(..) loop 
> below has nothing to do and can be deleted.
> -                        Possibly one should add a HAVE_RELATIVE_RELOCS 
> directive and #ifdef away some code. */
>                       if (!indx && relative_count) {
>                               rel_size -= relative_count * sizeof(ELF_RELOC);
>                               elf_machine_relative(load_addr, rel_addr, 
> relative_count);
>                               rel_addr += relative_count * sizeof(ELF_RELOC);
>                       }
>  
> +                     /* Since ldso is linked with -Bsymbolic, all relocs 
> will be RELATIVE (for those archs that have
> +                        RELATIVE relocs - HAVE_RELATIVE_RELOCS define).  
> Which means that the for(..) loop below has 
> +                        nothing to do and can omited. */
> +#if !defined(HAVE_RELATIVE_RELOCS)
> +
> +                     /* Now parse the relocation information */
>                       rpnt = (ELF_RELOC *) rel_addr;
>                       for (i = 0; i < rel_size; i += sizeof(ELF_RELOC), 
> rpnt++) {
>                               reloc_addr = (unsigned long *) 
> DL_RELOC_ADDR(load_addr, (unsigned long)rpnt->r_offset);
> @@ -285,6 +287,7 @@
>                               /* Use this machine-specific macro to perform 
> the actual relocation.  */
>                               PERFORM_BOOTSTRAP_RELOC(rpnt, reloc_addr, 
> symbol_addr, load_addr, sym);
>                       }
> +#endif // !defined(HAVE_RELATIVE_RELOCS)
>               }
>       }
>  #endif
> Index: ldso/ldso/i386/dl-startup.h
> ===================================================================
> --- ldso/ldso/i386/dl-startup.h       (revision 24692)
> +++ ldso/ldso/i386/dl-startup.h       (working copy)
> @@ -39,6 +39,9 @@
>   * do something a little more subtle here.  */
>  #define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long*) & ARGS)+1)
>  
> +/* The linker supports relative relocations. */
> +#define HAVE_RELATIVE_RELOCS
> +
>  /* Handle relocation of the symbols in the dynamic loader. */
>  static __always_inline
>  void PERFORM_BOOTSTRAP_RELOC(ELF_RELOC *rpnt, unsigned long *reloc_addr,
> _______________________________________________
> uClibc mailing list
> [email protected]
> http://lists.busybox.net/mailman/listinfo/uclibc
> 

_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to