* coffcode.h (STRING_SIZE_SIZE): Define.
(bfd_coff_backend_data): Add _bfd_coff_long_section_names field. (bfd_coff_long_section_names): Define. (coff_write_object_contents): Handle long section names. (bfd_coff_std_swap_table): Initialize new field. * libcoff.h: Rebuild. * coffgen.c (make_a_section_from_file): Handle long section names. (coff_write_symbols): Handle long section names. * coff-alpha.c (alpha_ecoff_backend_data): Initialize new field. * coff-mips.c (mips_ecoff_backend_data): Likewise. * pe-arm.c (COFF_LONG_SECTION_NAMES): Define. * pei-arm.c (COFF_LONG_SECTION_NAMES): Define. * pe-i386.c (COFF_LONG_SECTION_NAMES): Define. * pei-i386.c (COFF_LONG_SECTION_NAMES): Define. * pe-ppc.c (COFF_LONG_SECTION_NAMES): Define. * pei-ppc.c (COFF_LONG_SECTION_NAMES): Define.
This commit is contained in:
parent
ae105b8e5a
commit
e8f3bb64b5
@ -1,5 +1,23 @@
|
||||
Wed May 1 14:17:57 1996 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* coffcode.h (STRING_SIZE_SIZE): Define.
|
||||
(bfd_coff_backend_data): Add _bfd_coff_long_section_names field.
|
||||
(bfd_coff_long_section_names): Define.
|
||||
(coff_write_object_contents): Handle long section names.
|
||||
(bfd_coff_std_swap_table): Initialize new field.
|
||||
* libcoff.h: Rebuild.
|
||||
* coffgen.c (make_a_section_from_file): Handle long section
|
||||
names.
|
||||
(coff_write_symbols): Handle long section names.
|
||||
* coff-alpha.c (alpha_ecoff_backend_data): Initialize new field.
|
||||
* coff-mips.c (mips_ecoff_backend_data): Likewise.
|
||||
* pe-arm.c (COFF_LONG_SECTION_NAMES): Define.
|
||||
* pei-arm.c (COFF_LONG_SECTION_NAMES): Define.
|
||||
* pe-i386.c (COFF_LONG_SECTION_NAMES): Define.
|
||||
* pei-i386.c (COFF_LONG_SECTION_NAMES): Define.
|
||||
* pe-ppc.c (COFF_LONG_SECTION_NAMES): Define.
|
||||
* pei-ppc.c (COFF_LONG_SECTION_NAMES): Define.
|
||||
|
||||
* bout.c (b_out_callback): Set lma of sections.
|
||||
(b_out_bfd_get_relocated_section_contents): Rename in_abfd
|
||||
parameter to output_bfd. Used input_bfd instead of output_bfd in
|
||||
|
@ -309,6 +309,7 @@ CODE_FRAGMENT
|
||||
#include "coffswap.h"
|
||||
#endif
|
||||
|
||||
#define STRING_SIZE_SIZE (4)
|
||||
|
||||
/* void warning(); */
|
||||
|
||||
@ -724,6 +725,7 @@ dependent COFF routines:
|
||||
. unsigned int _bfd_relsz;
|
||||
. unsigned int _bfd_linesz;
|
||||
. boolean _bfd_coff_long_filenames;
|
||||
. boolean _bfd_coff_long_section_names;
|
||||
. void (*_bfd_coff_swap_filehdr_in) PARAMS ((
|
||||
. bfd *abfd,
|
||||
. PTR ext,
|
||||
@ -875,6 +877,8 @@ dependent COFF routines:
|
||||
.#define bfd_coff_relsz(abfd) (coff_backend_info (abfd)->_bfd_relsz)
|
||||
.#define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz)
|
||||
.#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)
|
||||
.#define bfd_coff_swap_filehdr_in(abfd, i,o) \
|
||||
. ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o))
|
||||
.
|
||||
@ -2267,9 +2271,11 @@ coff_write_object_contents (abfd)
|
||||
asection *text_sec = NULL;
|
||||
asection *data_sec = NULL;
|
||||
asection *bss_sec = NULL;
|
||||
|
||||
struct internal_filehdr internal_f;
|
||||
struct internal_aouthdr internal_a;
|
||||
#ifdef COFF_LONG_SECTION_NAMES
|
||||
size_t string_size = STRING_SIZE_SIZE;
|
||||
#endif
|
||||
|
||||
bfd_set_error (bfd_error_system_call);
|
||||
|
||||
@ -2354,7 +2360,25 @@ coff_write_object_contents (abfd)
|
||||
|
||||
#endif
|
||||
internal_f.f_nscns++;
|
||||
strncpy (&(section.s_name[0]), current->name, 8);
|
||||
|
||||
strncpy (section.s_name, current->name, SCNNMLEN);
|
||||
|
||||
#ifdef COFF_LONG_SECTION_NAMES
|
||||
/* Handle long section names as in PE. This must be compatible
|
||||
with the code in coff_write_symbols. */
|
||||
{
|
||||
size_t len;
|
||||
|
||||
len = strlen (current->name);
|
||||
if (len > SCNNMLEN)
|
||||
{
|
||||
memset (section.s_name, 0, SCNNMLEN);
|
||||
sprintf (section.s_name, "/%d", string_size);
|
||||
string_size += len + 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _LIB
|
||||
/* Always set s_vaddr of .lib to 0. This is right for SVR3.2
|
||||
Ian Taylor <ian@cygnus.com>. */
|
||||
@ -2831,8 +2855,8 @@ coff_write_object_contents (abfd)
|
||||
return false;
|
||||
{
|
||||
char buff[FILHSZ];
|
||||
coff_swap_filehdr_out (abfd, (PTR) & internal_f, (PTR) & buff);
|
||||
if (bfd_write ((PTR) & buff, 1, FILHSZ, abfd) != FILHSZ)
|
||||
coff_swap_filehdr_out (abfd, (PTR) & internal_f, (PTR) buff);
|
||||
if (bfd_write ((PTR) buff, 1, FILHSZ, abfd) != FILHSZ)
|
||||
return false;
|
||||
}
|
||||
if (abfd->flags & EXEC_P)
|
||||
@ -2840,8 +2864,8 @@ coff_write_object_contents (abfd)
|
||||
/* Note that peicode.h fills in a PEAOUTHDR, not an AOUTHDR.
|
||||
include/coff/pe.h sets AOUTSZ == sizeof(PEAOUTHDR)) */
|
||||
char buff[AOUTSZ];
|
||||
coff_swap_aouthdr_out (abfd, (PTR) & internal_a, (PTR) & buff);
|
||||
if (bfd_write ((PTR) & buff, 1, AOUTSZ, abfd) != AOUTSZ)
|
||||
coff_swap_aouthdr_out (abfd, (PTR) & internal_a, (PTR) buff);
|
||||
if (bfd_write ((PTR) buff, 1, AOUTSZ, abfd) != AOUTSZ)
|
||||
return false;
|
||||
}
|
||||
#ifdef RS6000COFF_C
|
||||
@ -3697,6 +3721,11 @@ static CONST bfd_coff_backend_data bfd_coff_std_swap_table =
|
||||
true,
|
||||
#else
|
||||
false,
|
||||
#endif
|
||||
#ifdef COFF_LONG_SECTION_NAMES
|
||||
true,
|
||||
#else
|
||||
false,
|
||||
#endif
|
||||
coff_swap_filehdr_in, coff_swap_aouthdr_in, coff_swap_scnhdr_in,
|
||||
coff_swap_reloc_in, coff_bad_format_hook, coff_set_arch_mach_hook,
|
||||
|
@ -617,6 +617,7 @@ typedef struct
|
||||
unsigned int _bfd_relsz;
|
||||
unsigned int _bfd_linesz;
|
||||
boolean _bfd_coff_long_filenames;
|
||||
boolean _bfd_coff_long_section_names;
|
||||
void (*_bfd_coff_swap_filehdr_in) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR ext,
|
||||
@ -768,6 +769,8 @@ typedef struct
|
||||
#define bfd_coff_relsz(abfd) (coff_backend_info (abfd)->_bfd_relsz)
|
||||
#define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz)
|
||||
#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)
|
||||
#define bfd_coff_swap_filehdr_in(abfd, i,o) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user