diff options
author | Georg-Johann Lay <gjl@gcc.gnu.org> | 2017-06-12 12:52:30 +0000 |
---|---|---|
committer | Georg-Johann Lay <gjl@gcc.gnu.org> | 2017-06-12 12:52:30 +0000 |
commit | 3266ddb36a000a6d3fbad3541ffb67ba980e5a67 (patch) | |
tree | a84ea0d61e0bfaf33feebe29b109cc4f0d4b2062 /gcc/config/avr/avr.c | |
parent | 7c41b76e9f61229742328ba95f9085a3460e9a79 (diff) | |
download | gcc-3266ddb36a000a6d3fbad3541ffb67ba980e5a67.zip gcc-3266ddb36a000a6d3fbad3541ffb67ba980e5a67.tar.gz gcc-3266ddb36a000a6d3fbad3541ffb67ba980e5a67.tar.bz2 |
Support multilibs and devices that see flash in RAM address range.
gcc/
Support multilibs and devices that see flash in RAM address range.
PR target/81072
* config/avr/avr-arch.h (avr_arch_id) <ARCH_AVRXMEGA3>: New enum.
(avr_mcu_t) <flash_pm_offset>: New field.
(avr_device_specific_features) <AVR_ISA_RCALL>: New enum.
* config/avr/avr.h (AVR_SHORT_CALLS): New define.
(AVR_HAVE_JMP_CALL): Don't set if AVR_SHORT_CALLS.
(AVR_TINY_PM_OFFSET): Remove macro.
* config/avr/avr.opt (-mshort-calls): New option.
* config/avr/gen-avr-mmcu-specs.c (print_mcu)
[*self_spec]: Add / remove -mshort-calls depending on AVR_ISA_RCALL.
* config/avr/avr-c.c (avr_cpu_cpp_builtins)
<__AVR_SHORT_CALLS__>: Built-in define if AVR_SHORT_CALLS.
<__AVR_HAVE_JMP_CALL__>: Use AVR_HAVE_JMP_CALL as condition
instead of avr_arch->have_jmp_call.
<__AVR_PM_BASE_ADDRESS__>: Built-in define if avr_arch->flash_pm_offset.
[AVR_TINY] <__AVR_TINY_PM_BASE_ADDRESS__>: Use
avr_arch->flash_pm_offset to define.
* config/avr/avr-devices.c (avr_arch_types): Add initializers for
new field flash_pm_offset. Add entry for avrxmega3.
(avr_texinfo): Add entry for avrxmega3.
* config/avr/avr-mcus.def: Add entries for: avrxmega3,
attiny212, attiny214,
attiny412, attiny414, attiny416, attiny417,
attiny814, attiny816, attiny817,
attiny1614, attiny1616, attiny1617,
attiny3214, attiny3216, attiny3217.
* config/avr/avr.c (avr_assemble_integer)[AVR_TINY]: Use
avr_arch->flash_pm_offset instead of AVR_TINY_PM_OFFSET.
(avr_print_operand_address) [AVR_TINY]: Same.
(avr_asm_init_sections) <readonly_data_section>: Only patch
callback if avr_arch->flash_pm_offset = 0.
(avr_asm_named_section) <avr_need_copy_data_p>: Skip setting it
for rodata if avr_arch->flash_pm_offset != 0.
(avr_encode_section_info) [AVR_TINY]: Adjust comment.
* config/avr/genmultilib.awk (dir_rcall, opt_rcall): New vars.
(opts) [AVR_ISA_RCALL]: Append opt_rcall.
(m_options): Append opt_rcall.
(m_dirnames): Append dir_rcall.
* config/avr/t-multilib: Regenerate.
* configure.ac [target=avr]: Check whether avrxmega3 default
linker description file works as needed.
* configure: Regenerate.
* doc/avr-mmcu.texi: Regenerate.
* doc/invoke.texi (AVR Options) <-mshort-calls>: Document it.
<__AVR_ARCH__>: Document avrxmega3 and 103.
<__AVR_HAVE_JMP_CALL__>: Adjust documentation.
<__AVR_SHORT_CALLS__>: Document it.
<__AVR_PM_BASE_ADDRESS__>: Document it.
* doc/extend.texi (AVR Options) <-mshort-calls>: Document it.
(AVR Variable Attributes) <progmem>: Document this is
not needed for avrxmega3.
(AVR Named Address Spaces) <__flash>: Dito.
From-SVN: r249124
Diffstat (limited to 'gcc/config/avr/avr.c')
-rw-r--r-- | gcc/config/avr/avr.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 648a125..4f385d5 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -2502,7 +2502,7 @@ avr_print_operand_address (FILE *file, machine_mode /*mode*/, rtx addr) if (AVR_TINY && avr_address_tiny_pm_p (addr)) { - addr = plus_constant (Pmode, addr, AVR_TINY_PM_OFFSET); + addr = plus_constant (Pmode, addr, avr_arch->flash_pm_offset); } switch (GET_CODE (addr)) @@ -9398,7 +9398,7 @@ avr_assemble_integer (rtx x, unsigned int size, int aligned_p) if (AVR_TINY && avr_address_tiny_pm_p (x)) { - x = plus_constant (Pmode, x, AVR_TINY_PM_OFFSET); + x = plus_constant (Pmode, x, avr_arch->flash_pm_offset); } return default_assemble_integer (x, size, aligned_p); @@ -9998,9 +9998,11 @@ static void avr_asm_init_sections (void) { /* Override section callbacks to keep track of `avr_need_clear_bss_p' - resp. `avr_need_copy_data_p'. */ + resp. `avr_need_copy_data_p'. If flash is not mapped to RAM then + we have also to track .rodata because it is located in RAM then. */ - readonly_data_section->unnamed.callback = avr_output_data_section_asm_op; + if (0 == avr_arch->flash_pm_offset) + readonly_data_section->unnamed.callback = avr_output_data_section_asm_op; data_section->unnamed.callback = avr_output_data_section_asm_op; bss_section->unnamed.callback = avr_output_bss_section_asm_op; } @@ -10032,9 +10034,13 @@ avr_asm_named_section (const char *name, unsigned int flags, tree decl) if (!avr_need_copy_data_p) avr_need_copy_data_p = (STR_PREFIX_P (name, ".data") - || STR_PREFIX_P (name, ".rodata") || STR_PREFIX_P (name, ".gnu.linkonce.d")); + if (!avr_need_copy_data_p + && 0 == avr_arch->flash_pm_offset) + avr_need_copy_data_p = (STR_PREFIX_P (name, ".rodata") + || STR_PREFIX_P (name, ".gnu.linkonce.r")); + if (!avr_need_clear_bss_p) avr_need_clear_bss_p = STR_PREFIX_P (name, ".bss"); @@ -10201,7 +10207,7 @@ avr_encode_section_info (tree decl, rtx rtl, int new_decl_p) if (progmem_p) { - // Tag symbols for later addition of 0x4000 (AVR_TINY_PM_OFFSET). + // Tag symbols for addition of 0x4000 (avr_arch->flash_pm_offset). SYMBOL_REF_FLAGS (sym) |= AVR_SYMBOL_FLAG_TINY_PM; } |