This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PING Re: [RFA] Linker script extension SECTION_FLAGS


Hi Nick,

Thanks for the patch review. I've developed a new patch that addresses the comments that both you and Tristan made regarding the original patch. I've now associated the INPUT_SECTION_FLAGS with the input section specifications instead of the output sectionas you and others suggested. I've tested arm-coff, mips-elf and ppc-elf. What do you think? Is this okay to commit?

Thanks,
Catherine

Does
On 06/07/2011 09:11 AM, Nick Clifton wrote:
Hi Catherine,

Hi, Do any of the maintainers have time to review this patch?

Did you see Tristan's follow up comments on your patch ?


http://sources.redhat.com/ml/binutils/2011-05/msg00350.html


Some of the comments in the code need clarification:


+ /* Remove sections with incorrect flags. */
+ void (*_bfd_lookup_section_flags) (struct bfd_link_info *,
+ struct flag_info *);

I think that you mean "Sets the bitmasks of allowed and disallowed
section flags" or something like that. It does not actually remove
sections at all...

+ /* This function, if defined, is called to the section flag hex value. */
+ void (*elf_backend_lookup_section_flags_hook)

The comment here should presumably be: "This function, if defined, is
called to convert target specific section flags names into hex values."



There appears to be a bug in the change to lang_add_section():

+ if (output->sectflags->only_with_flags != 0
+ && (output->sectflags->only_with_flags & section->flags) == 0)
+ return;

I think that this will accept any section that contains any combination
of any of the required flags, rather than only those sections that
contain all of the required flags. Ie, I think that the test should be:

+ if (output->sectflags->only_with_flags != 0
+ && (output->sectflags->only_with_flags & section->flags) !=
output->sectflags->only_with_flags)
+ return;

Either this, or the documentation of how INPUT_SECTION_FLAGS works is
wrong.

Following on from this, what would a linker script writer do if they
wanted to include multiple, different sets of input section flags in
their output section. As I read the current the proposed documentation
this cannot be done. I suppose that you could add a comma separated
syntax, ala:

INPUT_SECTON_FLAGS (SHF_WRITE & SHF_ALLOC, SHF_WRITE & SHF_STRINGS)

But it might be better to go with Ian Lance Taylor's suggestion of
putting the constraint *inside* the output section description. Ie
something like this:

.text : {
SECTION_FLAGS(SHF_WRITE & SHF_STRINGS, *(.text))
SECTION_FLAGS(SHF_WRITE & SHF_ALLOC, *(.text))
}


In the new bfd_elf_lookup_sections_flags() function there is an awful lot of repeated, almost identical code:

+ if (!strcmp (tf->name, "SHF_WRITE"))
+ {
+ if (tf->with == with_flags)
+ with_hex |= SHF_WRITE;
+ else if (tf->with == without_flags)
+ without_hex |= SHF_WRITE;
+ }

It would be much cleaner to use an array of section names and flags and
iterate through it.


Some of the fields in the flag_info structure ought be changed:


+/* Section flag info. */
+struct flag_info
+{
+ unsigned only_with_flags;
+ unsigned not_with_flags;
+ struct flag_info_list *flag_list;
+ int done;
+};

The only_with_flags and not_with_flags fields should be of the type
"flagword". The "done" field should be a bfd_boolean and IMHO should be
renamed to a slightly more descriptive term such as "flags_initialised".

Cheers
Nick

Attachment: include.cl
Description: Text document

Index: bfdlink.h
===================================================================
RCS file: /cvs/src/src/include/bfdlink.h,v
retrieving revision 1.88
diff -u -r1.88 bfdlink.h
--- bfdlink.h	20 Jun 2011 13:18:48 -0000	1.88
+++ bfdlink.h	22 Jun 2011 20:40:13 -0000
@@ -224,6 +224,26 @@
   RM_GENERATE_ERROR
 };
 
