Commit Graph

8502 Commits

Author SHA1 Message Date
Ian Lance Taylor 728472f170 Minor cleanups suggested by CodeCenter.
* aoutx.h, coffgen.c, ecoff.c, ecofflink.c, elf.c, libbfd.c,
	linker.c, reloc.c, section.c, srec.c: Added /*ARGSUSED*/ as
	appropriate.
	* aoutx.h (struct external_exec): Removed unnecessary declaration.
	(NAME(aout,some_aout_object_p)): Set some tdata pointers to NULL.
	(adjust_z_magic): Removed useless variable data_vma.
	(stringtab_init): Initialize hash_zero.
	(add_to_stringtab): Removed unused fourth argument.
	(NAME(aout,swap_std_reloc_out)): Removed useless variable
	r_addend.
	(aout_link_input_section): Added some casts.
	* archive.c (get_extended_arelt_filename, do_slurp_coff_armap,
	bfd_ar_hdr_from_filesystem, bsd_write_armap, coff_write_armap):
	Minor code rewriting to make it more C like.
	(do_slurp_bsd_armap): Added some casts.
	* ecoff.c (ecoff_write_object_contents): Removed useless variable
	scn_base.
	(ecoff_write_armap): Added some casts.  Use "" rather than "\0".
	* ecofflink.c (bfd_ecoff_write_debug): Added a cast.
	* libaout.h (struct internal_exec): Removed unnecessary
	declaration.
	* linker.c (_bfd_generic_indirect_link_order): Added a cast.
	* opncls.c (new_bfd): Removed a cast.
	* reloc.c (bfd_generic_get_relocated_section_contents): Added
	some casts.
	* srec.c (internal_srec_write_object_contents): Removed useless
	variable bytes_written.
1993-12-31 21:51:05 +00:00
Ian Lance Taylor 1d166443d4 * ldgram.y (yyerror): Make argument const char *, and actually
print it out rather than assuming it is a syntax error.
	* ldmisc.h: Change declaration of yyerror.
	* ldemul.c, ldwrite.c: Add /*ARGSUSED*/ as appropriate.
1993-12-31 21:17:33 +00:00
David MacKenzie ae9c800701 * emulparams/i386mach.sh (NONPAGED_TEXT_START_ADDR): Don't include
exec header offset, since the exec header isn't loaded.
	(PAGE_SIZE, SEGMENT_SIZE): Agree with bfd/i386mach3.c.
1993-12-31 21:13:03 +00:00
David MacKenzie 696df58f2d * i386mach3.c (N_TXTADDR): Don't define after all.
(TEXT_START_ADDR): Don't include exec header size in value.
1993-12-31 21:11:49 +00:00
David MacKenzie 4156620964 minor fixes 1993-12-31 21:08:12 +00:00
Jim Kingdon fa255c07df * stack.c (print_block_frame_locals): Also print LOC_BASEREG variables. 1993-12-31 19:41:30 +00:00
Peter Schauer d0cde99c87 * symtab.c (find_methods): Call fprintf_symbol_filtered with DMGL_ANSI. 1993-12-31 14:57:19 +00:00
John Gilmore 534694b377 Insert Peter Kessler's name as inventor (I think). 1993-12-31 08:45:16 +00:00
Jim Kingdon 96e5f16150 * remote-mips.c (mips_error): New function.
* remote-mips.c: Use it instead of error() most places.
	* remote-mips.c (mips_receive_packet): New arg throw_error.
	(mips_initialize): Use it not catch_errors.
	* defs.h: Declare error_pre_print and warning_pre_print here...
	* main.c: ...not here.
