[RFA] Linker script extension SECTION_FLAGS

Catherine Moore clm@codesourcery.com
Wed May 18 19:32:00 GMT 2011

This patch extends the linker script language to include SECTION_FLAGS 
on an output section statement.  The purpose of the flags is to ensure 
that all input sections assigned to the output section either have the 
flags set or cleared.

This version of the patch sets the infrastructure but does not define a 
backend implementation.  I will provide that along with additional 
testcases when I contribute the Powerpc VLE port.

This patch was originally discussed in the thread beginning here:

Does this look okay to install?


2011-05-18  Catherine Moore  <clm@codesourcery.com>

   	* bfdlink.h (flag_type): New enumeration.
         (flag_info_list): New structure.
         (flag_info): New structure.

	* ld.texinfo: Document usage of SECTION_FLAGS.
	* ldgram.y (section): Recognize sect_flags.
	(sect_flags): New rule.
	(sect_flag_list): New rule.
	* ldlang.c (lang_add_section): Check section flags.
	(lang_enter_output_section_statement): Add argument sflags.
	Initialize sflags field in output statement.
	* ldlang.h (lang_output_section_statement_type): Add flag_info field.
	(lang_enter_output_section_statement): New argument sflags.  Update
	all callers.
	* ldlex.l (SECTION_FLAGS): New token.A
	* mri.c (mri_draw_tree): Update argument list for

	* ld-scripts/section-flags-1.exp: New.
         * ld-scripts/section-flags-1.s: New.
         * ld-scripts/section-flags-1.t: New.

	2011-05-18  Catherine Moore  <clm@codesourcery.com>

         * bfd-in2.h: Regenerated.
         * bfd.c (bfd_lookup_section_flags): New definition.
         * binary.c (binary_bfd_lookup_section_flags): New definition.
         * coff-rs6000.c (rs6000coff_vec): Include
         (pmac_xcoff_vec): Likewise.
         * coffcode.h (coff_bfd_lookup_section_flags): New definition.
         * elf-bfd.h (elf_backend_lookup_section_flags_hook): Declare.
         (bfd_elf_lookup_section_flags): Declare.
         * elflink.c (bfd_elf_lookup_section_flags): New function.
         * elfxx-target.h (bfd_elfNN_bfd_lookup_section_flags): Define.
         (elf_backend_lookup_section_flags_hook): Define.
         (elf_backend_data): Add elf_backend_lookup_section_flags_hook.
         * ieee.c (ieee_bfd_lookup_section_flags): New define.
         * ihex.c (ihex_bfd_lookup_section_flags): New define.
         * libbfd-in.h (_bfd_nolink_bfd_lookup_section_flags): Declare.
         (bfd_generic_lookup_section_flags): Declare.
         * libbfd.h: Regenerated.
         * mach-o-target.c (bfd_mach_o_bfd_lookup_section_flags): New.
         * mmo.c (mmo_fd_lookup_section_flags): New definition.
         * oasys.c (oasys_bfd_lookup_section_flags): New definition.
         * pef.c (bfd_pef_bfd_lookup_section_flags): New definition.
         * plugin.c (bfd_plugin_bfd_lookup_section_flags): New definition.
         * ppcboot.c (ppcboot_bfd_lookup_section_flags): New definition.
         * reloc.c (bfd_generic_lookup_section_flags): New function.
         * som.c (som_bfd_lookup_section_flags): New definition.
         * srec.c (srec_bfd_lookup_section_flags): New definition.
         * targets.c (flag_info): Declare.
         (NAME##_bfd_lookup_section_flags): Add to LINK jump table.
         (_bfd_lookup_section_flags): New.
         * tekhex.c (tekhex_bfd_lookup_section_flags): New definition.
         * versados.c (versados_bfd_lookup_section_flags): New definition.
         * vms-alpha.c (alpha_vms_bfd_lookup_section_flag): New definition.
         * xsym.c (bfd_sym_bfd_lookup_section_flags): New definition.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sf.patch
Type: text/x-patch
Size: 36545 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20110518/8575fcde/attachment.bin>

More information about the Binutils mailing list