+typedef enum {with_flags, without_flags} flag_type;
+
+/* A section flag list.  */
+struct flag_info_list
+{
+  flag_type with; 
+  const char *name;
+  bfd_boolean valid;
+  struct flag_info_list *next;
+};
+
+/* Section flag info.  */
+struct flag_info
+{
+  flagword only_with_flags;
+  flagword not_with_flags;
+  struct flag_info_list *flag_list;
+  bfd_boolean flags_initialized;
+};
+
 struct bfd_elf_dynamic_list;
 
 /* This structure holds all the information needed to communicate

Attachment: ld.cl
Description: Text document

Index: ld.h
===================================================================
--- ld.h	(revision 329725)
+++ ld.h	(working copy)
@@ -95,6 +95,7 @@ struct wildcard_spec {
   const char *name;
   struct name_list *exclude_name_list;
   sort_type sorted;
+  struct flag_info *section_flag_list;
 };
 
 struct wildcard_list {
Index: testsuite/ld-scripts/section-flags-1.s
===================================================================
--- testsuite/ld-scripts/section-flags-1.s	(revision 0)
+++ testsuite/ld-scripts/section-flags-1.s	(revision 0)
@@ -0,0 +1,2 @@
+	.text
+	.space 16
Index: testsuite/ld-scripts/section-flags-1.t
===================================================================
--- testsuite/ld-scripts/section-flags-1.t	(revision 0)
+++ testsuite/ld-scripts/section-flags-1.t	(revision 0)
@@ -0,0 +1,17 @@
+MEMORY
+{
+  ram (rwx) : ORIGIN = 0x100000, LENGTH = 144M
+}
+
+SECTIONS
+{
+  .text :
+  {
+    INPUT_SECTION_FLAGS (!SHF_TLS) *(.text .text.* .text_* .gnu.linkonce.t.*)
+  } >ram
+
+  .text_vle : 
+  {
+    INPUT_SECTION_FLAGS (SHF_MERGE & SHF_STRINGS & SHF_LINK_ORDER) *(.text .text.* .text_* .gnu.linkonce.t.*)
+  } >ram
+}
Index: testsuite/ld-scripts/section-flags.exp
===================================================================
--- testsuite/ld-scripts/section-flags.exp	(revision 0)
+++ testsuite/ld-scripts/section-flags.exp	(revision 0)
@@ -0,0 +1,45 @@
+# Test SECTION_FLAGS in a linker script.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+set testname "SECTION_FLAGS-1"
+
+if ![ld_assemble $as $srcdir/$subdir/section-flags-1.s tmpdir/section-flags-1.o] {
+    unresolved $testname
+    return
+}
+
+if ![ld_simple_link $ld tmpdir/section-flags-1 "-T $srcdir/$subdir/section-flags-1.t tmpdir/section-flags-1.o"] {
+    fail $testname
+    return
+}
+
+pass $testname
+
+set testname "SECTION_FLAGS-2"
+if ![ld_assemble $as $srcdir/$subdir/section-flags-2.s tmpdir/section-flags-2.o] {
+    unresolved $testname
+    return
+}
+
+if ![ld_simple_link $ld tmpdir/section-flags-2 "-T $srcdir/$subdir/section-flags-2.t tmpdir/section-flags-1.o tmpdir/section-flags-2.o"] {
+    fail $testname
+    return
+}
+
+pass $testname
Index: testsuite/ld-scripts/section-flags-2.s
===================================================================
--- testsuite/ld-scripts/section-flags-2.s	(revision 0)
+++ testsuite/ld-scripts/section-flags-2.s	(revision 0)
@@ -0,0 +1,2 @@
+	.text
+	.space 16
Index: testsuite/ld-scripts/section-flags-2.t
===================================================================
--- testsuite/ld-scripts/section-flags-2.t	(revision 0)
+++ testsuite/ld-scripts/section-flags-2.t	(revision 0)
@@ -0,0 +1,12 @@
+MEMORY
+{
+  ram (rwx) : ORIGIN = 0x100000, LENGTH = 144M
+}
+
+SECTIONS
+{
+  .text :
+  {
+    INPUT_SECTION_FLAGS (!SHF_TLS) *(EXCLUDE_FILE (section-flags-1.o) .text .text.* .text_* .gnu.linkonce.t.*)
+  } >ram
+}
Index: ldlang.c
===================================================================
--- ldlang.c	(revision 329725)
+++ ldlang.c	(working copy)
@@ -232,6 +232,9 @@ walk_wild_consider_section (lang_wild_st
 {
   struct name_list *list_tmp;
 
+  /* Propagate the section_flag_info from the wild statement to the section.  */
+  s->section_flag_info = ptr->section_flag_list;
+
   /* Don't process sections from files which were excluded.  */
   for (list_tmp = sec->spec.exclude_name_list;
        list_tmp;
@@ -2186,8 +2189,11 @@ lang_add_section (lang_statement_list_ty
 		  lang_output_section_statement_type *output)
 {
   flagword flags = section->flags;
+  struct flag_info *sflag_info = section->section_flag_info;
+
   bfd_boolean discard;
   lang_input_section_type *new_section;
+  bfd *abfd = link_info.output_bfd;
 
   /* Discard sections marked with SEC_EXCLUDE.  */
   discard = (flags & SEC_EXCLUDE) != 0;
@@ -2213,6 +2219,21 @@ lang_add_section (lang_statement_list_ty
       return;
     }
 
+  if (sflag_info)
+    {
+      if (sflag_info->flags_initialized == FALSE)
+	bfd_lookup_section_flags (&link_info, sflag_info);
+
+      if (sflag_info->only_with_flags != 0
+	  && (sflag_info->only_with_flags & flags)
+              != sflag_info->only_with_flags)
+	return;
+
+      if (sflag_info->not_with_flags != 0
+          && (sflag_info->not_with_flags & flags) != 0)
+	return;
+    }
+
   if (section->output_section != NULL)
     return;
 
@@ -6455,6 +6476,7 @@ lang_add_wild (struct wildcard_spec *fil
     {
       new_stmt->filename = filespec->name;
       new_stmt->filenames_sorted = filespec->sorted == by_name;
+      new_stmt->section_flag_list = filespec->section_flag_list;
     }
   new_stmt->section_list = section_list;
   new_stmt->keep_sections = keep_sections;
Index: ldlang.h
===================================================================
--- ldlang.h	(revision 329725)
+++ ldlang.h	(working copy)
@@ -157,6 +157,7 @@ typedef struct lang_output_section_state
   int section_alignment;	/* Alignment of start of section.  */
   int constraint;
   flagword flags;
+  flag_info *sectflags;
   enum section_type sectype;
   unsigned int processed_vma : 1;
   unsigned int processed_lma : 1;
@@ -240,6 +241,8 @@ typedef struct lang_input_statement_stru
 
   bfd *the_bfd;
 
+  struct flag_info *section_flag_list;
+
   /* Point to the next file - whatever it is, wanders up and down
      archives */
   union lang_statement_union *next;
@@ -328,6 +331,7 @@ struct lang_wild_statement_struct
   walk_wild_section_handler_t walk_wild_section_handler;
   struct wildcard_list *handler_data[4];
   lang_section_bst_type *tree;
+  struct flag_info *section_flag_list;
 };
 
 typedef struct lang_address_statement_struct
Index: ldlex.l
===================================================================
--- ldlex.l	(revision 329725)
+++ ldlex.l	(working copy)
@@ -309,6 +309,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([
 <BOTH,SCRIPT>"org"			{ RTOKEN(ORIGIN);}
 <BOTH,SCRIPT>"l"			{ RTOKEN( LENGTH);}
 <BOTH,SCRIPT>"len"			{ RTOKEN( LENGTH);}
+<EXPRESSION,BOTH,SCRIPT>"INPUT_SECTION_FLAGS"	{ RTOKEN(INPUT_SECTION_FLAGS); }
 <EXPRESSION,BOTH,SCRIPT>"INCLUDE"	{ RTOKEN(INCLUDE);}
 <BOTH,SCRIPT>"PHDRS"			{ RTOKEN (PHDRS); }
 <EXPRESSION,BOTH,SCRIPT>"AT"		{ RTOKEN(AT);}
Index: ldgram.y
===================================================================
--- ldgram.y	(revision 329732)
+++ ldgram.y	(working copy)
@@ -72,6 +72,8 @@ static int error_index;
   struct wildcard_spec wildcard;
   struct wildcard_list *wildcard_list;
   struct name_list *name_list;
+  struct flag_info_list *flag_info_list;
+  struct flag_info *flag_info;
   int token;
   union etree_union *etree;
   struct phdr_info
@@ -93,6 +95,8 @@ static int error_index;
 %type <fill> fill_opt fill_exp
 %type <name_list> exclude_name_list
 %type <wildcard_list> file_NAME_list
+%type <flag_info_list> sect_flag_list
+%type <flag_info> sect_flags
 %type <name> memspec_opt casesymlist
 %type <name> memspec_at_opt
 %type <cname> wildcard_name
@@ -148,7 +152,7 @@ static int error_index;
 %token INPUT_SCRIPT INPUT_MRI_SCRIPT INPUT_DEFSYM CASE EXTERN START
 %token <name> VERS_TAG VERS_IDENTIFIER
 %token GLOBAL LOCAL VERSIONK INPUT_VERSION_SCRIPT
-%token KEEP ONLY_IF_RO ONLY_IF_RW SPECIAL
+%token KEEP ONLY_IF_RO ONLY_IF_RW SPECIAL INPUT_SECTION_FLAGS
 %token EXCLUDE_FILE
 %token CONSTANT
 %type <versyms> vers_defns
@@ -433,54 +437,114 @@ wildcard_spec:
 			  $$.name = $1;
 			  $$.sorted = none;
 			  $$.exclude_name_list = NULL;
+			  $$.section_flag_list = NULL;
 			}
 	| 	EXCLUDE_FILE '(' exclude_name_list ')' wildcard_name
 			{
 			  $$.name = $5;
 			  $$.sorted = none;
 			  $$.exclude_name_list = $3;
+			  $$.section_flag_list = NULL;
 			}
 	|	SORT_BY_NAME '(' wildcard_name ')'
 			{
 			  $$.name = $3;
 			  $$.sorted = by_name;
 			  $$.exclude_name_list = NULL;
+			  $$.section_flag_list = NULL;
 			}
 	|	SORT_BY_ALIGNMENT '(' wildcard_name ')'
 			{
 			  $$.name = $3;
 			  $$.sorted = by_alignment;
 			  $$.exclude_name_list = NULL;
+			  $$.section_flag_list = NULL;
 			}
 	|	SORT_BY_NAME '(' SORT_BY_ALIGNMENT '(' wildcard_name ')' ')'
 			{
 			  $$.name = $5;
 			  $$.sorted = by_name_alignment;
 			  $$.exclude_name_list = NULL;
+			  $$.section_flag_list = NULL;
 			}
 	|	SORT_BY_NAME '(' SORT_BY_NAME '(' wildcard_name ')' ')'
 			{
 			  $$.name = $5;
 			  $$.sorted = by_name;
 			  $$.exclude_name_list = NULL;
+			  $$.section_flag_list = NULL;
 			}
 	|	SORT_BY_ALIGNMENT '(' SORT_BY_NAME '(' wildcard_name ')' ')'
 			{
 			  $$.name = $5;
 			  $$.sorted = by_alignment_name;
 			  $$.exclude_name_list = NULL;
+			  $$.section_flag_list = NULL;
 			}
 	|	SORT_BY_ALIGNMENT '(' SORT_BY_ALIGNMENT '(' wildcard_name ')' ')'
 			{
 			  $$.name = $5;
 			  $$.sorted = by_alignment;
 			  $$.exclude_name_list = NULL;
+			  $$.section_flag_list = NULL;
 			}
 	|	SORT_BY_NAME '(' EXCLUDE_FILE '(' exclude_name_list ')' wildcard_name ')'
 			{
 			  $$.name = $7;
 			  $$.sorted = by_name;
 			  $$.exclude_name_list = $5;
+			  $$.section_flag_list = NULL;
+			}
+	;
+
+sect_flag_list:	NAME
+			{
+			  struct flag_info_list *n;
+			  n = ((struct flag_info_list *) xmalloc (sizeof *n));
+			  if ($1[0] == '!')
+			    {
+			      n->with = without_flags;
+			      n->name = &$1[1];
+			    }
+			  else
+			    {
+			      n->with = with_flags;
+			      n->name = $1;
+			    }
+			  n->valid = FALSE;
+			  n->next = NULL;
+			  $$ = n;
+			}
+	|	sect_flag_list '&' NAME
+			{
+			  struct flag_info_list *n;
+			  n = ((struct flag_info_list *) xmalloc (sizeof *n));
+			  if ($3[0] == '!')
+			    {
+			      n->with = without_flags;
+			      n->name = &$3[1];
+			    }
+			  else
+			    {
+			      n->with = with_flags;
+			      n->name = $3;
+			    }
+			  n->valid = FALSE;
+			  n->next = $1;
+			  $$ = n;
+			}
+	;
+
+sect_flags:
+		INPUT_SECTION_FLAGS '(' sect_flag_list ')'
+			{
+			  struct flag_info *n;
+			  n = ((struct flag_info *) xmalloc (sizeof *n));
+			  n->flag_list = $3;
+			  n->flags_initialized = FALSE;
+			  n->not_with_flags = 0;
+			  n->only_with_flags = 0;
+			  $$ = n;
 			}
 	;
 
@@ -533,14 +597,37 @@ input_section_spec_no_keep:
 			  tmp.sorted = none;
 			  lang_add_wild (&tmp, NULL, ldgram_had_keep);
 			}
+	|	sect_flags NAME
+			{
+			  struct wildcard_spec tmp;
+			  tmp.name = $2;
+			  tmp.exclude_name_list = NULL;
+			  tmp.sorted = none;
+			  tmp.section_flag_list = $1;
+			  lang_add_wild (&tmp, NULL, ldgram_had_keep);
+			}
         |	'[' file_NAME_list ']'
 			{
 			  lang_add_wild (NULL, $2, ldgram_had_keep);
 			}
+        |	sect_flags '[' file_NAME_list ']'
+			{
+			  struct wildcard_spec tmp;
+			  tmp.name = NULL;
+			  tmp.exclude_name_list = NULL;
+			  tmp.sorted = none;
+			  tmp.section_flag_list = $1;
+			  lang_add_wild (NULL, $3, ldgram_had_keep);
+			}
 	|	wildcard_spec '(' file_NAME_list ')'
 			{
 			  lang_add_wild (&$1, $3, ldgram_had_keep);
 			}
+	|	sect_flags wildcard_spec '(' file_NAME_list ')'
+			{
+			  $2.section_flag_list = $1;
+			  lang_add_wild (&$2, $4, ldgram_had_keep);
+			}
 	;
 
 input_section_spec:
Index: ld.texinfo
===================================================================
--- ld.texinfo	(revision 329725)
+++ ld.texinfo	(working copy)
@@ -3802,6 +3802,26 @@ needs to be at a particular location in 
 data.o(.data)
 @end smallexample
 
+To refine the sections that are included based on the section flags
+of an input section, INPUT_SECTION_FLAGS may be used.
+
+Here is a simple example for using Section header flags for ELF sections:
+
+@smallexample
+@group
+SECTIONS @{
+  .text : @{ INPUT_SECTION_FLAGS (SHF_MERGE & SHF_STRINGS) *(.text) @}
+  .text2 :  @{ INPUT_SECTION_FLAGS (!SHF_WRITE) *(.text) @}
+@}
+@end group
+@end smallexample
+
+In this example, the output section @samp{.text} will be comprised of any
+input section matching the name *(.text) whose section header flags
+@code{SHF_MERGE} and @code{SHF_STRINGS} are set.  The output section
+@samp{.text2} will be comprised of any input section matching the name *(.text)
+whose section header flag @code{SHF_WRITE} is clear.
+
 You can also specify files within archives by writing a pattern
 matching the archive, a colon, then the pattern matching the file,
 with no whitespace around the colon.

Attachment: ld-test.cl
Description: Text document

Index: ld-scripts/section-flags-1.s
===================================================================
RCS file: ld-scripts/section-flags-1.s
diff -N ld-scripts/section-flags-1.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld-scripts/section-flags-1.s	22 Jun 2011 21:07:53 -0000
@@ -0,0 +1,2 @@
+	.text
+	.space 16
Index: ld-scripts/section-flags-1.t
===================================================================
RCS file: ld-scripts/section-flags-1.t
diff -N ld-scripts/section-flags-1.t
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld-scripts/section-flags-1.t	22 Jun 2011 21:07:53 -0000
@@ -0,0 +1,17 @@
+MEMORY
+{
+  ram (rwx) : ORIGIN = 0x100000, LENGTH = 144M
+}
+
+SECTIONS
+{
+  .text :
+  {
+    INPUT_SECTION_FLAGS (!SHF_TLS) *(.text .text.* .text_* .gnu.linkonce.t.*)
+  } >ram
+
+  .text_vle : 
+  {
+    INPUT_SECTION_FLAGS (SHF_MERGE & SHF_STRINGS & SHF_LINK_ORDER) *(.text .text.* .text_* .gnu.linkonce.t.*)
+  } >ram
+}
Index: ld-scripts/section-flags-2.s
===================================================================
RCS file: ld-scripts/section-flags-2.s
diff -N ld-scripts/section-flags-2.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld-scripts/section-flags-2.s	22 Jun 2011 21:07:53 -0000
@@ -0,0 +1,2 @@
+	.text
+	.space 16
Index: ld-scripts/section-flags-2.t
===================================================================
RCS file: ld-scripts/section-flags-2.t
diff -N ld-scripts/section-flags-2.t
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld-scripts/section-flags-2.t	22 Jun 2011 21:07:53 -0000
@@ -0,0 +1,12 @@
+MEMORY
+{
+  ram (rwx) : ORIGIN = 0x100000, LENGTH = 144M
+}
+
+SECTIONS
+{
+  .text :
+  {
+    INPUT_SECTION_FLAGS (!SHF_TLS) *(EXCLUDE_FILE (section-flags-1.o) .text .text.* .text_* .gnu.linkonce.t.*)
+  } >ram
+}
Index: ld-scripts/section-flags.exp
===================================================================
RCS file: ld-scripts/section-flags.exp
diff -N ld-scripts/section-flags.exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld-scripts/section-flags.exp	22 Jun 2011 21:07:53 -0000
@@ -0,0 +1,45 @@
+# Test SECTION_FLAGS in a linker script.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+set testname "SECTION_FLAGS-1"
+
+if ![ld_assemble $as $srcdir/$subdir/section-flags-1.s tmpdir/section-flags-1.o] {
+    unresolved $testname
+    return
+}
+
+if ![ld_simple_link $ld tmpdir/section-flags-1 "-T $srcdir/$subdir/section-flags-1.t tmpdir/section-flags-1.o"] {
+    fail $testname
+    return
+}
+
+pass $testname
+
+set testname "SECTION_FLAGS-2"
+if ![ld_assemble $as $srcdir/$subdir/section-flags-2.s tmpdir/section-flags-2.o] {
+    unresolved $testname
+    return
+}
+
+if ![ld_simple_link $ld tmpdir/section-flags-2 "-T $srcdir/$subdir/section-flags-2.t tmpdir/section-flags-1.o tmpdir/section-flags-2.o"] {
+    fail $testname
+    return
+}
+
+pass $testname

Attachment: bfd.cl
Description: Text document

Index: bfd-in2.h
===================================================================
RCS file: /cvs/src/src/bfd/bfd-in2.h,v
retrieving revision 1.539
diff -u -r1.539 bfd-in2.h
--- bfd-in2.h	13 Jun 2011 15:18:45 -0000	1.539
+++ bfd-in2.h	22 Jun 2011 20:25:30 -0000
@@ -1513,6 +1513,9 @@
   /* The BFD which owns the section.  */
   bfd *owner;
 
+  /* INPUT_SECTION_FLAGS if specified in the linker script.  */
+  struct flag_info *section_flag_info;
+
   /* A symbol which points at this section only.  */
   struct bfd_symbol *symbol;
   struct bfd_symbol **symbol_ptr_ptr;
@@ -1691,6 +1694,9 @@
   /* target_index, used_by_bfd, constructor_chain, owner,          */  \
      0,            NULL,        NULL,              NULL,               \
                                                                        \
+  /* flag_info,                                                    */  \
+     NULL,                                                             \
+                                                                       \
   /* symbol,                    symbol_ptr_ptr,                    */  \
      (struct bfd_symbol *) SYM, &SEC.symbol,                           \
                                                                        \
@@ -5570,6 +5576,9 @@
 #define bfd_gc_sections(abfd, link_info) \
        BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info))
 
