diff options
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/ft32/ft32.c | 43 | ||||
-rw-r--r-- | gcc/config/ft32/ft32.h | 10 |
2 files changed, 53 insertions, 0 deletions
diff --git a/gcc/config/ft32/ft32.c b/gcc/config/ft32/ft32.c index 26e5a92195a..216a8040428 100644 --- a/gcc/config/ft32/ft32.c +++ b/gcc/config/ft32/ft32.c @@ -35,6 +35,7 @@ #include "calls.h" #include "expr.h" #include "builtins.h" +#include "print-tree.h" /* This file should be included last. */ #include "target-def.h" @@ -895,6 +896,48 @@ yes: return 1; } +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO ft32_elf_encode_section_info + +void +ft32_elf_encode_section_info (tree decl, rtx rtl, int first) +{ + enum tree_code code; + rtx symbol; + + /* Careful not to prod global register variables. */ + if (!MEM_P (rtl)) + return; + symbol = XEXP (rtl, 0); + if (GET_CODE (symbol) != SYMBOL_REF) + return; + + default_encode_section_info (decl, rtl, first); + + code = TREE_CODE (decl); + switch (TREE_CODE_CLASS (code)) + { + case tcc_declaration: + { + tree type = TREE_TYPE (decl); + int is_flash = (type && TYPE_P (type) + && !ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (type))); + if ((code == VAR_DECL) && !is_flash) + SYMBOL_REF_FLAGS (symbol) |= 0x1000; + } + break; + + case tcc_constant: + case tcc_exceptional: + if (code == STRING_CST) + SYMBOL_REF_FLAGS (symbol) |= 0x1000; + break; + + default: + break; + } +} + struct gcc_target targetm = TARGET_INITIALIZER; #include "gt-ft32.h" diff --git a/gcc/config/ft32/ft32.h b/gcc/config/ft32/ft32.h index 7c3a678b9a7..dd40b1de0b6 100644 --- a/gcc/config/ft32/ft32.h +++ b/gcc/config/ft32/ft32.h @@ -506,4 +506,14 @@ do { \ extern int ft32_is_mem_pm(rtx o); +#define ASM_OUTPUT_SYMBOL_REF(stream, sym) \ + do { \ + assemble_name (stream, XSTR (sym, 0)); \ + int section_debug = in_section && \ + (SECTION_STYLE (in_section) == SECTION_NAMED) && \ + (in_section->named.common.flags & SECTION_DEBUG); \ + if (!section_debug && SYMBOL_REF_FLAGS (sym) & 0x1000) \ + asm_fprintf (stream, "-0x800000"); \ + } while (0) + #endif /* GCC_FT32_H */ |