[patch] AVR: Tidy bfd/elf32-avr.c
Georg-Johann Lay
avr@gjlay.de
Sun Aug 16 10:26:06 GMT 2026
Approved here:
https://gcc.gnu.org/pipermail/gcc-patches/2026-August/727700.html
Applied as:
https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=ac05a510ce55837e3622832eceaa274d823893a6
Johann
Am 11.08.26 um 10:34 schrieb Georg-Johann Lay via Binutils:
> This patch is a code cleanup for bfd/elf32-avr.c, in particular
> the code in elf32_avr_relax_section which was long spaghetti with
> indentation levels of 8 and more, which made the code harder to
> grasp than necessary.
>
> Now it uses new helper functions like avr_local_label_at and
> avr_is_RCALL.
>
> It also uses more C99 features like bool and for loop variables.
> It uses ARRAY_SIZE if applicable, and uses XXX_t typedefs instead
> of struct XXX. It also avoids using the same names for structs
> and objects.
>
> The change is a no-op, though some of the --debug-relax messages
> have been adjusted / unified, which has no impact on the testsuite.
>
> There are no new regressions when tested in the GCC testsuite,
> both with and without -mrelax.
>
> Ok for trunk?
>
> Johann
>
> --
>
> bfd/
> * elf32-avr.c (libiberty.h): Include for ARRAY_SIZE.
> (struct avr_reloc_map): Use typedef avr_reloc_map_t instead
> so we don't have the same name for an object and a type.
> (struct elf32_avr_stub_hash_entry): Use typedef
> elf32_avr_stub_hash_entry_t.
> (struct struct elf32_avr_link_hash_table): Use typedef
> elf32_avr_link_hash_table_t.
> (struct avr_relax_info): Use avr_relax_info_t.
> (struct elf_avr_section_data): use elf_avr_section_data_t.
> (avr_replace_call_ret_sequences): Is bool.
> (bfd_elf32_bfd_reloc_type_lookup): Use C99 loops.
> (elf32_avr_relax_delete_bytes): Use C99 loops.
> (avr_load_all_property_sections): Same.
> (avr_word): New static function.
> (avr_is_CALL): New static function outsourced from
> elf32_avr_relax_section.
> (avr_is_JMP): Same.
> (avr_is_RCALL): Same.
> (avr_is_RJMP): Same.
> (avr_is_RET): Same.
> (avr_is_skip): Same.
> (avr_read_symbuf): Same.
> (avr_local_label_at): Same.
> (avr_global_label_at): Same.
> (avr_reloc_at): Same.
> (elf32_avr_relax_section): Outsource functionality to the
> new static functions above.
More information about the Binutils
mailing list