+#define bfd_lookup_section_flags(link_info, flag_info) \
+       BFD_SEND (abfd, _bfd_lookup_section_flags, (link_info, flag_info))
+
 #define bfd_merge_sections(abfd, link_info) \
        BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
 
@@ -5726,6 +5735,9 @@
 /* Forward declaration.  */
 typedef struct bfd_link_info _bfd_link_info;
 
+/* Forward declaration.  */
+typedef struct flag_info flag_info;
+
 typedef struct bfd_target
 {
   /* Identifies the kind of target, e.g., SunOS4, Ultrix, etc.  */
@@ -5995,6 +6007,7 @@
   NAME##_bfd_final_link, \
   NAME##_bfd_link_split_section, \
   NAME##_bfd_gc_sections, \
+  NAME##_bfd_lookup_section_flags, \
   NAME##_bfd_merge_sections, \
   NAME##_bfd_is_group_section, \
   NAME##_bfd_discard_group, \
@@ -6039,6 +6052,10 @@
   /* Remove sections that are not referenced from the output.  */
   bfd_boolean (*_bfd_gc_sections) (bfd *, struct bfd_link_info *);
 
+  /* Sets the bitmask of allowed and disallowed section flags.  */
+  void (*_bfd_lookup_section_flags) (struct bfd_link_info *,
+                                     struct flag_info *);
+
   /* Attempt to merge SEC_MERGE sections.  */
   bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *);
 
