diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-09-08 07:02:28 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-09-08 07:02:28 +0000 |
commit | 590b40f7ec801ea1b4be47112a016ed369041e64 (patch) | |
tree | 63d37abbae8a1046c88c4af07744f35830506ba5 /sysdeps/powerpc/powerpc64/sysdep.h | |
parent | 67254a97d98f73a35ab995e8afccb3ded433c8b1 (diff) | |
download | glibc-590b40f7ec801ea1b4be47112a016ed369041e64.tar.gz glibc-590b40f7ec801ea1b4be47112a016ed369041e64.tar.xz glibc-590b40f7ec801ea1b4be47112a016ed369041e64.zip |
Update.
2004-09-07 Jakub Jelinek <jakub@redhat.com> * sysdeps/powerpc/powerpc64/configure.in: New file. * config.h.in (USE_PPC64_OVERLAPPING_OPD): Add. * configure.in (HAVE_ASM_GLOBAL_DOT_NAME): Remove. * sysdeps/powerpc/powerpc64/sysdep.h: Formatting. (OPD_ENT, BODY_LABEL, ENTRY_1, ENTRY_2, END_2, DOT_PREFIX, BODY_PREFIX): Define. (ENTRY, DOT_LABEL, END, TRACEBACK, END_GEN_TB, EALIGN): Support HAVE_ASM_GLOBAL_DOT_NAME or no dot symbols, USE_PPC64_OVERLAPPING_OPD or never overlapping .opd entries. * sysdeps/powerpc/powerpc64/dl-machine.h: Include sysdep.h. (TRAMPOLINE_TEMPLATE, RTLD_START): Use the new sysdep.h macros.
Diffstat (limited to 'sysdeps/powerpc/powerpc64/sysdep.h')
-rw-r--r-- | sysdeps/powerpc/powerpc64/sysdep.h | 201 |
1 files changed, 112 insertions, 89 deletions
diff --git a/sysdeps/powerpc/powerpc64/sysdep.h b/sysdeps/powerpc/powerpc64/sysdep.h index 29c1c2c36c..4420a6dfac 100644 --- a/sysdeps/powerpc/powerpc64/sysdep.h +++ b/sysdeps/powerpc/powerpc64/sysdep.h @@ -1,5 +1,5 @@ /* Assembly macros for 64-bit PowerPC. - Copyright (C) 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,9 +19,10 @@ #include <sysdeps/powerpc/sysdep.h> +#ifdef __ELF__ + #ifdef __ASSEMBLER__ -#ifdef __ELF__ /* If compiled for profiling, call `_mcount' at the start of each function. see ppc-mcount.S for more details. */ #ifdef PROF @@ -29,48 +30,70 @@ to locate our caller and so it can restore it; so store one just for its benefit. */ #ifdef SYSV_ELF_PROFILING -#define CALL_MCOUNT \ - .pushsection; \ - .section ".data"; \ - .align ALIGNARG(2); \ -__mcount: \ - .long 0; \ - .previous; \ - .section ".toc","aw"; \ -.LC__mcount:; \ - .tc __mcount[TC],__mcount; \ - .previous; \ - mflr r0; \ - std r0,16(r1); \ - ld r0,.LC__mcount@toc(r2); \ +#define CALL_MCOUNT \ + .pushsection; \ + .section ".data"; \ + .align ALIGNARG(2); \ +__mcount: \ + .long 0; \ + .previous; \ + .section ".toc","aw"; \ +.LC__mcount:; \ + .tc __mcount[TC],__mcount; \ + .previous; \ + mflr r0; \ + std r0,16(r1); \ + ld r0,.LC__mcount@toc(r2); \ bl JUMPTARGET(_mcount); #else /* SYSV_ELF_PROFILING */ -#define CALL_MCOUNT \ - mflr r0; \ - std r0,16(r1); \ +#define CALL_MCOUNT \ + mflr r0; \ + std r0,16(r1); \ bl JUMPTARGET(_mcount); #endif /* SYSV_ELF_PROFILING */ #else /* PROF */ #define CALL_MCOUNT /* Do nothing. */ #endif /* PROF */ -#define DOT_LABEL(X) .##X +#ifdef USE_PPC64_OVERLAPPING_OPD +# define OPD_ENT(name) .quad BODY_LABEL (name), .TOC.@tocbase +#else +# define OPD_ENT(name) .quad BODY_LABEL (name), .TOC.@tocbase, 0 +#endif -#define ENTRY(name) \ - .section ".text"; \ - .align ALIGNARG(2); \ - .globl DOT_LABEL(name); \ - .type DOT_LABEL(name),@function ; \ - .globl name; \ - .section ".opd","aw"; \ - .align 3; \ - .size name,24; \ -name##: ; \ - .quad DOT_LABEL(name) ; \ - .quad .TOC.@tocbase, 0; \ - .previous; \ -DOT_LABEL(name): +#define ENTRY_1(name) \ + .section ".text"; \ + .type BODY_LABEL(name),@function; \ + .globl name; \ + .section ".opd","aw"; \ + .align 3; \ +name##: OPD_ENT (name); \ + .previous; + +#ifdef HAVE_ASM_GLOBAL_DOT_NAME +# define DOT_LABEL(X) .##X +# define BODY_LABEL(X) .##X +# define ENTRY_2(name) \ + .globl BODY_LABEL(name); \ + ENTRY_1(name) \ + .size name, 24; +# define END_2(name) \ + .size BODY_LABEL(name),.-BODY_LABEL(name); +#else +# define DOT_LABEL(X) X +# define BODY_LABEL(X) .LY##X +# define ENTRY_2(name) \ + .type name,@function; \ + ENTRY_1(name) +# define END_2(name) \ + .size name,.-BODY_LABEL(name); \ + .size BODY_LABEL(name),.-BODY_LABEL(name); +#endif +#define ENTRY(name) \ + ENTRY_2(name) \ + .align ALIGNARG(2); \ +BODY_LABEL(name): #define EALIGN_W_0 /* No words to insert. */ #define EALIGN_W_1 nop @@ -82,44 +105,24 @@ DOT_LABEL(name): #define EALIGN_W_7 EALIGN_W_6;nop /* EALIGN is like ENTRY, but does alignment to 'words'*4 bytes - past a 2^align boundary. */ + past a 2^alignt boundary. */ #ifdef PROF #define EALIGN(name, alignt, words) \ - .section ".text"; \ - .globl DOT_LABEL(name); \ - .type DOT_LABEL(name),@function ; \ - .globl name; \ - .section ".opd","aw"; \ - .align 3; \ - .size name,24; \ -name##: ; \ - .quad DOT_LABEL(name) ; \ - .quad .TOC.@tocbase, 0; \ - .previous; \ - .align ALIGNARG(alignt); \ - EALIGN_W_##words; \ -DOT_LABEL(name): \ - CALL_MCOUNT \ - b 0f; \ - .align ALIGNARG(alignt); \ - EALIGN_W_##words; \ - 0: + ENTRY_2(name) \ + .align ALIGNARG(alignt); \ + EALIGN_W_##words; \ +BODY_LABEL(name): \ + CALL_MCOUNT \ + b 0f; \ + .align ALIGNARG(alignt); \ + EALIGN_W_##words; \ +0: #else /* PROF */ #define EALIGN(name, alignt, words) \ - .section ".text"; \ - .globl DOT_LABEL(name); \ - .type DOT_LABEL(name),@function ; \ - .globl name; \ - .section ".opd","aw"; \ - .align 3; \ - .size name,24; \ -name##: ; \ - .quad DOT_LABEL(name) ; \ - .quad .TOC.@tocbase, 0; \ - .previous; \ - .align ALIGNARG(alignt); \ - EALIGN_W_##words; \ -DOT_LABEL(name): + ENTRY_2(name) \ + .align ALIGNARG(alignt); \ + EALIGN_W_##words; \ +BODY_LABEL(name): #endif /* Local labels stripped out by the linker. */ @@ -135,35 +138,35 @@ DOT_LABEL(name): /* Support Traceback tables */ #define TB_ASM 0x000c000000000000 -#define TB_GLOBALLINK 0x0000800000000000 +#define TB_GLOBALLINK 0x0000800000000000 #define TB_IS_EPROL 0x0000400000000000 -#define TB_HAS_TBOFF 0x0000200000000000 +#define TB_HAS_TBOFF 0x0000200000000000 #define TB_INT_PROC 0x0000100000000000 #define TB_HAS_CTL 0x0000080000000000 #define TB_TOCLESS 0x0000040000000000 -#define TB_FP_PRESENT 0x0000020000000000 -#define TB_LOG_ABORT 0x0000010000000000 -#define TB_INT_HANDL 0x0000008000000000 -#define TB_NAME_PRESENT 0x0000004000000000 -#define TB_USES_ALLOCA 0x0000002000000000 +#define TB_FP_PRESENT 0x0000020000000000 +#define TB_LOG_ABORT 0x0000010000000000 +#define TB_INT_HANDL 0x0000008000000000 +#define TB_NAME_PRESENT 0x0000004000000000 +#define TB_USES_ALLOCA 0x0000002000000000 #define TB_SAVES_CR 0x0000000200000000 #define TB_SAVES_LR 0x0000000100000000 -#define TB_STORES_BC 0x0000000080000000 +#define TB_STORES_BC 0x0000000080000000 #define TB_FIXUP 0x0000000040000000 #define TB_FP_SAVED(fprs) (((fprs) & 0x3f) << 24) #define TB_GPR_SAVED(gprs) (((fprs) & 0x3f) << 16) #define TB_FIXEDPARMS(parms) (((parms) & 0xff) << 8) #define TB_FLOATPARMS(parms) (((parms) & 0x7f) << 1) -#define TB_PARMSONSTK 0x0000000000000001 +#define TB_PARMSONSTK 0x0000000000000001 -#define PPC_HIGHER(v) (((v) >> 32) & 0xffff) -#define TB_DEFAULT TB_ASM | TB_HAS_TBOFF | TB_NAME_PRESENT +#define PPC_HIGHER(v) (((v) >> 32) & 0xffff) +#define TB_DEFAULT TB_ASM | TB_HAS_TBOFF | TB_NAME_PRESENT #define TRACEBACK(name) \ LT_LABEL(name): ; \ .long 0 ; \ .quad TB_DEFAULT ; \ - .long LT_LABEL(name)-DOT_LABEL(name) ; \ + .long LT_LABEL(name)-BODY_LABEL(name) ; \ .short LT_LABELSUFFIX(name,_name_end)-LT_LABELSUFFIX(name,_name_start) ; \ LT_LABELSUFFIX(name,_name_start): ;\ .ascii stringify(name) ; \ @@ -174,7 +177,7 @@ LT_LABELSUFFIX(name,_name_end): ; \ LT_LABEL(name): ; \ .long 0 ; \ .quad TB_DEFAULT | mask ; \ - .long LT_LABEL(name)-DOT_LABEL(name) ; \ + .long LT_LABEL(name)-BODY_LABEL(name) ; \ .short LT_LABELSUFFIX(name,_name_end)-LT_LABELSUFFIX(name,_name_start) ; \ LT_LABELSUFFIX(name,_name_start): ;\ .ascii stringify(name) ; \ @@ -184,14 +187,13 @@ LT_LABELSUFFIX(name,_name_end): ; \ /* END generates Traceback tables */ #undef END #define END(name) \ - TRACEBACK(name) \ - ASM_SIZE_DIRECTIVE(DOT_LABEL(name)) + TRACEBACK(name) \ + END_2(name) /* This form supports more informative traceback tables */ #define END_GEN_TB(name,mask) \ TRACEBACK_MASK(name,mask) \ - ASM_SIZE_DIRECTIVE(DOT_LABEL(name)) - + END_2(name) #define DO_CALL(syscall) \ li 0,syscall; \ @@ -244,10 +246,31 @@ LT_LABELSUFFIX(name,_name_end): ; \ #define PSEUDO_END_ERRVAL(name) \ END (name) -/* Label in text section. */ -/* ppc64 function descriptors which requires . notation */ -#define C_TEXT(name) .##name +#else /* !__ASSEMBLER__ */ -#endif /* __ELF__ */ +#ifdef USE_PPC64_OVERLAPPING_OPD +# define OPD_ENT(name) ".quad " BODY_PREFIX #name ", .TOC.@tocbase;" +#else +# define OPD_ENT(name) ".quad " BODY_PREFIX #name ", .TOC.@tocbase, 0;" +#endif + +#ifdef HAVE_ASM_GLOBAL_DOT_NAME +# define DOT_PREFIX "." +# define BODY_PREFIX "." +# define ENTRY_2(name) \ + ".globl " BODY_PREFIX #name ";\n" \ + ".size " #name ", 24;" +# define END_2(name) \ + ".size " BODY_PREFIX #name ",.-" BODY_PREFIX #name ";" +#else +# define DOT_PREFIX "" +# define BODY_PREFIX ".LY" +# define ENTRY_2(name) ".type " #name ",@function;" +# define END_2(name) \ + ".size " #name ",.-" BODY_PREFIX #name ";\n" \ + ".size " BODY_PREFIX #name ",.-" BODY_PREFIX #name ";" +#endif #endif /* __ASSEMBLER__ */ + +#endif /* __ELF__ */ |