summaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog50
-rw-r--r--bfd/aout-adobe.c1
-rw-r--r--bfd/aout-target.h3
-rw-r--r--bfd/aout-tic30.c3
-rw-r--r--bfd/bfd-in2.h17
-rw-r--r--bfd/bfd.c3
-rw-r--r--bfd/binary.c1
-rw-r--r--bfd/bout.c1
-rw-r--r--bfd/coff-alpha.c3
-rw-r--r--bfd/coff-mips.c3
-rw-r--r--bfd/coff-rs6000.c2
-rw-r--r--bfd/coff64-rs6000.c2
-rw-r--r--bfd/coffcode.h4
-rw-r--r--bfd/ecoff.c2
-rw-r--r--bfd/elf-bfd.h8
-rw-r--r--bfd/elflink.c77
-rw-r--r--bfd/elfxx-target.h8
-rw-r--r--bfd/i386msdos.c1
-rw-r--r--bfd/i386os9k.c1
-rw-r--r--bfd/ieee.c1
-rw-r--r--bfd/ihex.c1
-rw-r--r--bfd/libbfd-in.h3
-rw-r--r--bfd/libbfd.h6
-rw-r--r--bfd/mach-o-target.c1
-rw-r--r--bfd/mmo.c1
-rw-r--r--bfd/nlm-target.h1
-rw-r--r--bfd/oasys.c1
-rw-r--r--bfd/pef.c1
-rw-r--r--bfd/plugin.c1
-rw-r--r--bfd/ppcboot.c1
-rw-r--r--bfd/reloc.c24
-rw-r--r--bfd/section.c6
-rw-r--r--bfd/som.c1
-rw-r--r--bfd/srec.c1
-rw-r--r--bfd/targets.c8
-rw-r--r--bfd/tekhex.c1
-rw-r--r--bfd/versados.c1
-rw-r--r--bfd/vms-alpha.c1
-rw-r--r--bfd/xsym.c1
39 files changed, 252 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index e469ef2875..e20d3db2d0 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,53 @@
+2011-07-11 Catherine Moore <clm@codesourcery.com>
+
+ * aout-adobe.c (aout_32_bfd_lookup_section_flags): New definition.
+ * aout-target.h (MY_bfd_lookup_section_flags): New definition.
+ * aout-tic30.c (MY_bfd_lookup_section_flags): New definition.
+ * bfd-in2.h: Regenerated.
+ * bfd.c (bfd_lookup_section_flags): New definition.
+ * binary.c (binary_bfd_lookup_section_flags): New definition.
+ * bout.c (b_out_bfd_lookup_section_flags): New definition.
+ * coff-alpha.c (_bfd_ecoff_bfd_lookup_section_flags): New definition.
+ * coff-mips.c (_bfd_ecoff_bfd_lookup_section_flags): New definition.
+ * coff-rs6000.c (rs6000coff_vec): Include
+ bfd_generic_lookup_section_flags.
+ (pmac_xcoff_vec): Likewise.
+ * coffcode.h (coff_bfd_lookup_section_flags): New definition.
+ * coff64-rs6000.c (rs6000coff64_vec): Include
+ bfd_generic_lookup_section_flags.
+ (aix5coff64_vec): Likewise.
+ * ecoff.c (bfd_debug_section): Initialize flag_info field.
+ * 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.
+ * i386msdos.c (msdos_bfd_lookup_section_flags): New define.
+ * i386os9k.c (os9k_bfd_lookup_section_flags): New define.
+ * 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_bfd_lookup_section_flags): New definition.
+ * nlm-target.h (nlm_bfd_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.
+
2011-07-11 H.J. Lu <hongjiu.lu@intel.com>
PR ld/12978
diff --git a/bfd/aout-adobe.c b/bfd/aout-adobe.c
index bd38ea8390..c8331d8c5d 100644
--- a/bfd/aout-adobe.c
+++ b/bfd/aout-adobe.c
@@ -459,6 +459,7 @@ aout_adobe_sizeof_headers (bfd *ignore_abfd ATTRIBUTE_UNUSED,
#define aout_32_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
#define aout_32_bfd_relax_section bfd_generic_relax_section
#define aout_32_bfd_gc_sections bfd_generic_gc_sections
+#define aout_32_bfd_lookup_section_flags bfd_generic_lookup_section_flags
#define aout_32_bfd_merge_sections bfd_generic_merge_sections
#define aout_32_bfd_is_group_section bfd_generic_is_group_section
#define aout_32_bfd_discard_group bfd_generic_discard_group
diff --git a/bfd/aout-target.h b/bfd/aout-target.h
index 5c0d2ae355..f6e8bd2e2d 100644
--- a/bfd/aout-target.h
+++ b/bfd/aout-target.h
@@ -486,6 +486,9 @@ MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
#ifndef MY_bfd_gc_sections
#define MY_bfd_gc_sections bfd_generic_gc_sections
#endif
+#ifndef MY_bfd_lookup_section_flags
+#define MY_bfd_lookup_section_flags bfd_generic_lookup_section_flags
+#endif
#ifndef MY_bfd_merge_sections
#define MY_bfd_merge_sections bfd_generic_merge_sections
#endif
diff --git a/bfd/aout-tic30.c b/bfd/aout-tic30.c
index 30900ba388..0b01177296 100644
--- a/bfd/aout-tic30.c
+++ b/bfd/aout-tic30.c
@@ -944,6 +944,9 @@ tic30_aout_set_arch_mach (bfd *abfd,
#ifndef MY_bfd_gc_sections
#define MY_bfd_gc_sections bfd_generic_gc_sections
#endif
+#ifndef MY_bfd_lookup_section_flags
+#define MY_bfd_lookup_section_flags bfd_generic_lookup_section_flags
+#endif
#ifndef MY_bfd_merge_sections
#define MY_bfd_merge_sections bfd_generic_merge_sections
#endif
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index da4688c48f..867d052c78 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -1514,6 +1514,9 @@ typedef struct bfd_section
/* 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;
@@ -1692,6 +1695,9 @@ extern asection bfd_ind_section;
/* 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, \
\
@@ -5571,6 +5577,9 @@ bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags);
#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))
@@ -5728,6 +5737,9 @@ enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
typedef struct bfd_link_info _bfd_link_info;
struct already_linked;
+/* Forward declaration. */
+typedef struct flag_info flag_info;
+
typedef struct bfd_target
{
/* Identifies the kind of target, e.g., SunOS4, Ultrix, etc. */
@@ -5997,6 +6009,7 @@ typedef struct bfd_target
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, \
@@ -6041,6 +6054,10 @@ typedef struct bfd_target
/* 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 *);
diff --git a/bfd/bfd.c b/bfd/bfd.c
index b3e2c47289..7c14c7a00a 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -1374,6 +1374,9 @@ DESCRIPTION
.#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))
.
diff --git a/bfd/binary.c b/bfd/binary.c
index ad93354016..700c862f93 100644
--- a/bfd/binary.c
+++ b/bfd/binary.c
@@ -299,6 +299,7 @@ binary_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
#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
diff --git a/bfd/bout.c b/bfd/bout.c
index b76191b048..cfd4abb019 100644
--- a/bfd/bout.c
+++ b/bfd/bout.c
@@ -1387,6 +1387,7 @@ b_out_bfd_get_relocated_section_contents (bfd *output_bfd,
#define b_out_bfd_final_link _bfd_generic_final_link
#define b_out_bfd_link_split_section _bfd_generic_link_split_section
#define b_out_bfd_gc_sections bfd_generic_gc_sections
+#define b_out_bfd_lookup_section_flags bfd_generic_lookup_section_flags
#define b_out_bfd_merge_sections bfd_generic_merge_sections
#define b_out_bfd_is_group_section bfd_generic_is_group_section
#define b_out_bfd_discard_group bfd_generic_discard_group
diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c
index c4dfd8f7fb..2233a335cb 100644
--- a/bfd/coff-alpha.c
+++ b/bfd/coff-alpha.c
@@ -2393,6 +2393,9 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data =
#define _bfd_ecoff_get_section_contents_in_window \
_bfd_generic_get_section_contents_in_window
+/* Input section flag lookup is generic. */
+#define _bfd_ecoff_bfd_lookup_section_flags bfd_generic_lookup_section_flags
+
/* Relaxing sections is generic. */
#define _bfd_ecoff_bfd_relax_section bfd_generic_relax_section
#define _bfd_ecoff_bfd_gc_sections bfd_generic_gc_sections
diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c
index cbc172f7c0..9f8b90dcef 100644
--- a/bfd/coff-mips.c
+++ b/bfd/coff-mips.c
@@ -1410,6 +1410,9 @@ static const struct ecoff_backend_data mips_ecoff_backend_data =
/* GC of sections is not done. */
#define _bfd_ecoff_bfd_gc_sections bfd_generic_gc_sections
+/* Input section flags is not implemented. */
+#define _bfd_ecoff_bfd_lookup_section_flags bfd_generic_lookup_section_flags
+
/* Merging of sections is not done. */
#define _bfd_ecoff_bfd_merge_sections bfd_generic_merge_sections
diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c
index c1b5c89cc8..5d9b5aeb53 100644
--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -4102,6 +4102,7 @@ const bfd_target rs6000coff_vec =
_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 @@ const bfd_target pmac_xcoff_vec =
_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,
diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c
index ef4dfbae58..031385deee 100644
--- a/bfd/coff64-rs6000.c
+++ b/bfd/coff64-rs6000.c
@@ -2738,6 +2738,7 @@ const bfd_target rs6000coff64_vec =
_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,
@@ -2994,6 +2995,7 @@ const bfd_target aix5coff64_vec =
_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,
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index e71aadd304..2313dc50a2 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -5652,6 +5652,10 @@ static bfd_coff_backend_data ticoff1_swap_table =
#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
diff --git a/bfd/ecoff.c b/bfd/ecoff.c
index efcb9bf75c..b76266d26f 100644
--- a/bfd/ecoff.c
+++ b/bfd/ecoff.c
@@ -73,6 +73,8 @@ static asection bfd_debug_section =
0, NULL, 0,
/* target_index, used_by_bfd, constructor_chain, owner, */
0, NULL, NULL, NULL,
+ /* flag_info, */
+ NULL,
/* symbol, */
NULL,
/* symbol_ptr_ptr, */
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index b2075a5677..08da2aeed8 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -1112,6 +1112,11 @@ struct elf_backend_data
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 bfd_boolean _bfd_elf_is_function_type (unsigned int);
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);
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 238a4aab1a..e2cb28cc8e 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -12167,6 +12167,83 @@ bfd_elf_gc_record_vtentry (bfd *abfd ATTRIBUTE_UNUSED,
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;
diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h
index b033c17655..b51ac9fde6 100644
--- a/bfd/elfxx-target.h
+++ b/bfd/elfxx-target.h
@@ -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 @@ static struct elf_backend_data elfNN_bed =
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,
diff --git a/bfd/i386msdos.c b/bfd/i386msdos.c
index 9ff5fd379c..b67b13e229 100644
--- a/bfd/i386msdos.c
+++ b/bfd/i386msdos.c
@@ -143,6 +143,7 @@ msdos_set_section_contents (bfd *abfd,
bfd_generic_get_relocated_section_contents
#define msdos_bfd_relax_section bfd_generic_relax_section
#define msdos_bfd_gc_sections bfd_generic_gc_sections
+#define msdos_bfd_lookup_section_flags bfd_generic_lookup_section_flags
#define msdos_bfd_merge_sections bfd_generic_merge_sections
#define msdos_bfd_is_group_section bfd_generic_is_group_section
#define msdos_bfd_discard_group bfd_generic_discard_group
diff --git a/bfd/i386os9k.c b/bfd/i386os9k.c
index 5cbf927103..3beb8a3c1e 100644
--- a/bfd/i386os9k.c
+++ b/bfd/i386os9k.c
@@ -167,6 +167,7 @@ os9k_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
bfd_generic_get_relocated_section_contents
#define os9k_bfd_relax_section bfd_generic_relax_section
#define os9k_bfd_gc_sections bfd_generic_gc_sections
+#define os9k_bfd_lookup_section_flags bfd_generic_lookup_section_flags
#define os9k_bfd_merge_sections bfd_generic_merge_sections
#define os9k_bfd_is_group_section bfd_generic_is_group_section
#define os9k_bfd_discard_group bfd_generic_discard_group
diff --git a/bfd/ieee.c b/bfd/ieee.c
index 9494b35b66..de1e926721 100644
--- a/bfd/ieee.c
+++ b/bfd/ieee.c
@@ -3772,6 +3772,7 @@ ieee_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
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
diff --git a/bfd/ihex.c b/bfd/ihex.c
index a92baafc76..09f756a1c2 100644
--- a/bfd/ihex.c
+++ b/bfd/ihex.c
@@ -930,6 +930,7 @@ ihex_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
#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
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
index a80687e2f6..0c98b47cbc 100644
--- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h
@@ -453,6 +453,9 @@ extern bfd_boolean _bfd_generic_set_section_contents
#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)
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index c72ff16442..25eba0f128 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -458,6 +458,9 @@ extern bfd_boolean _bfd_generic_set_section_contents
#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)
@@ -2469,6 +2472,9 @@ bfd_boolean bfd_generic_relax_section
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 *);
diff --git a/bfd/mach-o-target.c b/bfd/mach-o-target.c
index 32dc335111..eb7cb53cd4 100644
--- a/bfd/mach-o-target.c
+++ b/bfd/mach-o-target.c
@@ -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
diff --git a/bfd/mmo.c b/bfd/mmo.c
index c22790dec2..dc45f31b70 100644
--- a/bfd/mmo.c
+++ b/bfd/mmo.c
@@ -3190,6 +3190,7 @@ mmo_write_object_contents (bfd *abfd)
#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
diff --git a/bfd/nlm-target.h b/bfd/nlm-target.h
index f38b16ec8e..9a3b7bef09 100644
--- a/bfd/nlm-target.h
+++ b/bfd/nlm-target.h
@@ -45,6 +45,7 @@
#define nlm_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
#define nlm_bfd_relax_section bfd_generic_relax_section
#define nlm_bfd_gc_sections bfd_generic_gc_sections
+#define nlm_bfd_lookup_section_flags bfd_generic_lookup_section_flags
#define nlm_bfd_merge_sections bfd_generic_merge_sections
#define nlm_bfd_is_group_section bfd_generic_is_group_section
#define nlm_bfd_discard_group bfd_generic_discard_group
diff --git a/bfd/oasys.c b/bfd/oasys.c
index e58f0d0d6a..11d24401fe 100644
--- a/bfd/oasys.c
+++ b/bfd/oasys.c
@@ -1196,6 +1196,7 @@ oasys_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
#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
diff --git a/bfd/pef.c b/bfd/pef.c
index 6db730132e..d4ad33ad37 100644
--- a/bfd/pef.c
+++ b/bfd/pef.c
@@ -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
diff --git a/bfd/plugin.c b/bfd/plugin.c
index 5d34f859b7..064e273128 100644
--- a/bfd/plugin.c
+++ b/bfd/plugin.c
@@ -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
diff --git a/bfd/ppcboot.c b/bfd/ppcboot.c
index a97043695e..c2b4c3be79 100644
--- a/bfd/ppcboot.c
+++ b/bfd/ppcboot.c
@@ -470,6 +470,7 @@ ppcboot_bfd_print_private_bfd_data (abfd, farg)
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
diff --git a/bfd/reloc.c b/bfd/reloc.c
index 664a62874b..f83dac2782 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -6044,6 +6044,30 @@ bfd_generic_gc_sections (bfd *abfd ATTRIBUTE_UNUSED,
/*
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
diff --git a/bfd/section.c b/bfd/section.c
index 3cd7e658e7..7c1f750483 100644
--- a/bfd/section.c
+++ b/bfd/section.c
@@ -516,6 +516,9 @@ CODE_FRAGMENT
. {* 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 @@ CODE_FRAGMENT
. {* 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, \
. \
diff --git a/bfd/som.c b/bfd/som.c
index a642231a8f..0726f842e3 100644
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -6741,6 +6741,7 @@ som_bfd_link_split_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
_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
diff --git a/bfd/srec.c b/bfd/srec.c
index 6d4de1af72..6226773387 100644
--- a/bfd/srec.c
+++ b/bfd/srec.c
@@ -1252,6 +1252,7 @@ srec_print_symbol (bfd *abfd,
#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
diff --git a/bfd/targets.c b/bfd/targets.c
index ac978a14fb..241ff9c7a2 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -178,6 +178,9 @@ DESCRIPTION
.typedef struct bfd_link_info _bfd_link_info;
.struct already_linked;
.
+.{* Forward declaration. *}
+.typedef struct flag_info flag_info;
+.
.typedef struct bfd_target
.{
. {* Identifies the kind of target, e.g., SunOS4, Ultrix, etc. *}
@@ -449,6 +452,7 @@ BFD_JUMP_TABLE macros.
. 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, \
@@ -493,6 +497,10 @@ BFD_JUMP_TABLE macros.
. {* 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 *);
.
diff --git a/bfd/tekhex.c b/bfd/tekhex.c
index 376569af84..0ed7b5032b 100644
--- a/bfd/tekhex.c
+++ b/bfd/tekhex.c
@@ -943,6 +943,7 @@ tekhex_print_symbol (bfd *abfd,
#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
diff --git a/bfd/versados.c b/bfd/versados.c
index 84a816b69d..7f7766a525 100644
--- a/bfd/versados.c
+++ b/bfd/versados.c
@@ -806,6 +806,7 @@ versados_canonicalize_reloc (bfd *abfd,
#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
diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c
index 87e35edf7a..31dc1fb615 100644
--- a/bfd/vms-alpha.c
+++ b/bfd/vms-alpha.c
@@ -9336,6 +9336,7 @@ bfd_vms_get_data (bfd *abfd)
#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
diff --git a/bfd/xsym.c b/bfd/xsym.c
index a0900f1fda..01434e1b72 100644
--- a/bfd/xsym.c
+++ b/bfd/xsym.c
@@ -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