Index: bfd.c
===================================================================
RCS file: /cvs/src/src/bfd/bfd.c,v
retrieving revision 1.117
diff -u -r1.117 bfd.c
--- bfd.c	9 Jun 2011 15:31:41 -0000	1.117
+++ bfd.c	22 Jun 2011 20:25:30 -0000
@@ -1374,6 +1374,9 @@
 .#define bfd_gc_sections(abfd, link_info) \
 .	BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info))
 .
+.#define bfd_lookup_section_flags(link_info, flag_info) \
+.	BFD_SEND (abfd, _bfd_lookup_section_flags, (link_info, flag_info))
+.
 .#define bfd_merge_sections(abfd, link_info) \
 .	BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
 .
Index: binary.c
===================================================================
RCS file: /cvs/src/src/bfd/binary.c,v
retrieving revision 1.40
diff -u -r1.40 binary.c
--- binary.c	6 Jun 2011 01:26:01 -0000	1.40
+++ binary.c	22 Jun 2011 20:25:30 -0000
@@ -299,6 +299,7 @@
 #define binary_bfd_get_relocated_section_contents  bfd_generic_get_relocated_section_contents
 #define binary_bfd_relax_section                   bfd_generic_relax_section
 #define binary_bfd_gc_sections                     bfd_generic_gc_sections
