* som.c (som_begin_writing): Don't write the symbol table or
symbol strings. (som_finish_writing): Write them here. Place them after the subspace data, but before the relocs. Works around a truely stupid bug in the hpux8/hpux9 linker. Fixes all known link-time problems with -mlinker-opt.
This commit is contained in:
parent
130f53ae7a
commit
709af562b8
2 changed files with 62 additions and 38 deletions
|
@ -1,3 +1,18 @@
|
|||
Sun Oct 1 01:34:41 1995 Jeff Law (law@hurl.cygnus.com
|
||||
|
||||
* som.c (som_begin_writing): Don't write the symbol table or
|
||||
symbol strings.
|
||||
(som_finish_writing): Write them here. Place them after the
|
||||
subspace data, but before the relocs.
|
||||
|
||||
Fri Sep 29 11:01:55 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* sunos.c (sunos_add_one_symbol): Just pass false, not
|
||||
info->shared_library, to sunos_create_dynamic_sections.
|
||||
(sunos_scan_ext_relocs): Don't warn about a reloc in the .text
|
||||
section.
|
||||
(sunos_check_dynamic_reloc): Remove .text section assertion.
|
||||
|
||||
Thu Sep 28 18:48:47 1995 Stan Shebs <shebs@andros.cygnus.com>
|
||||
|
||||
* config.bfd: Add powerpc-*-macos*, powerpc-*-mpw*.
|
||||
|
|
85
bfd/som.c
85
bfd/som.c
|
@ -2987,9 +2987,8 @@ som_begin_writing (abfd)
|
|||
unsigned long current_offset = 0;
|
||||
int strings_size = 0;
|
||||
unsigned int total_reloc_size = 0;
|
||||
unsigned long num_spaces, num_subspaces, num_syms, i;
|
||||
unsigned long num_spaces, num_subspaces, i;
|
||||
asection *section;
|
||||
asymbol **syms = bfd_get_outsymbols (abfd);
|
||||
unsigned int total_subspaces = 0;
|
||||
struct som_exec_auxhdr *exec_header = NULL;
|
||||
|
||||
|
@ -3121,37 +3120,6 @@ som_begin_writing (abfd)
|
|||
obj_som_file_hdr (abfd)->space_strings_size = strings_size;
|
||||
current_offset += strings_size;
|
||||
|
||||
/* Next is the symbol table. These are fixed length records.
|
||||
|
||||
Count the number of symbols to determine how much room is needed
|
||||
in the object file for the symbol table.
|
||||
|
||||
The names of the symbols are stored in a separate string table,
|
||||
and the index for each symbol name into the string table is computed
|
||||
below. Therefore, it is not possible to write the symobl table
|
||||
at this time. */
|
||||
num_syms = bfd_get_symcount (abfd);
|
||||
obj_som_file_hdr (abfd)->symbol_location = current_offset;
|
||||
obj_som_file_hdr (abfd)->symbol_total = num_syms;
|
||||
current_offset += num_syms * sizeof (struct symbol_dictionary_record);
|
||||
|
||||
/* Next are the symbol strings.
|
||||
Align them to a word boundary. */
|
||||
if (current_offset % 4)
|
||||
current_offset += (4 - (current_offset % 4));
|
||||
obj_som_file_hdr (abfd)->symbol_strings_location = current_offset;
|
||||
|
||||
/* Scribble out the symbol strings. */
|
||||
if (som_write_symbol_strings (abfd, current_offset, syms,
|
||||
num_syms, &strings_size)
|
||||
== false)
|
||||
return false;
|
||||
|
||||
/* Record total string table size in header and update the
|
||||
current offset. */
|
||||
obj_som_file_hdr (abfd)->symbol_strings_size = strings_size;
|
||||
current_offset += strings_size;
|
||||
|
||||
/* Next is the compiler records. We do not use these. */
|
||||
obj_som_file_hdr (abfd)->compiler_location = current_offset;
|
||||
obj_som_file_hdr (abfd)->compiler_total = 0;
|
||||
|
@ -3362,20 +3330,60 @@ som_finish_writing (abfd)
|
|||
bfd *abfd;
|
||||
{
|
||||
int num_spaces = som_count_spaces (abfd);
|
||||
int i;
|
||||
asymbol **syms = bfd_get_outsymbols (abfd);
|
||||
int i, num_syms, strings_size;
|
||||
int subspace_index = 0;
|
||||
file_ptr location;
|
||||
asection *section;
|
||||
unsigned long current_offset;
|
||||
unsigned int total_reloc_size;
|
||||
|
||||
/* Next is the symbol table. These are fixed length records.
|
||||
|
||||
Count the number of symbols to determine how much room is needed
|
||||
in the object file for the symbol table.
|
||||
|
||||
The names of the symbols are stored in a separate string table,
|
||||
and the index for each symbol name into the string table is computed
|
||||
below. Therefore, it is not possible to write the symbol table
|
||||
at this time.
|
||||
|
||||
These used to be output before the subspace contents, but they
|
||||
were moved here to work around a stupid bug in the hpux linker
|
||||
(fixed in hpux10). */
|
||||
current_offset = obj_som_file_hdr (abfd)->som_length;
|
||||
|
||||
/* Make sure we're on a word boundary. */
|
||||
if (current_offset % 4)
|
||||
current_offset += (4 - (current_offset % 4));
|
||||
|
||||
num_syms = bfd_get_symcount (abfd);
|
||||
obj_som_file_hdr (abfd)->symbol_location = current_offset;
|
||||
obj_som_file_hdr (abfd)->symbol_total = num_syms;
|
||||
current_offset += num_syms * sizeof (struct symbol_dictionary_record);
|
||||
|
||||
/* Next are the symbol strings.
|
||||
Align them to a word boundary. */
|
||||
if (current_offset % 4)
|
||||
current_offset += (4 - (current_offset % 4));
|
||||
obj_som_file_hdr (abfd)->symbol_strings_location = current_offset;
|
||||
|
||||
/* Scribble out the symbol strings. */
|
||||
if (som_write_symbol_strings (abfd, current_offset, syms,
|
||||
num_syms, &strings_size)
|
||||
== false)
|
||||
return false;
|
||||
|
||||
/* Record total string table size in header and update the
|
||||
current offset. */
|
||||
obj_som_file_hdr (abfd)->symbol_strings_size = strings_size;
|
||||
current_offset += strings_size;
|
||||
|
||||
/* Do prep work before handling fixups. */
|
||||
som_prep_for_fixups (abfd,
|
||||
bfd_get_outsymbols (abfd),
|
||||
bfd_get_symcount (abfd));
|
||||
|
||||
current_offset = obj_som_file_hdr (abfd)->som_length;
|
||||
|
||||
/* At the end of the file is the fixup stream which starts on a
|
||||
word boundary. */
|
||||
if (current_offset % 4)
|
||||
|
@ -3390,7 +3398,8 @@ som_finish_writing (abfd)
|
|||
/* Record the total size of the fixup stream in the file header. */
|
||||
obj_som_file_hdr (abfd)->fixup_request_total = total_reloc_size;
|
||||
|
||||
obj_som_file_hdr (abfd)->som_length += total_reloc_size;
|
||||
/* Done. Store the total size of the SOM. */
|
||||
obj_som_file_hdr (abfd)->som_length = current_offset + total_reloc_size;
|
||||
|
||||
/* Now that the symbol table information is complete, build and
|
||||
write the symbol table. */
|
||||
|
@ -4976,7 +4985,7 @@ som_sizeof_headers (abfd, reloc)
|
|||
bfd *abfd;
|
||||
boolean reloc;
|
||||
{
|
||||
fprintf (stderr, "som_sizeof_headers unimplemented\n");
|
||||
(*_bfd_error_handler) ("som_sizeof_headers unimplemented");
|
||||
fflush (stderr);
|
||||
abort ();
|
||||
return (0);
|
||||
|
|
Loading…
Reference in a new issue