diff options
author | Georg-Johann Lay <avr@gjlay.de> | 2024-01-18 09:59:38 +0100 |
---|---|---|
committer | Georg-Johann Lay <avr@gjlay.de> | 2024-01-18 10:01:16 +0100 |
commit | f8138d7e2671a267d65eca053b6a133b9c681734 (patch) | |
tree | 679d5a315beb325bf6f872856989d18c6478cfd9 /gcc/config/avr | |
parent | 2341df1cb9b3681bfefe29207887b2b3dc271a95 (diff) | |
download | gcc-f8138d7e2671a267d65eca053b6a133b9c681734.zip gcc-f8138d7e2671a267d65eca053b6a133b9c681734.tar.gz gcc-f8138d7e2671a267d65eca053b6a133b9c681734.tar.bz2 |
AVR: Fix typo in device-specs generation. Reuse -m[no-]rodata-in-ram checker.
gcc/
* config/avr/gen-avr-mmcu-specs.cc (diagnose_rodata_in_ram): Fix typo
in the diagnostic, and capitalize the device name.
(print_mcu): Generate specs such that:
<*check_rodata_in_ram>: New.
<*cc1_misc>: Use check_rodata_in_ram instead of cc1_rodata_in_ram.
<*link_misc>: Use check_rodata_in_ram instead of link_rodata_in_ram.
<*cc1_rodata_in_ram, *link_rodata_in_ram>: Remove.
Diffstat (limited to 'gcc/config/avr')
-rw-r--r-- | gcc/config/avr/gen-avr-mmcu-specs.cc | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/gcc/config/avr/gen-avr-mmcu-specs.cc b/gcc/config/avr/gen-avr-mmcu-specs.cc index eb9ab88..72841b1 100644 --- a/gcc/config/avr/gen-avr-mmcu-specs.cc +++ b/gcc/config/avr/gen-avr-mmcu-specs.cc @@ -143,22 +143,28 @@ diagnose_mrodata_in_ram (FILE *f, const char *spec, const avr_mcu_t *mcu) const bool rodata_in_flash = (arch_id == ARCH_AVRTINY || (arch_id == ARCH_AVRXMEGA3 && have_avrxmega3_rodata_in_flash)); + // Device name as used by the vendor, extracted from "__AVR_<Name>__". + char mcu_Name[50] = { 0 }; + if (! is_arch) + snprintf (mcu_Name, 1 + strlen (mcu->macro) - strlen ("__AVR___"), + "%s", mcu->macro + strlen ("__AVR_")); + fprintf (f, "%s:\n", spec); if (rodata_in_flash && is_arch) - fprintf (f, "\t%%{mrodata-in-ram: %%e-mrodata-in-ram not supported" + fprintf (f, "\t%%{mrodata-in-ram: %%e-mrodata-in-ram is not supported" " for %s}", mcu->name); else if (rodata_in_flash) - fprintf (f, "\t%%{mrodata-in-ram: %%e-mrodata-in-ram not supported" - " for %s (arch=%s)}", mcu->name, arch->name); + fprintf (f, "\t%%{mrodata-in-ram: %%e-mrodata-in-ram is not supported" + " for %s (arch=%s)}", mcu_Name, arch->name); else if (is_arch) { if (! have_flmap2 && ! have_flmap4) - fprintf (f, "\t%%{mno-rodata-in-ram: %%e-mno-rodata-in-ram not" + fprintf (f, "\t%%{mno-rodata-in-ram: %%e-mno-rodata-in-ram is not" " supported for %s}", mcu->name); } else if (! have_flmap) - fprintf (f, "\t%%{mno-rodata-in-ram: %%e-mno-rodata-in-ram not supported" - " for %s (arch=%s)}", mcu->name, arch->name); + fprintf (f, "\t%%{mno-rodata-in-ram: %%e-mno-rodata-in-ram is not supported" + " for %s (arch=%s)}", mcu_Name, arch->name); fprintf (f, "\n\n"); } @@ -265,6 +271,9 @@ print_mcu (const avr_mcu_t *mcu) } #endif // WITH_AVRLIBC + // Diagnose usage of -m[no-]rodata-in-ram. + diagnose_mrodata_in_ram (f, "*check_rodata_in_ram", mcu); + // avr-gcc specific specs for the compilation / the compiler proper. int n_flash = 1 + (mcu->flash_size - 1) / 0x10000; @@ -285,9 +294,7 @@ print_mcu (const avr_mcu_t *mcu) : "\t%{mabsdata}"); // -m[no-]rodata-in-ram basically affects linking, but sanity-check early. - diagnose_mrodata_in_ram (f, "*cc1_rodata_in_ram", mcu); - - fprintf (f, "*cc1_misc:\n\t%%(cc1_rodata_in_ram)\n\n"); + fprintf (f, "*cc1_misc:\n\t%%(check_rodata_in_ram)\n\n"); // avr-gcc specific specs for assembling / the assembler. @@ -332,9 +339,6 @@ print_mcu (const avr_mcu_t *mcu) fprintf (f, "*link_relax:\n\t%s\n\n", LINK_RELAX_SPEC); - // -m[no-]rodata-in-ram affects linking. Sanity check its usage. - diagnose_mrodata_in_ram (f, "*link_rodata_in_ram", mcu); - fprintf (f, "*link_arch:\n\t%s", link_arch_spec); if (is_device && flash_pm_offset) @@ -356,7 +360,8 @@ print_mcu (const avr_mcu_t *mcu) fprintf (f, "\n\n"); } - fprintf (f, "*link_misc:\n\t%%(link_rodata_in_ram)\n\n"); + // -m[no-]rodata-in-ram affects linking. Sanity check its usage. + fprintf (f, "*link_misc:\n\t%%(check_rodata_in_ram)\n\n"); // Specs known to GCC. |