+#define binary_bfd_lookup_section_flags            bfd_generic_lookup_section_flags
 #define binary_bfd_merge_sections                  bfd_generic_merge_sections
 #define binary_bfd_is_group_section                bfd_generic_is_group_section
 #define binary_bfd_discard_group                   bfd_generic_discard_group
Index: coff-rs6000.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-rs6000.c,v
retrieving revision 1.102
diff -u -r1.102 coff-rs6000.c
--- coff-rs6000.c	6 Jun 2011 01:26:02 -0000	1.102
+++ coff-rs6000.c	22 Jun 2011 20:25:30 -0000
@@ -4102,6 +4102,7 @@
     _bfd_xcoff_bfd_final_link,
     _bfd_generic_link_split_section,
     bfd_generic_gc_sections,
+    bfd_generic_lookup_section_flags,
     bfd_generic_merge_sections,
     bfd_generic_is_group_section,
     bfd_generic_discard_group,
@@ -4356,6 +4357,7 @@
     _bfd_xcoff_bfd_final_link,
     _bfd_generic_link_split_section,
     bfd_generic_gc_sections,
+    bfd_generic_lookup_section_flags,
     bfd_generic_merge_sections,
     bfd_generic_is_group_section,
     bfd_generic_discard_group,
Index: coffcode.h
===================================================================
RCS file: /cvs/src/src/bfd/coffcode.h,v
retrieving revision 1.179
diff -u -r1.179 coffcode.h
--- coffcode.h	6 Jun 2011 01:26:02 -0000	1.179
+++ coffcode.h	22 Jun 2011 20:25:30 -0000
@@ -5652,6 +5652,10 @@
 #define coff_bfd_gc_sections		    bfd_generic_gc_sections
 #endif
 
+#ifndef coff_bfd_lookup_section_flags
+#define coff_bfd_lookup_section_flags	    bfd_generic_lookup_section_flags
+#endif
+
 #ifndef coff_bfd_merge_sections
 #define coff_bfd_merge_sections		    bfd_generic_merge_sections
 #endif
Index: elf-bfd.h
===================================================================
RCS file: /cvs/src/src/bfd/elf-bfd.h,v
retrieving revision 1.323
diff -u -r1.323 elf-bfd.h
--- elf-bfd.h	15 Jun 2011 16:36:55 -0000	1.323
+++ elf-bfd.h	22 Jun 2011 20:25:30 -0000
@@ -1112,6 +1112,11 @@
   char *(*elf_backend_write_core_note)
     (bfd *abfd, char *buf, int *bufsiz, int note_type, ...);
 
+  /* This function, if defined, is called to convert target-specific
+     section flag names into hex values.  */
+  flagword (*elf_backend_lookup_section_flags_hook)
+    (char *);
+
   /* This function returns class of a reloc type.  */
   enum elf_reloc_type_class (*elf_backend_reloc_type_class)
     (const Elf_Internal_Rela *);
@@ -2193,6 +2198,9 @@
 
 extern int bfd_elf_get_default_section_type (flagword);
 
+extern void bfd_elf_lookup_section_flags
+  (struct bfd_link_info *, struct flag_info *);
+
 extern Elf_Internal_Phdr * _bfd_elf_find_segment_containing_section
   (bfd * abfd, asection * section);
 
Index: elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.412
diff -u -r1.412 elflink.c
--- elflink.c	21 Jun 2011 14:55:26 -0000	1.412
+++ elflink.c	22 Jun 2011 20:25:30 -0000
@@ -12167,6 +12167,83 @@
   return TRUE;
 }
 
