aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2004-08-11 07:48:13 +0000
committerNick Clifton <nickc@gcc.gnu.org>2004-08-11 07:48:13 +0000
commita77655b15fc9e25c0c3ad647eb0f511463a559c5 (patch)
tree661f66abdfa039664d00fa34da9f8f0b6cf4f5ff
parent6f4a43e029d1e36130a9ff55128a1d101cf32ec5 (diff)
downloadgcc-a77655b15fc9e25c0c3ad647eb0f511463a559c5.zip
gcc-a77655b15fc9e25c0c3ad647eb0f511463a559c5.tar.gz
gcc-a77655b15fc9e25c0c3ad647eb0f511463a559c5.tar.bz2
(arm_is_longcall_p): Update comment describing this funciton's behaviour.
Return true when the current function has a section attribute and -mlong-calls is in effect. (ARM_DECLARE_FUNCTION_SIZE): Do not set the short-call marker when -mlong-calls is in effect and the function has a section attribute. From-SVN: r85796
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/config/arm/arm.c23
-rw-r--r--gcc/config/arm/arm.h8
3 files changed, 32 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b0c3d9c..ecb4898 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2004-08-11 Nick Clifton <nickc@redhat.com>
+
+ * config/arm/arm.c (arm_is_longcall_p): Update comment describing
+ this funciton's behaviour. Return true when the current function
+ has a section attribute and -mlong-calls is in effect.
+ * config/arm/arm.h (ARM_DECLARE_FUNCTION_SIZE): Do not set the
+ short-call marker when -mlong-calls is in effect and the function
+ has a section attribute.
+
2004-08-10 Zack Weinberg <zack@codesourcery.com>
* stmt.c (expand_return): If asked to return the RESULT_DECL,
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 40b2fd4..5731a95 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -2748,7 +2748,7 @@ current_file_function_operand (rtx sym_ref)
return 1;
/* The current function is always defined within the current compilation
- unit. if it s a weak definition however, then this may not be the real
+ unit. If it s a weak definition however, then this may not be the real
definition of the function, and so we have to say no. */
if (sym_ref == XEXP (DECL_RTL (current_function_decl), 0)
&& !DECL_WEAK (current_function_decl))
@@ -2764,16 +2764,19 @@ current_file_function_operand (rtx sym_ref)
a. has an __attribute__((long call))
or b. is within the scope of a #pragma long_calls
or c. the -mlong-calls command line switch has been specified
+ . and either:
+ 1. -ffunction-sections is in effect
+ or 2. the current function has __attribute__ ((section))
+ or 3. the target function has __attribute__ ((section))
However we do not generate a long call if the function:
d. has an __attribute__ ((short_call))
or e. is inside the scope of a #pragma no_long_calls
- or f. has an __attribute__ ((section))
- or g. is defined within the current compilation unit.
+ or f. is defined within the current compilation unit.
This function will be called by C fragments contained in the machine
- description file. CALL_REF and CALL_COOKIE correspond to the matched
+ description file. SYM_REF and CALL_COOKIE correspond to the matched
rtl operands. CALL_SYMBOL is used to distinguish between
two different callers of the function. It is set to 1 in the
"call_symbol" and "call_symbol_value" patterns and to 0 in the "call"
@@ -2796,9 +2799,15 @@ arm_is_longcall_p (rtx sym_ref, int call_cookie, int call_symbol)
if (call_cookie & CALL_SHORT)
return 0;
- if (TARGET_LONG_CALLS && flag_function_sections)
- return 1;
-
+ if (TARGET_LONG_CALLS)
+ {
+ if (flag_function_sections
+ || DECL_SECTION_NAME (current_function_decl))
+ /* c.3 is handled by the defintion of the
+ ARM_DECLARE_FUNCTION_SIZE macro. */
+ return 1;
+ }
+
if (current_file_function_operand (sym_ref))
return 0;
diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index c3e8223..9c759fb 100644
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -2064,8 +2064,14 @@ typedef struct
#define ASM_OUTPUT_LABELREF(FILE, NAME) \
arm_asm_output_labelref (FILE, NAME)
+/* Set the short-call flag for any function compiled in the current
+ compilation unit. We skip this for functions with the section
+ attirubte when long-calls are in effect as this tells the compiler
+ that the section might be placed a long way from the caller.
+ See arm_is_longcall_p() for more information. */
#define ARM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL) \
- arm_encode_call_attribute (DECL, SHORT_CALL_FLAG_CHAR)
+ if (!TARGET_LONG_CALLS || ! DECL_SECTION_NAME (DECL)) \
+ arm_encode_call_attribute (DECL, SHORT_CALL_FLAG_CHAR)
/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
and check its validity for a certain class.