From deee88e9810fe5a3e73b071713ff6fa03b5c016d Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 4 Sep 2018 10:13:26 +0930 Subject: [PATCH] PR23570, AVR .noinit section defaults to PROGBITS Revert commit 8744470deab and instead use the standard special_sections support. PR 23570 bfd/ * elf32-avr.c (elf_avr_special_sections): New. (elf_backend_special_sections): Define. gas/ * config/tc-avr.c: Revert 2018-09-03 change. --- bfd/ChangeLog | 6 ++++++ bfd/elf32-avr.c | 7 +++++++ gas/ChangeLog | 5 +++++ gas/config/tc-avr.c | 19 ------------------- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index bc1cb15..a499105 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2018-09-06 Alan Modra + + PR 23570 + * elf32-avr.c (elf_avr_special_sections): New. + (elf_backend_special_sections): Define. + 2018-09-04 Jose E. Marchesi * elfxx-sparc.c (_bfd_sparc_elf_info_to_howto): Do not issue an diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c index 6d38d1d..13e28d8 100644 --- a/bfd/elf32-avr.c +++ b/bfd/elf32-avr.c @@ -708,6 +708,12 @@ static const struct avr_reloc_map avr_reloc_map[] = { BFD_RELOC_32_PCREL, R_AVR_32_PCREL} }; +static const struct bfd_elf_special_section elf_avr_special_sections[] = +{ + { STRING_COMMA_LEN (".noinit"), 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, + { NULL, 0, 0, 0, 0 } +}; + /* Meant to be filled one day with the wrap around address for the specific device. I.e. should get the value 0x4000 for 16k devices, 0x8000 for 32k devices and so on. @@ -4256,5 +4262,6 @@ avr_elf32_property_record_name (struct avr_property_record *rec) #define bfd_elf32_bfd_get_relocated_section_contents \ elf32_avr_get_relocated_section_contents #define bfd_elf32_new_section_hook elf_avr_new_section_hook +#define elf_backend_special_sections elf_avr_special_sections #include "elf32-target.h" diff --git a/gas/ChangeLog b/gas/ChangeLog index 6d55671..310bf6e 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2018-09-06 Alan Modra + + PR 23570 + * config/tc-avr.c: Revert 2018-09-03 change. + 2018-09-04 Daniel Cederman * config/tc-sparc.c (md_assemble): Allow non-fpop2 instructions diff --git a/gas/config/tc-avr.c b/gas/config/tc-avr.c index edf60f4..d628c95 100644 --- a/gas/config/tc-avr.c +++ b/gas/config/tc-avr.c @@ -481,13 +481,11 @@ const char EXP_CHARS[] = "eE"; const char FLT_CHARS[] = "dD"; static void avr_set_arch (int); -static void avr_set_section (int); /* The target specific pseudo-ops which we support. */ const pseudo_typeS md_pseudo_table[] = { {"arch", avr_set_arch, 0}, - {"section", avr_set_section, 0}, { NULL, NULL, 0} }; @@ -704,23 +702,6 @@ avr_set_arch (int dummy ATTRIBUTE_UNUSED) bfd_set_arch_mach (stdoutput, TARGET_ARCH, avr_mcu->mach); } -static void -avr_set_section (int push) -{ - obj_elf_section (push); - - /* PR 23570. The .noinit section needs to be explicitly - set to the NOBITS type. */ - if (seg_info (now_seg)->bss == 0 - && strcmp (bfd_get_section_name (stdoutput, now_seg), ".noinit") == 0) - { - bfd_set_section_flags (stdoutput, now_seg, SEC_ALLOC | SEC_RELOC); - seg_info (now_seg)->bss = 1; - elf_section_type (now_seg) = SHT_NOBITS; - elf_section_flags (now_seg) = SHF_ALLOC | SHF_WRITE; - } -} - int md_parse_option (int c, const char *arg) { -- 2.7.4