+/* Map an ELF section header flag to its corresponding string.  */
+typedef struct
+{
+  char *flag_name;
+  flagword flag_value;
+} elf_flags_to_name_table;
+
+static elf_flags_to_name_table elf_flags_to_names [] =
+{
+  { "SHF_WRITE", SHF_WRITE },
+  { "SHF_ALLOC", SHF_ALLOC },
+  { "SHF_EXECINSTR", SHF_EXECINSTR },
+  { "SHF_MERGE", SHF_MERGE },
+  { "SHF_STRINGS", SHF_STRINGS },
+  { "SHF_INFO_LINK", SHF_INFO_LINK},
+  { "SHF_LINK_ORDER", SHF_LINK_ORDER},
+  { "SHF_OS_NONCONFORMING", SHF_OS_NONCONFORMING},
+  { "SHF_GROUP", SHF_GROUP },
+  { "SHF_TLS", SHF_TLS },
+  { "SHF_MASKOS", SHF_MASKOS },
+  { "SHF_EXCLUDE", SHF_EXCLUDE },
+};
+
+void
+bfd_elf_lookup_section_flags (struct bfd_link_info *info,
+			      struct flag_info *finfo)
+{
+  bfd *output_bfd = info->output_bfd;
+  const struct elf_backend_data *bed = get_elf_backend_data (output_bfd);
+  struct flag_info_list *tf = finfo->flag_list;
+  int with_hex = 0;
+  int without_hex = 0;
+
+  for (tf = finfo->flag_list; tf != NULL; tf = tf->next)
+    {
+      int i;
+      if (bed->elf_backend_lookup_section_flags_hook)
+	{
+	  flagword hexval =
+	     (*bed->elf_backend_lookup_section_flags_hook) ((char *) tf->name);
+
+	  if (hexval != 0)
+	    {
+	      if (tf->with == with_flags)
+		with_hex |= hexval;
+	      else if (tf->with == without_flags)
+		without_hex |= hexval;
+	      tf->valid = TRUE;
+	      continue;
+	    }
+	}
+      for (i = 0; i < 12; i++)
+	{
+	  if (!strcmp (tf->name, elf_flags_to_names[i].flag_name))
+	    {
+	      if (tf->with == with_flags)
+		with_hex |= elf_flags_to_names[i].flag_value;
+	      else if (tf->with == without_flags)
+		without_hex |= elf_flags_to_names[i].flag_value;
+	      tf->valid = TRUE;
+	      continue;
+	    }
+	}
+      if (tf->valid == FALSE)
+	{
+	  info->callbacks->einfo 
+		(_("Unrecognized INPUT_SECTION_FLAG %s\n"), tf->name);
+	  return;
+	}
+    }
+ finfo->flags_initialized = TRUE;
+ finfo->only_with_flags |= with_hex;
+ finfo->not_with_flags |= without_hex;
+
+ return;
+}
+
 struct alloc_got_off_arg {
   bfd_vma gotoff;
   struct bfd_link_info *info;
Index: elfxx-target.h
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-target.h,v
retrieving revision 1.126
diff -u -r1.126 elfxx-target.h
--- elfxx-target.h	14 Jun 2011 02:45:12 -0000	1.126
+++ elfxx-target.h	22 Jun 2011 20:25:30 -0000
@@ -174,6 +174,10 @@
 #define bfd_elfNN_bfd_define_common_symbol bfd_generic_define_common_symbol
 #endif
 
+#ifndef bfd_elfNN_bfd_lookup_section_flags
+#define bfd_elfNN_bfd_lookup_section_flags bfd_elf_lookup_section_flags
+#endif
+
 #ifndef bfd_elfNN_bfd_make_debug_symbol
 #define bfd_elfNN_bfd_make_debug_symbol \
   ((asymbol * (*) (bfd *, void *, unsigned long)) bfd_nullvoidptr)
@@ -529,6 +533,9 @@
 #ifndef elf_backend_write_core_note
 #define elf_backend_write_core_note		NULL
 #endif
+#ifndef elf_backend_lookup_section_flags_hook
+#define elf_backend_lookup_section_flags_hook	NULL
+#endif
 #ifndef elf_backend_reloc_type_class
 #define elf_backend_reloc_type_class		_bfd_elf_reloc_type_class
 #endif
@@ -717,6 +724,7 @@
   elf_backend_grok_prstatus,
   elf_backend_grok_psinfo,
   elf_backend_write_core_note,
+  elf_backend_lookup_section_flags_hook,
   elf_backend_reloc_type_class,
   elf_backend_discard_info,
   elf_backend_ignore_discarded_relocs,
Index: ieee.c
===================================================================
RCS file: /cvs/src/src/bfd/ieee.c,v
retrieving revision 1.71
diff -u -r1.71 ieee.c
--- ieee.c	6 Jun 2011 01:26:03 -0000	1.71
+++ ieee.c	22 Jun 2011 20:25:30 -0000
@@ -3772,6 +3772,7 @@
   bfd_generic_get_relocated_section_contents
 #define ieee_bfd_relax_section bfd_generic_relax_section
 #define ieee_bfd_gc_sections bfd_generic_gc_sections
+#define ieee_bfd_lookup_section_flags bfd_generic_lookup_section_flags
 #define ieee_bfd_merge_sections bfd_generic_merge_sections
 #define ieee_bfd_is_group_section bfd_generic_is_group_section
 #define ieee_bfd_discard_group bfd_generic_discard_group
Index: ihex.c
===================================================================
RCS file: /cvs/src/src/bfd/ihex.c,v
retrieving revision 1.41
diff -u -r1.41 ihex.c
--- ihex.c	6 Jun 2011 01:26:03 -0000	1.41
+++ ihex.c	22 Jun 2011 20:25:30 -0000
@@ -930,6 +930,7 @@
 #define ihex_bfd_get_relocated_section_contents   bfd_generic_get_relocated_section_contents
 #define ihex_bfd_relax_section                    bfd_generic_relax_section
 #define ihex_bfd_gc_sections                      bfd_generic_gc_sections
+#define ihex_bfd_lookup_section_flags             bfd_generic_lookup_section_flags
 #define ihex_bfd_merge_sections                   bfd_generic_merge_sections
 #define ihex_bfd_is_group_section                 bfd_generic_is_group_section
 #define ihex_bfd_discard_group                    bfd_generic_discard_group
Index: libbfd-in.h
===================================================================
RCS file: /cvs/src/src/bfd/libbfd-in.h,v
retrieving revision 1.88
diff -u -r1.88 libbfd-in.h
--- libbfd-in.h	28 Apr 2011 12:50:32 -0000	1.88
+++ libbfd-in.h	22 Jun 2011 20:25:30 -0000
@@ -453,6 +453,9 @@
 #define _bfd_nolink_bfd_gc_sections \
   ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \
    bfd_false)
+#define _bfd_nolink_bfd_lookup_section_flags \
+  ((void (*) (struct bfd_link_info *, struct flag_info *)) \
+   bfd_0)
 #define _bfd_nolink_bfd_merge_sections \
   ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \
    bfd_false)
Index: libbfd.h
===================================================================
RCS file: /cvs/src/src/bfd/libbfd.h,v
retrieving revision 1.252
diff -u -r1.252 libbfd.h
--- libbfd.h	13 Jun 2011 15:18:46 -0000	1.252
+++ libbfd.h	22 Jun 2011 20:25:30 -0000
@@ -458,6 +458,9 @@
 #define _bfd_nolink_bfd_gc_sections \
   ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \
    bfd_false)
+#define _bfd_nolink_bfd_lookup_section_flags \
+  ((void (*) (struct bfd_link_info *, struct flag_info *)) \
+   bfd_0)
 #define _bfd_nolink_bfd_merge_sections \
   ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \
    bfd_false)
@@ -2452,6 +2455,9 @@
 bfd_boolean bfd_generic_gc_sections
    (bfd *, struct bfd_link_info *);
 
+void bfd_generic_lookup_section_flags
+   (struct bfd_link_info *, struct flag_info *);
+
 bfd_boolean bfd_generic_merge_sections
    (bfd *, struct bfd_link_info *);
 
Index: mach-o-target.c
===================================================================
RCS file: /cvs/src/src/bfd/mach-o-target.c,v
retrieving revision 1.17
diff -u -r1.17 mach-o-target.c
--- mach-o-target.c	6 Jun 2011 01:26:03 -0000	1.17
+++ mach-o-target.c	22 Jun 2011 20:25:30 -0000
@@ -51,6 +51,7 @@
 #define bfd_mach_o_bfd_set_private_flags              _bfd_generic_bfd_set_private_flags
 #define bfd_mach_o_get_section_contents               _bfd_generic_get_section_contents
 #define bfd_mach_o_bfd_gc_sections                    bfd_generic_gc_sections
+#define bfd_mach_o_bfd_lookup_section_flags           bfd_generic_lookup_section_flags
 #define bfd_mach_o_bfd_merge_sections                 bfd_generic_merge_sections
 #define bfd_mach_o_bfd_is_group_section               bfd_generic_is_group_section
 #define bfd_mach_o_bfd_discard_group                  bfd_generic_discard_group
Index: mmo.c
===================================================================
RCS file: /cvs/src/src/bfd/mmo.c,v
retrieving revision 1.42
diff -u -r1.42 mmo.c
--- mmo.c	6 Jun 2011 01:26:03 -0000	1.42
+++ mmo.c	22 Jun 2011 20:25:30 -0000
@@ -3190,6 +3190,7 @@
 #define mmo_bfd_get_relocated_section_contents \
   bfd_generic_get_relocated_section_contents
 #define mmo_bfd_gc_sections bfd_generic_gc_sections
