diff options
Diffstat (limited to 'gcc/config/arm')
-rw-r--r-- | gcc/config/arm/arm.c | 47 | ||||
-rw-r--r-- | gcc/config/arm/arm.h | 41 | ||||
-rw-r--r-- | gcc/config/arm/pe.c | 4 | ||||
-rw-r--r-- | gcc/config/arm/pe.h | 21 |
4 files changed, 53 insertions, 60 deletions
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index d784050c4b0..cbcd1a14dca 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -120,6 +120,9 @@ static int arm_adjust_cost PARAMS ((rtx, rtx, rtx, int)); #ifdef OBJECT_FORMAT_ELF static void arm_elf_asm_named_section PARAMS ((const char *, unsigned int)); #endif +#ifndef ARM_PE +static void arm_encode_section_info PARAMS ((tree, int)); +#endif #undef Hint #undef Mmode @@ -170,6 +173,13 @@ static void arm_elf_asm_named_section PARAMS ((const char *, unsigned int)); #undef TARGET_SCHED_ADJUST_COST #define TARGET_SCHED_ADJUST_COST arm_adjust_cost +#undef TARGET_ENCODE_SECTION_INFO +#ifdef ARM_PE +#define TARGET_ENCODE_SECTION_INFO arm_pe_encode_section_info +#else +#define TARGET_ENCODE_SECTION_INFO arm_encode_section_info +#endif + struct gcc_target targetm = TARGET_INITIALIZER; /* Obstack for minipool constant handling. */ @@ -11042,3 +11052,40 @@ arm_elf_asm_named_section (name, flags) name, flagchars, type); } #endif + +#ifndef ARM_PE +/* Symbols in the text segment can be accessed without indirecting via the + constant pool; it may take an extra binary operation, but this is still + faster than indirecting via memory. Don't do this when not optimizing, + since we won't be calculating al of the offsets necessary to do this + simplification. */ + +static void +arm_encode_section_info (decl, first) + tree decl; + int first; +{ + /* This doesn't work with AOF syntax, since the string table may be in + a different AREA. */ +#ifndef AOF_ASSEMBLER + if (optimize > 0 && TREE_CONSTANT (decl) + && (!flag_writable_strings || TREE_CODE (decl) != STRING_CST)) + { + rtx rtl = (TREE_CODE_CLASS (TREE_CODE (decl)) != 'd' + ? TREE_CST_RTL (decl) : DECL_RTL (decl)); + SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1; + } +#endif + + /* If we are referencing a function that is weak then encode a long call + flag in the function name, otherwise if the function is static or + or known to be defined in this file then encode a short call flag. */ + if (first && TREE_CODE_CLASS (TREE_CODE (decl)) == 'd') + { + if (TREE_CODE (decl) == FUNCTION_DECL && DECL_WEAK (decl)) + arm_encode_call_attribute (decl, LONG_CALL_FLAG_CHAR); + else if (! TREE_PUBLIC (decl)) + arm_encode_call_attribute (decl, SHORT_CALL_FLAG_CHAR); + } +} +#endif /* !ARM_PE */ diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index fcb2c1f4a67..c3946d64c56 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -1860,47 +1860,6 @@ typedef struct #define ASM_OUTPUT_LABELREF(FILE, NAME) \ asm_fprintf (FILE, "%U%s", arm_strip_name_encoding (NAME)) -/* If we are referencing a function that is weak then encode a long call - flag in the function name, otherwise if the function is static or - or known to be defined in this file then encode a short call flag. - This macro is used inside the ENCODE_SECTION macro. */ -#define ARM_ENCODE_CALL_TYPE(decl) \ - if (TREE_CODE_CLASS (TREE_CODE (decl)) == 'd') \ - { \ - if (TREE_CODE (decl) == FUNCTION_DECL && DECL_WEAK (decl)) \ - arm_encode_call_attribute (decl, LONG_CALL_FLAG_CHAR); \ - else if (! TREE_PUBLIC (decl)) \ - arm_encode_call_attribute (decl, SHORT_CALL_FLAG_CHAR); \ - } - -/* Symbols in the text segment can be accessed without indirecting via the - constant pool; it may take an extra binary operation, but this is still - faster than indirecting via memory. Don't do this when not optimizing, - since we won't be calculating al of the offsets necessary to do this - simplification. */ -/* This doesn't work with AOF syntax, since the string table may be in - a different AREA. */ -#ifndef AOF_ASSEMBLER -#define ENCODE_SECTION_INFO(decl, first) \ -{ \ - if (optimize > 0 && TREE_CONSTANT (decl) \ - && (!flag_writable_strings || TREE_CODE (decl) != STRING_CST)) \ - { \ - rtx rtl = (TREE_CODE_CLASS (TREE_CODE (decl)) != 'd' \ - ? TREE_CST_RTL (decl) : DECL_RTL (decl)); \ - SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1; \ - } \ - if (first) \ - ARM_ENCODE_CALL_TYPE (decl) \ -} -#else -#define ENCODE_SECTION_INFO(decl, first) \ -{ \ - if (first) \ - ARM_ENCODE_CALL_TYPE (decl) \ -} -#endif - #define ARM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL) \ arm_encode_call_attribute (DECL, SHORT_CALL_FLAG_CHAR) diff --git a/gcc/config/arm/pe.c b/gcc/config/arm/pe.c index 7fb0ed9b5df..de745586dc2 100644 --- a/gcc/config/arm/pe.c +++ b/gcc/config/arm/pe.c @@ -204,14 +204,12 @@ arm_mark_dllimport (decl) XEXP (DECL_RTL (decl), 0) = newrtl; } -/* Cover function to implement ENCODE_SECTION_INFO. */ - void arm_pe_encode_section_info (decl, first) tree decl; int first ATTRIBUTE_UNUSED; { - /* This bit is copied from arm.h. */ + /* This bit is copied from arm_encode_section_info. */ if (optimize > 0 && TREE_CONSTANT (decl) && (!flag_writable_strings || TREE_CODE (decl) != STRING_CST)) { diff --git a/gcc/config/arm/pe.h b/gcc/config/arm/pe.h index 72fa77d44e3..38727dad8ed 100644 --- a/gcc/config/arm/pe.h +++ b/gcc/config/arm/pe.h @@ -94,17 +94,6 @@ Boston, MA 02111-1307, USA. */ 1,1,1 \ } -/* In addition to the stuff done in arm.h, we must mark dll symbols specially. - Definitions of dllexport'd objects install some info in the .drectve - section. References to dllimport'd objects are fetched indirectly via - __imp_. If both are declared, dllexport overrides. - This is also needed to implement one-only vtables: they go into their own - section and we need to set DECL_SECTION_NAME so we do that here. - Note that we can be called twice on the same decl. */ -#undef ENCODE_SECTION_INFO -#define ENCODE_SECTION_INFO(DECL, FIRST) \ - arm_pe_encode_section_info (DECL, FIRST) - /* Define this macro if in some cases global symbols from one translation unit may not be bound to undefined symbols in another translation unit without user intervention. For instance, under Microsoft Windows @@ -200,13 +189,13 @@ Boston, MA 02111-1307, USA. */ /* A list of other sections which the compiler might be "in" at any given time. */ -#undef SUBTARGET_EXTRA_SECTIONS -#define SUBTARGET_EXTRA_SECTIONS in_drectve, +#undef EXTRA_SECTIONS +#define EXTRA_SECTIONS in_drectve /* A list of extra section function definitions. */ -#undef SUBTARGET_EXTRA_SECTION_FUNCTIONS -#define SUBTARGET_EXTRA_SECTION_FUNCTIONS \ +#undef EXTRA_SECTION_FUNCTIONS +#define EXTRA_SECTION_FUNCTIONS \ DRECTVE_SECTION_FUNCTION \ SWITCH_TO_SECTION_FUNCTION @@ -239,7 +228,7 @@ switch_to_section (section, decl) \ case in_text: text_section (); break; \ case in_data: data_section (); break; \ case in_named: named_section (decl, NULL, 0); break; \ - case in_rdata: rdata_section (); break; \ + case in_readonly_data: readonly_data_section (); break; \ case in_ctors: ctors_section (); break; \ case in_dtors: dtors_section (); break; \ case in_drectve: drectve_section (); break; \ |