From: Bernd Schmidt Date: Wed, 16 Nov 2005 13:20:06 +0000 (+0000) Subject: crti.s (__init, __fini): Use appropriate prologue if __PIC__ is defined. X-Git-Tag: releases/gcc-4.1.0~759 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0d88914b25756f154732e2bf12b8d37b58ddd2de;p=thirdparty%2Fgcc.git crti.s (__init, __fini): Use appropriate prologue if __PIC__ is defined. * config/bfin/crti.s (__init, __fini): Use appropriate prologue if __PIC__ is defined. * config/bfin/crtn.s: Change epilogues to match. * config/bfin/t-bfin-elf (EXTRA_MULTILIB_PARTS): Define. * config/bfin/bfin.h (TARGET_CPU_CPP_BUILTINS): If flag_pic, define __PIC__ and __pic__. From-SVN: r107083 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 86d9228e4947..dc84b221de79 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2005-11-16 Bernd Schmidt + + * config/bfin/crti.s (__init, __fini): Use appropriate prologue if + __PIC__ is defined. + * config/bfin/crtn.s: Change epilogues to match. + * config/bfin/t-bfin-elf (EXTRA_MULTILIB_PARTS): Define. + * config/bfin/bfin.h (TARGET_CPU_CPP_BUILTINS): If flag_pic, define + __PIC__ and __pic__. + 2005-11-16 Tobias Schl"uter PR 24357 diff --git a/gcc/config/bfin/bfin.h b/gcc/config/bfin/bfin.h index 0e6da5c08a88..be4e565c37eb 100644 --- a/gcc/config/bfin/bfin.h +++ b/gcc/config/bfin/bfin.h @@ -41,6 +41,11 @@ extern int target_flags; { \ builtin_define ("bfin"); \ builtin_define ("BFIN"); \ + if (flag_pic) \ + { \ + builtin_define ("__PIC__"); \ + builtin_define ("__pic__"); \ + } \ } \ while (0) #endif diff --git a/gcc/config/bfin/crti.s b/gcc/config/bfin/crti.s index 7324e27ff88f..84a98597c23b 100644 --- a/gcc/config/bfin/crti.s +++ b/gcc/config/bfin/crti.s @@ -38,10 +38,21 @@ Boston, MA 02110-1301, USA. */ .globl __init .type __init,@function __init: - LINK 0; - +#if defined __PIC__ + [--SP] = P5; +#endif + LINK 12; +#if defined __PIC__ + P5 = [P5 + _current_shared_library_p5_offset_] +#endif .section .fini .globl __fini .type __fini,@function __fini: - LINK 0; +#if defined __PIC__ + [--SP] = P5; +#endif + LINK 12; +#if defined __PIC__ + P5 = [P5 + _current_shared_library_p5_offset_] +#endif diff --git a/gcc/config/bfin/crtn.s b/gcc/config/bfin/crtn.s index 78ad7bb12213..69421fcfa582 100644 --- a/gcc/config/bfin/crtn.s +++ b/gcc/config/bfin/crtn.s @@ -36,8 +36,14 @@ Boston, MA 02110-1301, USA. */ .section .init unlink; +#if defined __PIC__ + P5 = [SP++]; +#endif rts; .section .fini unlink; +#if defined __PIC__ + P5 = [SP++]; +#endif rts; diff --git a/gcc/config/bfin/t-bfin-elf b/gcc/config/bfin/t-bfin-elf index 928129c4331f..aab2a1b7b5ae 100644 --- a/gcc/config/bfin/t-bfin-elf +++ b/gcc/config/bfin/t-bfin-elf @@ -32,3 +32,5 @@ $(T)crti.o: $(srcdir)/config/bfin/crti.s $(GCC_PASSES) $(T)crtn.o: $(srcdir)/config/bfin/crtn.s $(GCC_PASSES) $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \ -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/bfin/crtn.s + +EXTRA_MULTILIB_PARTS= crtbegin.o crtend.o crti.o crtn.o