+#define mmo_bfd_lookup_section_flags bfd_generic_lookup_section_flags
 #define mmo_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
 #define mmo_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
 #define mmo_bfd_link_add_symbols _bfd_generic_link_add_symbols
Index: oasys.c
===================================================================
RCS file: /cvs/src/src/bfd/oasys.c,v
retrieving revision 1.46
diff -u -r1.46 oasys.c
--- oasys.c	6 Jun 2011 01:26:03 -0000	1.46
+++ oasys.c	22 Jun 2011 20:25:30 -0000
@@ -1196,6 +1196,7 @@
 #define oasys_bfd_get_relocated_section_contents   bfd_generic_get_relocated_section_contents
 #define oasys_bfd_relax_section                    bfd_generic_relax_section
 #define oasys_bfd_gc_sections                      bfd_generic_gc_sections
+#define oasys_bfd_lookup_section_flags             bfd_generic_lookup_section_flags
 #define oasys_bfd_merge_sections                   bfd_generic_merge_sections
 #define oasys_bfd_is_group_section                 bfd_generic_is_group_section
 #define oasys_bfd_discard_group                    bfd_generic_discard_group
Index: pef.c
===================================================================
RCS file: /cvs/src/src/bfd/pef.c,v
retrieving revision 1.32
diff -u -r1.32 pef.c
--- pef.c	6 Jun 2011 01:26:03 -0000	1.32
+++ pef.c	22 Jun 2011 20:25:30 -0000
@@ -48,6 +48,7 @@
 #define bfd_pef_bfd_get_relocated_section_contents  bfd_generic_get_relocated_section_contents
 #define bfd_pef_bfd_relax_section                   bfd_generic_relax_section
 #define bfd_pef_bfd_gc_sections                     bfd_generic_gc_sections
+#define bfd_pef_bfd_lookup_section_flags            bfd_generic_lookup_section_flags
 #define bfd_pef_bfd_merge_sections                  bfd_generic_merge_sections
 #define bfd_pef_bfd_is_group_section		    bfd_generic_is_group_section
 #define bfd_pef_bfd_discard_group                   bfd_generic_discard_group
Index: plugin.c
===================================================================
RCS file: /cvs/src/src/bfd/plugin.c,v
retrieving revision 1.13
diff -u -r1.13 plugin.c
--- plugin.c	6 Jun 2011 01:26:03 -0000	1.13
+++ plugin.c	22 Jun 2011 20:25:30 -0000
@@ -63,6 +63,7 @@
 #define bfd_plugin_bfd_final_link                     _bfd_generic_final_link
 #define bfd_plugin_bfd_link_split_section             _bfd_generic_link_split_section
 #define bfd_plugin_bfd_gc_sections                    bfd_generic_gc_sections
+#define bfd_plugin_bfd_lookup_section_flags           bfd_generic_lookup_section_flags
 #define bfd_plugin_bfd_merge_sections                 bfd_generic_merge_sections
 #define bfd_plugin_bfd_is_group_section               bfd_generic_is_group_section
 #define bfd_plugin_bfd_discard_group                  bfd_generic_discard_group
Index: ppcboot.c
===================================================================
RCS file: /cvs/src/src/bfd/ppcboot.c,v
retrieving revision 1.34
diff -u -r1.34 ppcboot.c
--- ppcboot.c	6 Jun 2011 01:26:03 -0000	1.34
+++ ppcboot.c	22 Jun 2011 20:25:30 -0000
@@ -470,6 +470,7 @@
   bfd_generic_get_relocated_section_contents
 #define ppcboot_bfd_relax_section bfd_generic_relax_section
 #define ppcboot_bfd_gc_sections bfd_generic_gc_sections
+#define ppcboot_bfd_lookup_section_flags bfd_generic_lookup_section_flags
 #define ppcboot_bfd_merge_sections bfd_generic_merge_sections
 #define ppcboot_bfd_is_group_section bfd_generic_is_group_section
 #define ppcboot_bfd_discard_group bfd_generic_discard_group
