Make ROSE shared library profiling work; Use GOTOFF if possible for ELF.
From-SVN: r5684
This commit is contained in:
parent
7868c46630
commit
40fbfbea48
@ -182,11 +182,27 @@ do \
|
||||
\
|
||||
if (profile_flag && OSF_PROFILE_BEFORE_PROLOGUE) \
|
||||
{ \
|
||||
if (!flag_pic) \
|
||||
if (!flag_pic && !HALF_PIC_P ()) \
|
||||
{ \
|
||||
fprintf (FILE, "\tleal %sP%d,%%edx\n", lprefix, labelno); \
|
||||
fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \
|
||||
fprintf (FILE, "\tcall *%s_mcount_ptr\n", prefix); \
|
||||
} \
|
||||
\
|
||||
else if (HALF_PIC_P ()) \
|
||||
{ \
|
||||
rtx symref; \
|
||||
\
|
||||
HALF_PIC_EXTERNAL ("_mcount_ptr"); \
|
||||
symref = HALF_PIC_PTR (gen_rtx (SYMBOL_REF, Pmode, \
|
||||
"_mcount_ptr")); \
|
||||
\
|
||||
fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \
|
||||
fprintf (FILE, "\tmovl %s%s,%%eax\n", prefix, \
|
||||
XSTR (symref, 0)); \
|
||||
fprintf (FILE, "\tmovl (%%eax),%%eax\n"); \
|
||||
fprintf (FILE, "\tcall *%%eax\n"); \
|
||||
} \
|
||||
\
|
||||
else \
|
||||
{ \
|
||||
static int call_no = 0; \
|
||||
@ -199,6 +215,7 @@ do \
|
||||
lprefix, labelno); \
|
||||
fprintf (FILE, "\tmovl %s_mcount_ptr@GOT(%%eax),%%eax\n", \
|
||||
prefix); \
|
||||
fprintf (FILE, "\tmovl (%%eax),%%eax\n"); \
|
||||
fprintf (FILE, "\tcall *%%eax\n"); \
|
||||
} \
|
||||
} \
|
||||
@ -246,6 +263,17 @@ do \
|
||||
fprintf (FILE, "\tcall *%smcount@GOT(%%ebx)\n", prefix); \
|
||||
} \
|
||||
\
|
||||
else if (TARGET_MCOUNT && HALF_PIC_P ()) \
|
||||
{ \
|
||||
rtx symdef; \
|
||||
\
|
||||
HALF_PIC_EXTERNAL ("mcount"); \
|
||||
symdef = HALF_PIC_PTR (gen_rtx (SYMBOL_REF, Pmode, "mcount")); \
|
||||
fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \
|
||||
fprintf (FILE, "\tmovl %s%s,%%eax\n", prefix, XSTR (symdef, 0)); \
|
||||
fprintf (FILE, "\tcall *%%eax\n"); \
|
||||
} \
|
||||
\
|
||||
else if (TARGET_MCOUNT) \
|
||||
{ \
|
||||
fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \
|
||||
@ -259,6 +287,7 @@ do \
|
||||
fprintf (FILE, "\tleal $%sP%d@GOTOFF(%%ebx),%%edx\n", \
|
||||
lprefix, labelno); \
|
||||
fprintf (FILE, "\tmovl _mcount_ptr@GOT(%%eax),%%eax\n"); \
|
||||
fprintf (FILE, "\tmovl (%%eax),%%eax\n"); \
|
||||
fprintf (FILE, "\tcall *%%eax\n"); \
|
||||
fprintf (FILE, "\tpopl %%eax\n"); \
|
||||
} \
|
||||
@ -267,7 +296,7 @@ do \
|
||||
{ \
|
||||
fprintf (FILE, "\tmovl 4(%%ebp),%%ecx\n"); \
|
||||
fprintf (FILE, "\tpushl %%ecx\n"); \
|
||||
fprintf (FILE, "\tleal $%sP%d,%%edx\n", lprefix, labelno); \
|
||||
fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \
|
||||
fprintf (FILE, "\tcall *_mcount_ptr\n"); \
|
||||
fprintf (FILE, "\tpopl %%eax\n"); \
|
||||
} \
|
||||
@ -565,8 +594,17 @@ while (0)
|
||||
#define ENCODE_SECTION_INFO(DECL) \
|
||||
do \
|
||||
{ \
|
||||
if (HALF_PIC_P ()) \
|
||||
if (HALF_PIC_P ()) \
|
||||
HALF_PIC_ENCODE (DECL); \
|
||||
\
|
||||
else if (flag_pic) \
|
||||
{ \
|
||||
rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
|
||||
? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \
|
||||
SYMBOL_REF_FLAG (XEXP (rtl, 0)) \
|
||||
= (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
|
||||
|| ! TREE_PUBLIC (DECL)); \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
|
@ -267,6 +267,30 @@ half_pic_declare (name)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Mark that an object is explicitly external. */
|
||||
|
||||
void
|
||||
half_pic_external (name)
|
||||
char *name;
|
||||
{
|
||||
struct all_refs *ptr;
|
||||
|
||||
if (!flag_half_pic)
|
||||
return;
|
||||
|
||||
ptr = half_pic_hash (name, 0, TRUE);
|
||||
if (!ptr)
|
||||
return;
|
||||
|
||||
ptr->external_p = TRUE;
|
||||
|
||||
#ifdef HALF_PIC_DEBUG
|
||||
if (HALF_PIC_DEBUG)
|
||||
fprintf (stderr, "\n========== Half_pic_external %s\n", name);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Return whether an address is half-pic. */
|
||||
|
||||
|
@ -57,6 +57,7 @@ extern int half_pic_number_ptrs; /* # distinct pointers found */
|
||||
extern int half_pic_number_refs; /* # half-pic references */
|
||||
extern void half_pic_encode PROTO((union tree_node *)); /* encode whether half-pic */
|
||||
extern void half_pic_declare PROTO((char *)); /* declare object local */
|
||||
extern void half_pic_external PROTO((char *)); /* declare object external */
|
||||
extern void half_pic_init PROTO((void)); /* half_pic initialization */
|
||||
extern void half_pic_finish STDIO_PROTO((FILE *)); /* half_pic termination */
|
||||
extern int half_pic_address_p PROTO((struct rtx_def *)); /* true if an address is half-pic */
|
||||
@ -71,6 +72,7 @@ extern struct rtx_def *half_pic_ptr PROTO((struct rtx_def *)); /* return RTX for
|
||||
|
||||
#define HALF_PIC_ENCODE(DECL) half_pic_encode (DECL)
|
||||
#define HALF_PIC_DECLARE(NAME) half_pic_declare (NAME)
|
||||
#define HALF_PIC_EXTERNAL(NAME) half_pic_external (NAME)
|
||||
#define HALF_PIC_INIT() half_pic_init ()
|
||||
#define HALF_PIC_FINISH(STREAM) half_pic_finish (STREAM)
|
||||
#define HALF_PIC_ADDRESS_P(X) ((*ptr_half_pic_address_p) (X))
|
||||
|
Loading…
x
Reference in New Issue
Block a user