[PATCH 8/9] [gas] Introduce new section flag: SEC_ELF_OCTETS

Alan Modra amodra@gmail.com
Wed Nov 20 00:18:00 GMT 2019


On Sun, Nov 17, 2019 at 12:21:29AM +0100, Christian Eggers wrote:
> --- a/gas/dwarf2dbg.c
> +++ b/gas/dwarf2dbg.c
> @@ -162,6 +162,13 @@
>  #define TC_PARSE_CONS_RETURN_NONE BFD_RELOC_NONE
>  #endif
> 
> +#ifdef OBJ_ELF
> +/* On ELF platforms, mark debug sections with SEC_ELF_OCTETS */
> +#define SEC_OCTETS SEC_ELF_OCTETS
> +#else
> +#define SEC_OCTETS 0
> +#endif
> +

This isn't quite correct.  The right way to conditionally set flags is
like the following from write.c:

#if defined OBJ_ELF || defined OBJ_MAYBE_ELF
  if (IS_ELF && flag_use_elf_stt_common)
    stdoutput->flags |= BFD_CONVERT_ELF_COMMON | BFD_USE_ELF_STT_COMMON;
#endif

So you probably should use

#if defined OBJ_ELF || defined OBJ_MAYBE_ELF
/* On ELF platforms, mark debug sections with SEC_ELF_OCTETS */
#define SEC_OCTETS (IS_ELF ? SEC_ELF_OCTETS : 0)
#else
#define SEC_OCTETS 0
#endif

Pedantically, it's fine to just use #ifdef OBJ_ELF rather than the
explicit #if defined OBJ_ELF || defined OBJ_MAYBE_ELF since it happens
that OBJ_MAYBE_ELF results in gas/config/obj-elf.h being included from
gas/config/obj-multi.h and OBJ_ELF being defined, but I think it's
better to reference OBJ_MAYBE_ELF to make the code clearer.

I don't know whether we should worry too much about continuing to
support multi-object emulation..  One of the configurations that
supported multiple object formats in gas, --target=i586-elf
--enable-targets=i586-coff,i586-aout, is no longer supported.
However, you can still get an x86 gas that supports multiple 
emulations with --target=i586-elf --enable-targets=all.

-- 
Alan Modra
Australia Development Lab, IBM



-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list