Index: reloc.c
===================================================================
RCS file: /cvs/src/src/bfd/reloc.c,v
retrieving revision 1.214
diff -u -r1.214 reloc.c
--- reloc.c	13 Jun 2011 15:18:46 -0000	1.214
+++ reloc.c	22 Jun 2011 20:25:31 -0000
@@ -6044,6 +6044,30 @@
 
 /*
 INTERNAL_FUNCTION
+	bfd_generic_lookup_section_flags
+
+SYNOPSIS
+	void bfd_generic_lookup_section_flags
+	  (struct bfd_link_info *, struct flag_info *);
+
+DESCRIPTION
+	Provides default handling for section flags lookup
+	-- i.e., does nothing.
+*/
+
+void
+bfd_generic_lookup_section_flags (struct bfd_link_info *info ATTRIBUTE_UNUSED,
+				  struct flag_info *finfo) 
+{
+  if (finfo != NULL)
+    {
+      (*_bfd_error_handler) (_("INPUT_SECTION_FLAGS are not supported.\n"));
+      return;
+    }
+}
+
+/*
+INTERNAL_FUNCTION
 	bfd_generic_merge_sections
 
 SYNOPSIS
Index: section.c
===================================================================
RCS file: /cvs/src/src/bfd/section.c,v
retrieving revision 1.110
diff -u -r1.110 section.c
--- section.c	7 May 2011 14:12:59 -0000	1.110
+++ section.c	22 Jun 2011 20:25:31 -0000
@@ -516,6 +516,9 @@
 .  {* The BFD which owns the section.  *}
 .  bfd *owner;
 .
+.  {* INPUT_SECTION_FLAGS if specified in the linker script.  *}
+.  struct flag_info *section_flag_info;
+.
 .  {* A symbol which points at this section only.  *}
 .  struct bfd_symbol *symbol;
 .  struct bfd_symbol **symbol_ptr_ptr;
@@ -694,6 +697,9 @@
 .  {* target_index, used_by_bfd, constructor_chain, owner,          *}	\
 .     0,            NULL,        NULL,              NULL,		\
 .									\
+.  {* flag_info,						    *}  \
+.     NULL,								\
+.									\
 .  {* symbol,                    symbol_ptr_ptr,                    *}	\
 .     (struct bfd_symbol *) SYM, &SEC.symbol,				\
 .									\
Index: som.c
===================================================================
RCS file: /cvs/src/src/bfd/som.c,v
retrieving revision 1.84
diff -u -r1.84 som.c
--- som.c	6 Jun 2011 01:26:03 -0000	1.84
+++ som.c	22 Jun 2011 20:25:31 -0000
@@ -6741,6 +6741,7 @@
   _bfd_generic_copy_link_hash_symbol_type
 #define som_bfd_final_link                      _bfd_generic_final_link
 #define som_bfd_gc_sections		        bfd_generic_gc_sections
+#define som_bfd_lookup_section_flags            bfd_generic_lookup_section_flags
 #define som_bfd_merge_sections		        bfd_generic_merge_sections
 #define som_bfd_is_group_section	        bfd_generic_is_group_section
 #define som_bfd_discard_group		        bfd_generic_discard_group
Index: srec.c
===================================================================
RCS file: /cvs/src/src/bfd/srec.c,v
retrieving revision 1.51
diff -u -r1.51 srec.c
--- srec.c	6 Jun 2011 01:26:04 -0000	1.51
+++ srec.c	22 Jun 2011 20:25:31 -0000
@@ -1252,6 +1252,7 @@
 #define srec_bfd_get_relocated_section_contents   bfd_generic_get_relocated_section_contents
 #define srec_bfd_relax_section                    bfd_generic_relax_section
 #define srec_bfd_gc_sections                      bfd_generic_gc_sections
+#define srec_bfd_lookup_section_flags             bfd_generic_lookup_section_flags
 #define srec_bfd_merge_sections                   bfd_generic_merge_sections
 #define srec_bfd_is_group_section                 bfd_generic_is_group_section
 #define srec_bfd_discard_group                    bfd_generic_discard_group
Index: targets.c
===================================================================
RCS file: /cvs/src/src/bfd/targets.c,v
retrieving revision 1.202
diff -u -r1.202 targets.c
--- targets.c	13 Jun 2011 15:18:46 -0000	1.202
+++ targets.c	22 Jun 2011 20:25:31 -0000
@@ -177,6 +177,9 @@
 .{* Forward declaration.  *}
 .typedef struct bfd_link_info _bfd_link_info;
 .
+.{* Forward declaration.  *}
+.typedef struct flag_info flag_info;
+.
 .typedef struct bfd_target
 .{
 .  {* Identifies the kind of target, e.g., SunOS4, Ultrix, etc.  *}
@@ -448,6 +451,7 @@
 .  NAME##_bfd_final_link, \
 .  NAME##_bfd_link_split_section, \
 .  NAME##_bfd_gc_sections, \
+.  NAME##_bfd_lookup_section_flags, \
 .  NAME##_bfd_merge_sections, \
 .  NAME##_bfd_is_group_section, \
 .  NAME##_bfd_discard_group, \
@@ -492,6 +496,10 @@
 .  {* Remove sections that are not referenced from the output.  *}
 .  bfd_boolean (*_bfd_gc_sections) (bfd *, struct bfd_link_info *);
 .
+.  {* Sets the bitmask of allowed and disallowed section flags.  *}
+.  void (*_bfd_lookup_section_flags) (struct bfd_link_info *,
+.				      struct flag_info *);
+.
 .  {* Attempt to merge SEC_MERGE sections.  *}
 .  bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *);
 .
Index: tekhex.c
===================================================================
RCS file: /cvs/src/src/bfd/tekhex.c,v
retrieving revision 1.40
diff -u -r1.40 tekhex.c
--- tekhex.c	6 Jun 2011 01:26:04 -0000	1.40
+++ tekhex.c	22 Jun 2011 20:25:31 -0000
@@ -943,6 +943,7 @@
 #define tekhex_bfd_get_relocated_section_contents   bfd_generic_get_relocated_section_contents
 #define tekhex_bfd_relax_section                    bfd_generic_relax_section
 #define tekhex_bfd_gc_sections                      bfd_generic_gc_sections
+#define tekhex_bfd_lookup_section_flags		    bfd_generic_lookup_section_flags
 #define tekhex_bfd_merge_sections                   bfd_generic_merge_sections
 #define tekhex_bfd_is_group_section                 bfd_generic_is_group_section
 #define tekhex_bfd_discard_group                    bfd_generic_discard_group
Index: versados.c
===================================================================
RCS file: /cvs/src/src/bfd/versados.c,v
retrieving revision 1.40
diff -u -r1.40 versados.c
--- versados.c	6 Jun 2011 01:26:04 -0000	1.40
+++ versados.c	22 Jun 2011 20:25:31 -0000
@@ -806,6 +806,7 @@
 #define versados_bfd_get_relocated_section_contents   bfd_generic_get_relocated_section_contents
 #define versados_bfd_relax_section                    bfd_generic_relax_section
 #define versados_bfd_gc_sections                      bfd_generic_gc_sections
+#define versados_bfd_lookup_section_flags             bfd_generic_lookup_section_flags
 #define versados_bfd_merge_sections                   bfd_generic_merge_sections
 #define versados_bfd_is_group_section                 bfd_generic_is_group_section
 #define versados_bfd_discard_group                    bfd_generic_discard_group
Index: vms-alpha.c
===================================================================
RCS file: /cvs/src/src/bfd/vms-alpha.c,v
retrieving revision 1.47
diff -u -r1.47 vms-alpha.c
--- vms-alpha.c	13 Jun 2011 00:59:15 -0000	1.47
+++ vms-alpha.c	22 Jun 2011 20:25:31 -0000
@@ -9333,6 +9333,7 @@
 
 #define alpha_vms_bfd_relax_section bfd_generic_relax_section
 #define alpha_vms_bfd_gc_sections bfd_generic_gc_sections
+#define alpha_vms_bfd_lookup_section_flags bfd_generic_lookup_section_flags
 #define alpha_vms_bfd_merge_sections bfd_generic_merge_sections
 #define alpha_vms_bfd_is_group_section bfd_generic_is_group_section
 #define alpha_vms_bfd_discard_group bfd_generic_discard_group
Index: xsym.c
===================================================================
RCS file: /cvs/src/src/bfd/xsym.c,v
retrieving revision 1.29
diff -u -r1.29 xsym.c
--- xsym.c	6 Jun 2011 01:26:04 -0000	1.29
+++ xsym.c	22 Jun 2011 20:25:31 -0000
@@ -42,6 +42,7 @@
 #define bfd_sym_bfd_get_relocated_section_contents  bfd_generic_get_relocated_section_contents
 #define bfd_sym_bfd_relax_section                   bfd_generic_relax_section
 #define bfd_sym_bfd_gc_sections                     bfd_generic_gc_sections
+#define bfd_sym_bfd_lookup_section_flags            bfd_generic_lookup_section_flags
 #define bfd_sym_bfd_merge_sections                  bfd_generic_merge_sections
 #define bfd_sym_bfd_is_group_section                bfd_generic_is_group_section
 #define bfd_sym_bfd_discard_group                   bfd_generic_discard_group

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]