From a2f6cf8446449fdcea75da7598aa76e1daa261c3 Mon Sep 17 00:00:00 2001 From: nickc Date: Wed, 11 Aug 2004 07:48:13 +0000 Subject: [PATCH] (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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85796 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/config/arm/arm.c | 23 ++++++++++++++++------- gcc/config/arm/arm.h | 8 +++++++- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b0c3d9c4ff8..ecb489800f0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2004-08-11 Nick Clifton + + * 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 * 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 40b2fd45c65..5731a955b75 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 c3e82235c16..9c759fbe866 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. -- 2.11.4.GIT