[3/21] Keep .text, .data and .bss on AIX

Nick Clifton nickc@redhat.com
Thu Mar 12 16:36:00 GMT 2009


Hi Richard,

> ld/
> 	* emultempl/aix.em (gld${EMULATION_NAME}_before_allocation): Mark
> 	.text, .data and .bss output sections as SEC_KEEP.
> 
> ld/testsuite/
> 	* ld-powerpc/aix-core-sec-1.s, ld-powerpc/aix-core-sec-1.ex,
> 	ld-powerpc/aix-core-sec-1.hd, ld-powerpc/aix-core-sec-2.s,
> 	ld-powerpc/aix-core-sec-2.ex, ld-powerpc/aix-core-sec-2.hd,
> 	ld-powerpc/aix-core-sec-3.s, ld-powerpc/aix-core-sec-3.ex,
> 	ld-powerpc/aix-core-sec-3.hd: New tests.
> 	* ld-powerpc/aix52.exp: New harness.

Approved - please apply, but ...

> +  /* We must always have .text, .data and .bss output sections, so that
> +     the header can refer to them.  The kernel refuses to load shared
> +     objects that have missing sections.  */
> +  for (i = 0; i < ARRAY_SIZE (must_keep_sections); i++)
> +    {
> +      asection *sec;
> +
> +      sec = bfd_get_section_by_name (link_info.output_bfd,
> +				     must_keep_sections[i]);
> +      if (sec)
> +	sec->flags |= SEC_KEEP;
> +    }

Should a warning be issued if one of these must-keep sections cannot be 
found ?  Presumably this would only matter if they are missing in the 
output bfd (and the bfd is an executabe or shared library) so maybe this 
is not the right place for such a test.

Cheers
   Nick



More information about the Binutils mailing list