INPUT_SECTION_FLAGS broken (Was: [RFA] PowerPC VLE port)

Alan Modra
Wed May 9 03:54:00 GMT 2012

On Tue, May 08, 2012 at 03:54:24PM -0400, James Lemke wrote:
> Alan,
> I have incorporated your suggestions regarding section flags.
> Updated patches are attached.

Thanks for your patience.  This is OK to commit except

> 	* elf32-ppc.c (ppc_elf_modify_segment_map): New function.
> 	(elf_backend_modify_segment_map): Define.
> 	(has_tls_reloc, has_tls_get_addr_call): Moved out.

Please don't move these flags out of elf32-ppc.c into elf/ppc.h, or
put your new has_vle_insns flag in elf/ppc.h.  They don't really
belong there.  This too is a little sloppy:

> +  /* Disassemble according to the section headers flags for VLE-mode.  */
> +  if (dialect & PPC_OPCODE_VLE
> +      && info->section->has_vle_insns)
> +    return dialect;

What if you're disassembling a ppc64 object file where sec_flg2 has a
different meaning?  Fix this by passing info->section to a predicate
function living in elf32-ppc.c something along the lines of

is_ppc_vle (asection *sec)
  return (sec->owner != NULL
	  && is_ppc_elf (sec->owner)
	  && sec->has_vle_insns);

Declare in, I dunno, elf32-ppc.h preferably but this will require
you to pull other headers into ppc-dis.h.  elf-bfd.h as a last resort.

-/* This bit is reserved by BFD for processor specific stuff.  Name
-   it properly so that we can easily stay consistent elsewhere.  */
went quite a while ago, which you'll discover when you try to commit
the patch.  Please fix corresponding changelog.

There are a few other things that need tidying but we can address them
once you've committed your patch.

Alan Modra
Australia Development Lab, IBM

More information about the Binutils mailing list