This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
[PATCH] PPC64 fix opd entry size gen for ENTRY macro
- From: Steve Munroe <sjmunroe at us dot ibm dot com>
- To: libc-alpha at sources dot redhat dot com, yaari at il dot ibm dot com, janis187 at us dot ibm dot com, Dwayne McConnell <dgm69 at us dot ibm dot com>
- Date: Wed, 19 May 2004 13:12:24 -0500
- Subject: [PATCH] PPC64 fix opd entry size gen for ENTRY macro
- Organization: IBM LTC
- Reply-to: sjmunroe at vnet dot ibm dot com
Some folks working on tools for powerpc64 found that .size for opd
entries is incorrect for any function written in assemble. But the .size
is generated by gcc correctly. Alan Modra traced this back to the
ENTRY/END macros defined in sysdeps/powerpc/powerpc64/sysdep.h. The
attached patch fixes this and does some general cleanup.
Thanks to Yaakov and Alan for finding this!
2004-05-18 Steven Munroe <sjmunroe@us.ibm.com>
* sysdeps/powerpc/powerpc64/sysdep.h [__ASSEMBLER__]: Include
<sysdeps/powerpc/sysdep.h> independent of __ASSEMBLER__.
[PIC]: Redundent for powerpc64, removed.
(ENTRY): Generate size and alignment for opd entry.
(EALIGN): Generate size and alignment for opd entry.
(END): Use DOT_LABEL in ASM_SIZE_DIRECTIVE.
(END_GEN_TB): Use DOT_LABEL in ASM_SIZE_DIRECTIVE.
diff -urN libc23-cvstip-20040510/sysdeps/powerpc/powerpc64/sysdep.h libc23/sysdeps/powerpc/powerpc64/sysdep.h
--- libc23-cvstip-20040510/sysdeps/powerpc/powerpc64/sysdep.h 2003-08-16 19:33:13.000000000 -0500
+++ libc23/sysdeps/powerpc/powerpc64/sysdep.h 2004-05-19 09:53:24.000000000 -0500
@@ -17,10 +17,10 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#ifdef __ASSEMBLER__
-
#include <sysdeps/powerpc/sysdep.h>
+#ifdef __ASSEMBLER__
+
#ifdef __ELF__
/* If compiled for profiling, call `_mcount' at the start of each function.
see ppc-mcount.S for more details. */
@@ -28,7 +28,6 @@
/* The mcount code relies on a the return address being on the stack
to locate our caller and so it can restore it; so store one just
for its benefit. */
-#ifdef PIC
#ifdef SYSV_ELF_PROFILING
#define CALL_MCOUNT \
.pushsection; \
@@ -51,30 +50,6 @@
std r0,16(r1); \
bl JUMPTARGET(_mcount);
#endif /* SYSV_ELF_PROFILING */
-#else /* PIC */
-#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); \
- bl JUMPTARGET(_mcount);
-#else /* SYSV_ELF_PROFILING */
-#define CALL_MCOUNT \
- mflr r0; \
- std r0,16(r1); \
- bl JUMPTARGET(_mcount);
-#endif /* SYSV_ELF_PROFILING */
-#endif /* PIC */
#else /* PROF */
#define CALL_MCOUNT /* Do nothing. */
#endif /* PROF */
@@ -88,6 +63,8 @@
.type DOT_LABEL(name),@function ; \
.globl name; \
.section ".opd","aw"; \
+ .align 3; \
+ .size name,24; \
name##: ; \
.quad DOT_LABEL(name) ; \
.quad .TOC.@tocbase, 0; \
@@ -113,6 +90,8 @@
.type DOT_LABEL(name),@function ; \
.globl name; \
.section ".opd","aw"; \
+ .align 3; \
+ .size name,24; \
name##: ; \
.quad DOT_LABEL(name) ; \
.quad .TOC.@tocbase, 0; \
@@ -132,6 +111,8 @@
.type DOT_LABEL(name),@function ; \
.globl name; \
.section ".opd","aw"; \
+ .align 3; \
+ .size name,24; \
name##: ; \
.quad DOT_LABEL(name) ; \
.quad .TOC.@tocbase, 0; \
@@ -204,12 +185,12 @@
#undef END
#define END(name) \
TRACEBACK(name) \
- ASM_SIZE_DIRECTIVE(name)
+ ASM_SIZE_DIRECTIVE(DOT_LABEL(name))
/* This form supports more informative traceback tables */
#define END_GEN_TB(name,mask) \
TRACEBACK_MASK(name,mask) \
- ASM_SIZE_DIRECTIVE(name)
+ ASM_SIZE_DIRECTIVE(DOT_LABEL(name))
#define DO_CALL(syscall) \