1993-12-31 03:05:15 +00:00
David MacKenzie e450eb45f5 Define N_TXTADDR 1993-12-30 23:48:44 +00:00
Jim Kingdon ca0865db54 * values.c (unpack_long): Fix garbled error message. 1993-12-30 22:49:48 +00:00
Jim Kingdon 4fb192bec1 * remote-mips.c (mips_error): New function.
* remote-mips.c: Use it instead of error() most places.
1993-12-30 22:25:52 +00:00
Ian Lance Taylor 2975f1f04f Rebuilt after removal of seclet.c from doc/Makefile.in. 1993-12-30 22:14:19 +00:00
Ken Raeburn f3e7b8b089 Makefile.in: Delete all references to seclet.c, since it's just been deleted.
Don't mention hash.c, linker.c, or genlink.h yet, since they don't contain
documentation yet (hint, hint!).
1993-12-30 22:02:22 +00:00
Jim Kingdon 05052b638c * breakpoint.c (breakpoint_chain): Make static.
* breakpoint.c, breakpoint.h (frame_in_dummy): New function.
	* stack.c (print_frame_info): Use it.
1993-12-30 20:34:06 +00:00
Ian Lance Taylor da6b2d99f7 Added new files for linker support, and removed old seclet files. 1993-12-30 20:03:34 +00:00
Ian Lance Taylor 93b135859d Removed files that are no longer used by the rewritten linker. 1993-12-30 19:57:49 +00:00
Ian Lance Taylor 4c3721d514 Extensive changes to move the bulk of the linker into BFD so that
more efficient backend code can be written for specific object
	files.  Only existing efficient backend is a.out.
	* seclet.c, seclet.h: Removed.
	* hash.c, linker.c, genlink.h: New files.
	* bfd-in.h: Removed bfd_error_vector.  Declared hash table
	structures and functions.
	(JUMP_TABLE): Removed bfd_seclet_link, added
	bfd_link_hash_table_create, bfd_link_add_symbols and
	bfd_final_link.
	* All backends: Changed accordingly.
	* bfd-in2.h: Rebuilt.
	* bfd.c (struct _bfd): Added link_next and archive_pass fields.
	Removed ld_symbols field.
	(bfd_nonrepresentable_section, bfd_undefined_symbol,
	bfd_reloc_value_truncated, bfd_reloc_is_dangerous,
	bfd_error_vector): Removed.
	(bfd_default_error_trap, bfd_error_trap,
	bfd_error_nonrepresentabltrap): Removed.
	(bfd_get_relocated_section_contents): Pass link_info.  Pass
	link_order instead of seclet.  Pass symbols.
	(bfd_relax_section): Pass link_info.
	(bfd_seclet_link): Removed.
	(bfd_link_hash_table_create, bfd_link_add_symbols,
	bfd_final_link): New macros.
	* libbfd-in.h: If __GNUC__ is defined and alloca is not, define
	alloca as __builtin_alloca.  Declare internal linking functions.
	* libbfd.h: Rebuilt.
	* libbfd.c (bfd_seek): Comment out fseek assertion.  It's worked
	for months.
	* reloc.c (reloc_howto_type): Added error_message argument to
	special_function field.  Changed all callers and all definitions.
	(bfd_get_reloc_size): Make argument a const pointer.
	(bfd_perform_relocation): Add error_message argument to hold
	string set if return value if bfd_reloc_dangerous.  Changed all
	callers.
	(_bfd_final_link_relocate, _bfd_relocate_contents): New functions.
	* section.c (asection): Renamed seclets_head and seclets_tail to
	link_order_head and link_order_tail.
	* targets.c (bfd_target): Replaced seclet argument with link_info
	and link_order and symbols arguments in
	bfd_get_relocated_section_contents.  Added symbols argument to
	bfd_relax_section.  Removed bfd_seclet_link.  Added
	bfd_link_hash_table_create, bfd_link_add_symbols and
	bfd_final_link.
	* libaout.h (struct aoutdata): Added external_syms,
	external_sym_count, external_strings, sym_hashes fields.
	(obj_aout_external_syms, obj_aout_external_sym_count,
	obj_aout_external_strings, obj_aout_sym_hashes): New accessor
	macros.
	(WRITE_HEADERS): Only output symbols if outsymbols is not NULL.
	* aoutx.h: Wrote new back end linker routines.
	(translate_to_native_sym_flags): Return boolean value.  Don't use
	bfd_error_vector.
	(NAME(aout,write_syms)): Return boolean value.  Check return value
	of translate_to_native_sym_flags and bfd_write.
	* aout-target.h (final_link_callback): New function.
	(MY_bfd_final_link): New function.
	* aout-adobe.c (aout_adobe_write_object_contents): Check return
	value of aout_32_write_syms.
	* hp300hpux.c (MY(write_object_contents)): Likewise.
	* i386lynx.c (WRITE_HEADERS): Likewise.
	* libaout.h (WRITE_HEADERS): Likewise.
	* bout.c: Changed functions to use link_info->callbacks rather
	than bfd_error_vector, and link_orders rather than seclets.
	* coff-alpha.c: Likewise.
	* coff-h8300.c: Likewise.
	* coff-h8500.c: Likewise.
	* coff-sh.c: Likewise.
	* coff-z8k.c: Likewise.
	* elf32-hppa.c: Likewise.
	* reloc16.c: Likewise.
	* coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Look
	up _gp in the hash table rather than in outsymbols.
	* coff-a29k.c (a29k_reloc): Pass errors back in new error_message
	argument rather than printing them.
	* coffcode.h (bfd_coff_reloc16_extra_cases): Take link_info and
	link_order arguments rather than seclet.  Changed all uses and
	definitions.
	(bfd_coff_reloc16_estimate): Pass link_info arguments.  Changed
	all uses and definitions.
	* libcoff.h: Rebuilt.
	* ecoff.c (ecoff_get_extr): If symbol is defined by linker, but
	not by ECOFF, make it scAbs.
	(ecoff_bfd_final_link): Renamed from ecoff_bfd_seclet_link and
	rewritten.
	* elf32-mips.c (mips_elf_final_link): Renamed from
	mips_elf_seclet_link and rewritten.
	* elf32-hppa.c (elf32_hppa_stub_description): Added link_info
	field.
	(new_stub, add_stub_by_name, hppa_elf_build_arg_reloc_stub,
	hppa_elf_build_long_branch_stub, hppa_look_for_stubs_in_section):
	Added link_info arguments.  Changed all callers.
	* elfcode.h (elf_slurp_symbol_table): Don't quit if outsymbols is
	not NULL.
	* oasys.c (oasys_write_sections): Return boolean value rather than
	using bfd_error_vector.
	(oasys_write_object_contents): Check return value of
	oasys_write_sections.
	* hosts/std-host.h: Don't declare qsort or strtol.
	* Makefile.in: Rebuild dependencies.
	(BFD_LIBS): Removed seclet.o.  Added hash.o and linker.o.
	(CFILES): Removed seclet.c.  Added hash.c and linker.c.
	(HFILES): Removed seclet.h.  Added genlink.h.
