[PATCH v1 0/4] [RFC] Provide a target-specific definition to enable/disable section of code in others modules than gas
Alan Modra
amodra@gmail.com
Wed Dec 11 22:02:32 GMT 2024
On Wed, Dec 11, 2024 at 12:05:49PM +0000, Matthieu Longo wrote:
> I am not sure if this approach is correct as it duplicates the
> declaration of the `TC_<arch>` definition in several modules.
It can't be correct in any file like bfd/elf-eh-frame.c or
binutils/dwarf.c that is compiled once but needs to support multiple
architectures. Instead you should handle architecture specific dwarf
code at runtime using bfd_get_arch (and if necessary, bfd_get_mach).
See for example dwarf.c:init_dwarf_regnames_by_bfd_arch_and_mach or
the switch in elf-eh-frame.c:_bfd_elf_write_section_eh_frame on
abfd->arch_info->arch.
--
Alan Modra
More information about the Binutils
mailing list