[OpenBIOS] [PATCH] ppc: Create function descriptors for global functions on ppc64

Blue Swirl blauwirbel at gmail.com
Sun Nov 28 09:20:07 CET 2010


On Sun, Nov 28, 2010 at 12:58 AM, Andreas Färber <andreas.faerber at web.de> wrote:
> This should also fix linker errors observed by Blue.

Better, but still:
  LINK  openbios-qemu.elf
libdrivers.a(timer.o): In function `udelay':
/src/openbios-devel/obj-ppc64/../drivers/timer.c:91: undefined
reference to `._wait_ticks'
libgcc.a(__udivmoddi4.o): In function `__udivmoddi4':
/src/openbios-devel/obj-ppc64/../libgcc/__udivmoddi4.c:8: undefined
reference to `.__divide_error'

> Cc: Blue Swirl <blauwirbel at gmail.com>
> Cc: Alexander Graf <agraf at suse.de>
> Signed-off-by: Andreas Färber <andreas.faerber at web.de>
> ---
>  arch/ppc/qemu/start.S      |    7 +++----
>  include/arch/ppc/asmdefs.h |   18 ++++++++++++++++++
>  2 files changed, 21 insertions(+), 4 deletions(-)
>
> diff --git a/arch/ppc/qemu/start.S b/arch/ppc/qemu/start.S
> index 4b6df3f..76ef6d6 100644
> --- a/arch/ppc/qemu/start.S
> +++ b/arch/ppc/qemu/start.S
> @@ -285,8 +285,7 @@ call_isi_exception:
>  exception_return:
>        EXCEPTION_EPILOGUE
>
> -       .globl  __divide_error
> -__divide_error:
> +GLOBL(__divide_error):

Shouldn't this be _GLOBAL?

>  trap_error:
>        mflr    r3
>        b       BRANCH_LABEL(unexpected_excep)
> @@ -473,7 +472,7 @@ saved_stack:
>        .long   0
>         .previous
>        /* void call_elf( arg1, arg2, entry ) */
> -GLOBL(call_elf):
> +_GLOBAL(call_elf):
>        mflr    r0
>        stwu    r1,-16(r1)
>        stw     r0,20(r1)
> @@ -633,7 +632,7 @@ GLOBL(of_rtas_end):
>  #define LG_CACHE_LINE_SIZE      5
>
>  /* flush_icache_range( unsigned long start, unsigned long stop) */
> -GLOBL(flush_icache_range):
> +_GLOBAL(flush_icache_range):
>         li      r5,CACHE_LINE_SIZE-1
>         andc    r3,r3,r5
>         subf    r4,r3,r4
> diff --git a/include/arch/ppc/asmdefs.h b/include/arch/ppc/asmdefs.h
> index 9c85ea5..05a89b2 100644
> --- a/include/arch/ppc/asmdefs.h
> +++ b/include/arch/ppc/asmdefs.h
> @@ -118,6 +118,24 @@
>  #define EXTERN( name )         _##name
>  #endif
>
> +#if defined(__powerpc64__) && !defined(__darwin__)
> +#define _GLOBAL(name) \
> +        .align 2 ; \
> +        .section ".opd", "aw" ; \
> +        .globl name ; \
> +        .globl .##name ; \
> +    name: \
> +        .quad .##name ; \
> +        .quad .TOC. at tocbase ; \
> +        .quad 0 ; \
> +        .previous ; \
> +        .type .##name, @function ; \
> +    .##name

It's strange that now there are no errors about .opd section. I'm
pretty sure this is close to what I tried earlier.

> +#else
> +#define _GLOBAL(name) \
> +    GLOBL(name)
> +#endif
> +
>  #define        BIT(n)          (1<<(31-(n)))
>
>  #endif   /* _H_ASMDEFS */
> --
> 1.7.3
>
>



More information about the OpenBIOS mailing list