1993-12-30 19:56:50 +00:00
Ian Lance Taylor 4a6afc88bb A major rewrite to move the bulk of the linker into BFD so that
more efficient backend code can be written for specific object
	files.
	* lderror.c, lderror.h, ldindr.c, ldindr.h, ldsym.c, ldsym.h,
	ldwarn.c, ldwarn.h, relax.c, relax.h: Removed.
	* ldctor.c, ldctor.h: Complete rewrite.
	* ldwrite.c, ldwrite.h: Complete rewrite.
	* ld.h (strip_symbols_type, strip_symbols): Removed.  Use
	link_info.strip instead.  Changed all uses.
	(discard_locals_type, discard_locals): Removed.  Use
	link_info.discard instead.  Changed all uses.
	(ld_config_type): Removed relocateable_output field; use
	link_info.relocateable instead; changed all uses.  Added stats
	field.
	(set_asymbol_chain, get_asymbol_chain, get_loader_symbol,
	set_loader_symbol): Removed.
	* ldexp.h (node_class): Added etree_rel.
	(etree_type): Added rel field.
	* ldexp.c (exp_print_token): Bracketed table initialization.
	(exp_relop): New function.
	(fold_name): Use linker hash table rather than ldsym functions.
	(exp_fold_tree): Likewise.  Also, handle etree_rel case.
	(exp_print_tree): Handle etree_rel.
	* ldgram.y (strip_symbols, discard_locals): Removed.
	(OPTION_stats, OPTION_no_keep_memory): New tokens.  Handle them.
	(REL): New token.  Does not appear in grammar, but needed for
	expression code.
	(file): Don't call lang_final; it's called by main anyhow.
	* ldlex.l: Accept -stats and -no-keep-memory options.
	* ldlang.h (fill_type): Make unsigned int, not unsigned short.
	* ldlang.c: Consistently use fill_type for fill argument.
	(lang_init_script_file, script_file): Removed.
	(create_object_symbols): Removed.  Use
	link_info.create_object_symbols_section instead.  Changed all
	uses.
	(lang_add_keepsyms_file): Removed.
	(lookup_name): Call bfd_link_add_symbols instead of
	ldmain_open_file_read_symbol.
	(wild): Don't iterate over script_file.
	(open_output): Create link hash table.
	(lang_place_undefineds): Rewrote.
	(lang_size_sections): Handle relaxing (doesn't work yet).
	(lang_relocate_globals): Removed.
	(lang_finish): Use link hash table rather than ldsym functions.
	(lang_common): Rewrote.
	(lang_one_common): New function.
	(ldlang_add_file): Add file to link_info.input_bfds list.  Set
	usrdata.
	(create_symbol): Removed.
	(lang_process): Don't call lang_init_script_file.  Call
	ldctor_build_sets rather than find_constructors.  Don't call
	lang_relocate_globals.
	(lang_abs_symbol_at_beginning_of): Rewrote.
	(lang_abs_symbol_at_end_of): Rewrote.
	* ldmain.c (had_y): Removed.
	(lprefix, lprefix_len): Removed; use link_info fields instead.
	Changed all uses.
	(multiple_def_count, commons_pending, undefined_global_sym_count,
	total_symbols_seen, total_files_seen): Removed.
	(link_callbacks, link_info): New variables.
	(main): Initialize link_info.  Don't call init_bfd_error_vector or
	ldsym_init.  Don't set now unused variables.  Handle -stats.
	(get_emulation): Removed obsolete and nonfunctional GNU960 code.
	(add_ysym): Rewrote.
	(read_entry_symbols, refize, enter_global_ref, enter_file_symbols,
	search_library, gnu960_check_format, decode_library_subfile,
	linear_library, symdef_library, clear_syms, subfile_wanted_p):
	Removed.
	(add_keepsyms_file, add_archive_element, multiple_definition,
	multiple_common, add_to_set, warning_callback, undefined_symbol,
	reloc_overflow, reloc_dangerous, unattached_reloc, notice_ysym):
	New functions.
	* ldmisc.c (vfinfo): Accept a string for %T, not a symbol.  Don't
	require symbols for %C; look them up instead.
	* emultempl/hppaosf.em: Pass link_info to
	hppa_look_for_stubs_in_section.
	* Makefile.in: Rebuilt dependencies.
	(CFILES): Removed lderror.c, ldindr.c, ldsym.c, ldwarn.c, and
	relax.c.
	(HFILES): Removed lderror.h, ldindr.h, ldsym.h, ldwarn.h, and
	relax.h.
	(EMULATION_OFILES): Depend on bfdlink.h, ldmain.h, ldexp.h,
	ldlang.h and ldctor.h.

	* Makefile.in (ldlex.c): Don't depend on ldgram.h.  Remove
	declarations of free and malloc from flex output.  Change malloc
	to ldmalloc in flex output.
1993-12-30 19:51:41 +00:00
Ian Lance Taylor 9a0418eb7b * bfdlink.h: New file for new BFD linker backend routines. 1993-12-30 18:44:54 +00:00
Peter Schauer 2d3ae7bf6d * exec.c (add_to_section_table): Check for SEC_ALLOC instead of
SEC_LOAD to handle .bss segments properly.
1993-12-30 15:56:06 +00:00
Peter Schauer 1adbf66264 * section.c (bfd_get_section_contents): Return zero filled buffer
if section has no contents.
1993-12-30 15:51:16 +00:00
Jim Kingdon f161923490 * infrun.c (wait_for_inferior): Enable code which assumes that if
we jump into the prologue from another function, then it was a
	subroutine call.  #if 0 AT_FUNCTION_START; the above code should
	take care of this case.
1993-12-30 15:27:52 +00:00
Jeff Law 6816e053e6 Revert last change. It loses. 1993-12-30 07:00:31 +00:00
Jim Kingdon 6f4baef628 * valprint.c (val_print_string): Change chunksize from 200
to 8.
1993-12-30 02:40:05 +00:00
Jim Kingdon 7ec52804fe * symfile.c (generic_load): If no arguments, get file name
from get_exec_file.
1993-12-29 21:29:44 +00:00
Ken Raeburn 9314b3a125 * write.h (struct fix): Field tc_fix_data should be type PTR, not void*, for
compatibility with non-ANSI compilers.  Added single-bit field "fx_done".
1993-12-29 21:21:21 +00:00
Ken Raeburn 1c0f9b3ecc put a breakpoint in as_bad_where too 1993-12-29 21:19:41 +00:00
Jim Kingdon 393e55bac4 * c-exp.y: Revert Kung's change. "..." is not a type, and the
change caused "p (...)0" to dump core.
	* gdbtypes.c (check_stub_method): Don't pass "..." to
	parse_and_eval_type.  This should fix the bug which Kung was
	trying to fix.
1993-12-29 20:52:06 +00:00
Jeff Law 88b245830a * gas/hppa/more.parse/labelbug.s: Add more colonless label
tests.
1993-12-29 19:37:20 +00:00
Jeff Law 001581c784 * app.c (do_scrub_next_char): Fix more bugs dealing with
labels without colons (For HPPA and MRI).
1993-12-29 19:33:31 +00:00
Jim Kingdon 4bfe9e81cd * stabsread.c (define_symbol): If we choose not to combine
two symbols, don't just ignore the second (LOC_REGISTER) one.
	* printcmd.c (print_frame_args): If we have a LOC_ARG and a
	LOC_REGISTER, use the LOC_ARG not the LOC_REGISTER.
1993-12-29 18:42:52 +00:00
Jim Kingdon 6c06a518bf * stabs.texinfo (Cross-References): `::' is for nested types only
within <>.
	(Structures): Document static members.
1993-12-29 16:22:31 +00:00
Fred Fish 96e5cb2138 * solib.c (DEBUG_BASE): Remove macro and all references.
* solib.c (debug_base_symbols):  Add array of symbols to lookup.
	* solib.c (IGNORE_FIRST_LINK_MAP_ENTRY):  Add macro.
	* solib.c (look_for_base, locate_base):  Use debug_base_symbols.
	* solib.c (find_solib):  Use IGNORE_FIRST_LINK_MAP_ENTRY.
1993-12-28 23:15:20 +00:00
Kung Hsu bbc2cef268 CVS:
Modified Files:
	ChangeLog c-exp.y

        * c-exp.y : fix grammar to parse ellipsis (...)
	(fix pr4218)
1993-12-28 20:11:25 +00:00
Ian Lance Taylor d1b44e837e * elf.c (bfd_elf_generic_reloc): If this is not an inplace reloc,
then skip bfd_perform_relocation even if the addend is non-zero.
1993-12-28 17:45:14 +00:00
Kung Hsu 279a3cfdfb Modified Files:
ChangeLog stabsread.c

        * stabsread.c (read_type): fix problem when reading static member
        of a class. caused by change to allow :: inside template
        instantiated name.
1993-12-28 02:46:34 +00:00
Mark Eichin f2f824ae57 * config/i386-linux.mt: delete ".sh" from genscripts argument
(change made to genscripts on July 21...)

This is all it took for linux-native ld to build. It isn't necessarily useful,
particularly as gcc is still configured to pass -m486 and -dll-verbose, which
this ld doesn't parse...
1993-12-27 19:39:55 +00:00
Jim Kingdon 168e808729 * stabs.texinfo: Document S type attribute. 1993-12-27 18:59:39 +00:00
Jim Kingdon 666e7e4121 * gdbtypes.h: Expand on comments for TYPE_CODE_BITSTRING and
TYPE_CODE_STRING a bit.
1993-12-27 18:56:23 +00:00
Jim Kingdon 30ae2c91cb * m68k-tdep.c (m68k_skip_prologue, m68k_find_saved_regs):
Allow pea %fp; move.l %sp, %fp instead of link instruction to
	set up the new frame.
1993-12-27 18:44:07 +00:00
Jim Kingdon d6bbac399c * main.c (init_main): Change "set remotedebug" back to var_zinteger
from var_boolean.
1993-12-27 18:26:57 +00:00
Jim Kingdon 240972ecfb * minsyms.c (prim_record_minimal_symbol): Call
prim_record_minimal_symbol_and_info rather than duplicating code.
1993-12-27 17:49:00 +00:00
Jim Kingdon 8d60affde9 * minsyms.c, symtab.h (prim_record_minimal_symbol{,_and_info}),
coffread.c (record_minimal_symbol),
	xcoffread.c (RECORD_MINIMAL_SYMBOL), callers: Add objfile parameter.
1993-12-27 17:47:28 +00:00
Jim Kingdon dfb4a50861 * c-exp.y (yylex): Don't try to deal with nested types. 1993-12-27 17:27:45 +00:00
Jim Kingdon 2d2fc7e464 * cp-valprint.c (cplus_print_value): Call check_stub_type on
TYPE_BASECLASS (type, i) before we look at its name.
1993-12-27 17:01:03 +00:00
Jim Kingdon 404f69a80b * dbxread.c: Move default definition of GCC_COMPILED_FLAG_SYMBOL
from here . . .
	* symtab.h: . . . to here.
	* dbxread.c (record_minimal_symbol): Move check for gcc{,2}_compiled.
	and __gnu_compiled* from here . . .
	* minsyms.c (prim_record_minimal_symbol_and_info): . . . to here.
	* minsyms.c (prim_record_minimal_symbol): Call
	prim_record_minimal_symbol_and_info rather than duplicating code.
1993-12-27 16:31:56 +00:00
Jeff Law e7386e3225 Add comment about breakpoint vector usage. 1993-12-27 04:52:47 +00:00
Jeff Law e89d48dd88 * stabs.texinfo: Add notes about stabs-in-som where appropriate. 1993-12-27 04:47:59 +00:00
Jeff Law 2f8c3639fa * dbxread.c (process_one_symbol): Handle stabs-in-som just like
stabs-in-elf.
        (pastab_build_psymtabs): Likewise.

        * hppa-tdep.c: Change all comments to reference %r3 or frame pointer
        rather than %r4.
        (frame_chain, skip_prologue, dig_rp_from_stack): Handle %r3 as the
        frame pointer.

        * config/pa/tm-hppa.h (FP_REGNUM): Define as %r3.
        (FIND_FRAME_SAVED_REGS): Handle %r3 as frame pointer.
        (CALL_DUMMY): Likewise.
1993-12-27 04:46:05 +00:00