aboutsummaryrefslogtreecommitdiff
path: root/bfd/aoutf1.h
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1994-01-21 06:29:21 +0000
committerIan Lance Taylor <ian@airs.com>1994-01-21 06:29:21 +0000
commit0ee75d02e516e8ee40f45733855771936ed30490 (patch)
treeba4c096f9693c37e70dd9de71f69222a16c09ce9 /bfd/aoutf1.h
parent5e6cd559cfa7fd45d9f128903d1f42344bcfd03d (diff)
downloadgdb-0ee75d02e516e8ee40f45733855771936ed30490.zip
gdb-0ee75d02e516e8ee40f45733855771936ed30490.tar.gz
gdb-0ee75d02e516e8ee40f45733855771936ed30490.tar.bz2
* syms.c (BSF_DYNAMIC): New symbol flag.
(bfd_print_symbol_vandf): Print it. * bfd-in2.h: Rebuilt. * libaout.h (struct aout_backend_data): New read_dynamic_symbols and read_dynamic_relocs fields. (struct aoutdata): New dynamic_info field. (obj_aout_dynamic_info): New accessor macro. * sunos.c (struct sunos_dynamic_info): New structure. (sunos_read_dynamic_info, MY(read_dynamic_symbols), MY(read_dynamic_relocs)): New functions to read dynamic symbols and relocs. * aoutx.h (NAME(aout,some_aout_object_p)): If the object is dynamically linked, set SEC_RELOC for both the .text and .data sections. (translate_from_native_sym_flags): Don't set BSF_LOCAL for an undefined symbol. (translate_symbol_table): New function, split out of slurp_symbol_table; set the BSF_DYNAMIC flag appropriately. (NAME(aout,slurp_symbol_table)): Read dynamic symbols, if any. (NAME(aout,slurp_reloc_table)): Read dynamic relocs, if any. (NAME(aout,get_reloc_upper_bound)): Include dynamic reloc count in return value. * aoutf1.h (NAME(aout,sunos4_write_object_contents)): Don't write out dynamic symbols or relocs against reloc symbols, since they are already in the .text section and we wouldn't know where to write them anyhow. (sunos4_aout_backend): Initialize read_dynamic_symbols and read_dynamic_relocs fields. * aout-target.h (MY(backend_data)): Initialize read_dynamic_symbols and read_dynamic_relocs fields.
Diffstat (limited to 'bfd/aoutf1.h')
-rw-r--r--bfd/aoutf1.h80
1 files changed, 78 insertions, 2 deletions
diff --git a/bfd/aoutf1.h b/bfd/aoutf1.h
index 2f4b728..b5dcecf 100644
--- a/bfd/aoutf1.h
+++ b/bfd/aoutf1.h
@@ -195,7 +195,70 @@ DEFUN(NAME(aout,sunos4_write_object_contents),
*/
N_SET_FLAGS (*execp, 1);
#endif
-
+
+ N_SET_DYNAMIC(*execp, bfd_get_file_flags(abfd) & DYNAMIC);
+
+ /* At least for SunOS, the dynamic symbols and relocs are embedded
+ in the .text section, and we do not want to write them out with
+ the symbol table. FIXME: This may be right if there is any other
+ form of a.out shared libraries. */
+ if ((bfd_get_file_flags (abfd) & DYNAMIC) != 0
+ && bfd_get_outsymbols (abfd) != (asymbol **) NULL)
+ {
+ bfd_size_type i;
+ asymbol **sym_ptr_ptr;
+ bfd_size_type count;
+ arelent **rel_ptr_ptr;
+
+ sym_ptr_ptr = bfd_get_outsymbols (abfd);
+ count = bfd_get_symcount (abfd);
+ for (i = 0; i < count; i++, sym_ptr_ptr++)
+ {
+ if (((*sym_ptr_ptr)->flags & BSF_DYNAMIC) != 0)
+ {
+ /* This assumes that all dynamic symbols follow all
+ non-dynamic symbols, which is what slurp_symbol_table
+ does. */
+ *sym_ptr_ptr = NULL;
+ bfd_get_symcount (abfd) = i;
+ break;
+ }
+ }
+
+ if (obj_textsec (abfd)->reloc_count > 0)
+ {
+ rel_ptr_ptr = obj_textsec (abfd)->orelocation;
+ count = obj_textsec (abfd)->reloc_count;
+ for (i = 0; i < count; i++, rel_ptr_ptr++)
+ {
+ if (((*(*rel_ptr_ptr)->sym_ptr_ptr)->flags & BSF_DYNAMIC) != 0)
+ {
+ /* This assumes that all relocs against dynamic
+ symbols follow all relocs against other symbols,
+ which is what slurp_reloc_table does. */
+ *rel_ptr_ptr = NULL;
+ obj_textsec (abfd)->reloc_count = i;
+ break;
+ }
+ }
+ }
+
+ if (obj_datasec (abfd)->reloc_count > 0)
+ {
+ rel_ptr_ptr = obj_datasec (abfd)->orelocation;
+ count = obj_datasec (abfd)->reloc_count;
+ for (i = 0; i < count; i++, rel_ptr_ptr++)
+ {
+ if (((*(*rel_ptr_ptr)->sym_ptr_ptr)->flags & BSF_DYNAMIC) != 0)
+ {
+ *rel_ptr_ptr = NULL;
+ obj_datasec (abfd)->reloc_count = i;
+ break;
+ }
+ }
+ }
+ }
+
WRITE_HEADERS(abfd, execp);
return true;
@@ -586,8 +649,21 @@ DEFUN (sunos4_set_sizes, (abfd),
}
}
+#ifndef MY_read_dynamic_symbols
+#define MY_read_dynamic_symbols 0
+#endif
+#ifndef MY_read_dynamic_relocs
+#define MY_read_dynamic_relocs 0
+#endif
+
static CONST struct aout_backend_data sunos4_aout_backend = {
- 0, 1, 0, sunos4_set_sizes, 0,
+ 0, /* zmagic files are not contiguous */
+ 1, /* text includes header */
+ 0, /* default text vma */
+ sunos4_set_sizes,
+ 0, /* header is counted in zmagic text */
+ MY_read_dynamic_symbols,
+ MY_read_dynamic_relocs
};
#define MY_core_file_failing_command sunos4_core_file_failing_command