coff_data (abfd)->go32 = true;
+ bfd_coff_long_section_names (abfd)
+ = coff_backend_info (abfd)->_bfd_coff_long_section_names;
+
return true;
}
/* This is copied from bfd_coff_std_swap_table so that we can change
the default section alignment power. */
-static bfd_coff_backend_data bfd_coff_small_swap_table =
+static const bfd_coff_backend_data bfd_coff_small_swap_table =
{
coff_swap_aux_in, coff_swap_sym_in, coff_swap_lineno_in,
coff_swap_aux_out, coff_swap_sym_out,
in output BFDs at runtime; if it is false, as it will be by default
when generating an executable image, long section names are truncated;
if true, the long section names extension is employed. The hook
- points to a function that allows the value of the flag to be altered
- at runtime, on formats that support long section names at all; on
- other formats it points to a stub that returns an error indication.
+ points to a function that allows the value of a copy of the flag
+ in coff object tdata to be altered at runtime, on formats that
+ support long section names at all; on other formats it points
+ to a stub that returns an error indication.
With input BFDs, the flag is set according to whether any long section
names are detected while reading the section headers. For a completely
static bool
bfd_coff_set_long_section_names_allowed (bfd *abfd, int enable)
{
- coff_backend_info (abfd)->_bfd_coff_long_section_names = enable;
+ bfd_coff_long_section_names (abfd) = enable;
return true;
}
#else /* !defined (COFF_LONG_SECTION_NAMES) */
static bool
-bfd_coff_set_long_section_names_disallowed (bfd *abfd, int enable)
+bfd_coff_set_long_section_names_disallowed (bfd *abfd ATTRIBUTE_UNUSED,
+ int enable ATTRIBUTE_UNUSED)
{
- (void) abfd;
- (void) enable;
return false;
}
#endif /* defined (COFF_LONG_SECTION_NAMES) */
.} bfd_coff_backend_data;
.
.#define coff_backend_info(abfd) \
-. ((bfd_coff_backend_data *) (abfd)->xvec->backend_data)
+. ((const bfd_coff_backend_data *) (abfd)->xvec->backend_data)
.
.#define bfd_coff_swap_aux_in(a,e,t,c,ind,num,i) \
. ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i))
.#define bfd_coff_long_filenames(abfd) \
. (coff_backend_info (abfd)->_bfd_coff_long_filenames)
.#define bfd_coff_long_section_names(abfd) \
-. (coff_backend_info (abfd)->_bfd_coff_long_section_names)
+. (coff_data (abfd)->long_section_names)
.#define bfd_coff_set_long_section_names(abfd, enable) \
. ((coff_backend_info (abfd)->_bfd_coff_set_long_section_names) (abfd, enable))
.#define bfd_coff_default_section_alignment_power(abfd) \
coff->relocbase = 0;
coff->local_toc_sym_map = 0;
+ bfd_coff_long_section_names (abfd)
+ = coff_backend_info (abfd)->_bfd_coff_long_section_names;
+
/* make_abs_section(abfd);*/
return true;
#define coff_SWAP_scnhdr_in coff_swap_scnhdr_in
#endif
-static bfd_coff_backend_data bfd_coff_std_swap_table ATTRIBUTE_UNUSED =
+static const bfd_coff_backend_data bfd_coff_std_swap_table ATTRIBUTE_UNUSED =
{
coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in,
coff_SWAP_aux_out, coff_SWAP_sym_out,
#ifdef TICOFF
/* COFF0 differs in file/section header size and relocation entry size. */
-static bfd_coff_backend_data ticoff0_swap_table =
+static const bfd_coff_backend_data ticoff0_swap_table =
{
coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in,
coff_SWAP_aux_out, coff_SWAP_sym_out,
#ifdef TICOFF
/* COFF1 differs in section header size. */
-static bfd_coff_backend_data ticoff1_swap_table =
+static const bfd_coff_backend_data ticoff1_swap_table =
{
coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in,
coff_SWAP_aux_out, coff_SWAP_sym_out,
return AUXESZ;
}
-static bfd_coff_backend_data bigobj_swap_table =
+static const bfd_coff_backend_data bigobj_swap_table =
{
coff_bigobj_swap_aux_in, coff_bigobj_swap_sym_in, coff_SWAP_lineno_in,
coff_bigobj_swap_aux_out, coff_bigobj_swap_sym_out,
/* The unswapped external symbols. May be NULL. Read by
_bfd_coff_get_external_symbols. */
void * external_syms;
- /* If this is TRUE, the external_syms may not be freed. */
- bool keep_syms;
/* The string table. May be NULL. Read by
_bfd_coff_read_string_table. */
char *strings;
/* The length of the strings table. For error checking. */
bfd_size_type strings_len;
+
+ /* Set if long section names are supported. A writable copy of the COFF
+ backend flag _bfd_coff_long_section_names. */
+ bool long_section_names;
+
+ /* If this is TRUE, the external_syms may not be freed. */
+ bool keep_syms;
/* If this is TRUE, the strings may not be freed. */
bool keep_strings;
/* If this is TRUE, the strings have been written out already. */
bool strings_written;
+ /* Is this a GO32 coff file? */
+ bool go32;
+
/* Is this a PE format coff file? */
int pe;
+
+ /* Copy of some of the f_flags bits in the COFF filehdr structure,
+ used by ARM code. */
+ flagword flags;
+
/* Used by the COFF backend linker. */
struct coff_link_hash_entry **sym_hashes;
/* The timestamp from the COFF file header. */
long timestamp;
- /* Copy of some of the f_flags bits in the COFF filehdr structure,
- used by ARM code. */
- flagword flags;
-
- /* Is this a GO32 coff file? */
- bool go32;
-
/* A stub (extra data prepended before the COFF image) and its size.
Used by coff-go32-exe, it contains executable data that loads the
COFF object into memory. */
/* The unswapped external symbols. May be NULL. Read by
_bfd_coff_get_external_symbols. */
void * external_syms;
- /* If this is TRUE, the external_syms may not be freed. */
- bool keep_syms;
/* The string table. May be NULL. Read by
_bfd_coff_read_string_table. */
char *strings;
/* The length of the strings table. For error checking. */
bfd_size_type strings_len;
+
+ /* Set if long section names are supported. A writable copy of the COFF
+ backend flag _bfd_coff_long_section_names. */
+ bool long_section_names;
+
+ /* If this is TRUE, the external_syms may not be freed. */
+ bool keep_syms;
/* If this is TRUE, the strings may not be freed. */
bool keep_strings;
/* If this is TRUE, the strings have been written out already. */
bool strings_written;
+ /* Is this a GO32 coff file? */
+ bool go32;
+
/* Is this a PE format coff file? */
int pe;
+
+ /* Copy of some of the f_flags bits in the COFF filehdr structure,
+ used by ARM code. */
+ flagword flags;
+
/* Used by the COFF backend linker. */
struct coff_link_hash_entry **sym_hashes;
/* The timestamp from the COFF file header. */
long timestamp;
- /* Copy of some of the f_flags bits in the COFF filehdr structure,
- used by ARM code. */
- flagword flags;
-
- /* Is this a GO32 coff file? */
- bool go32;
-
/* A stub (extra data prepended before the COFF image) and its size.
Used by coff-go32-exe, it contains executable data that loads the
COFF object into memory. */
} bfd_coff_backend_data;
#define coff_backend_info(abfd) \
- ((bfd_coff_backend_data *) (abfd)->xvec->backend_data)
+ ((const bfd_coff_backend_data *) (abfd)->xvec->backend_data)
#define bfd_coff_swap_aux_in(a,e,t,c,ind,num,i) \
((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i))
#define bfd_coff_long_filenames(abfd) \
(coff_backend_info (abfd)->_bfd_coff_long_filenames)
#define bfd_coff_long_section_names(abfd) \
- (coff_backend_info (abfd)->_bfd_coff_long_section_names)
+ (coff_data (abfd)->long_section_names)
#define bfd_coff_set_long_section_names(abfd, enable) \
((coff_backend_info (abfd)->_bfd_coff_set_long_section_names) (abfd, enable))
#define bfd_coff_default_section_alignment_power(abfd) \
pe->dos_message[15] = 0x0;
memset (& pe->pe_opthdr, 0, sizeof pe->pe_opthdr);
+
+ bfd_coff_long_section_names (abfd)
+ = coff_backend_info (abfd)->_bfd_coff_long_section_names;
+
return true;
}
return flags;
}
+static void
+set_long_section_mode (bfd *output_bfd, bfd *input_bfd, enum long_section_name_handling style)
+{
+ /* This is only relevant to Coff targets. */
+ if (bfd_get_flavour (output_bfd) == bfd_target_coff_flavour)
+ {
+ if (style == KEEP
+ && bfd_get_flavour (input_bfd) == bfd_target_coff_flavour)
+ style = bfd_coff_long_section_names (input_bfd) ? ENABLE : DISABLE;
+ bfd_coff_set_long_section_names (output_bfd, style != DISABLE);
+ }
+}
+
/* Copy object file IBFD onto OBFD.
Returns TRUE upon success, FALSE otherwise. */
return false;
}
+ /* This is a no-op on non-Coff targets. */
+ set_long_section_mode (obfd, ibfd, long_section_names);
+
/* Set the Verilog output endianness based upon the input file's
endianness. We may not be producing verilog format output,
but testing this just adds extra code this is not really
free (dir);
}
-static void
-set_long_section_mode (bfd *output_bfd, bfd *input_bfd, enum long_section_name_handling style)
-{
- /* This is only relevant to Coff targets. */
- if (bfd_get_flavour (output_bfd) == bfd_target_coff_flavour)
- {
- if (style == KEEP
- && bfd_get_flavour (input_bfd) == bfd_target_coff_flavour)
- style = bfd_coff_long_section_names (input_bfd) ? ENABLE : DISABLE;
- bfd_coff_set_long_section_names (output_bfd, style != DISABLE);
- }
-}
-
/* The top-level control. */
static void
gnu_debuglink_filename = NULL;
}
- /* This is a no-op on non-Coff targets. */
- set_long_section_mode (obfd, ibfd, long_section_names);
-
copy_archive (ibfd, obfd, output_target, force_output_target, input_arch);
}
else if (bfd_check_format_matches (ibfd, bfd_object, &obj_matching))
return;
}
- /* This is a no-op on non-Coff targets. */
- set_long_section_mode (obfd, ibfd, long_section_names);
-
if (! copy_object (ibfd, obfd, input_arch))
status = 1;