Commit Graph

90 Commits

Author SHA1 Message Date
Jeff Law c3a1888801 * som.c (som_write_fixups): Use SEC_HAS_CONTENTS to identify
bss-like sections.
	(som_get_section_contents): Likewise.
	(som_set_section_contents): Likewise.
1994-12-29 03:56:20 +00:00
Jeff Law 5faa346b63 * som.c (setup_sections): Turn off SEC_HAS_CONTENTS for bss-like
sections.
1994-12-27 21:05:10 +00:00
Jeff Law 8a2cdc6278 * som.h (som_symbol_type): Add "stringtab_offset" field.
* som.c (som_write_symbol_strings): Use "stringtab_offset"
	rather than destroying the "name" field in the BFD symbol.
	(som_build_and_write_symbol_table): Likewise.
1994-09-14 21:44:35 +00:00
Jeff Law ae880afc1b * som.c (som_fixup_formats): Case R_ENTRY (0xb3), set both
'T' and 'U' to grab all the unwind information.
	(som_set_reloc_info): Make 'U' unwind bits persist across
	multiple SOM relocations.  Set the addend field of an R_ENTRY
	relocation to the value in 'T'; set the addend field on an
	R_EXIT relocation to the value in 'U'.
1994-09-14 03:03:15 +00:00
Jeff Law e10639db44 * som.h (som_symbol_type): Delete unwind field.
* som.c (som_write_fixups): For R_ENTRY fixups, get 32bits of
	unwind information from the addend field of the R_ENTRY, get the
	other 32bits from the addend field of the R_EXIT.
	(bfd_som_attach_unwind_info): Delete function and all references.
1994-09-14 02:28:52 +00:00
Jeff Law 39836432f8 * som.h (som_symbol_type): Delete unused a.out-related fields.
* som.c (bfd_section_from_som_symbol): Use bfd_abs_section_ptr
	instead of &bfd_abs_section.
1994-09-14 00:51:33 +00:00
Jeff Law a0b4aa6265 * som.c (som_object_setup): Handle exec_entry and exec_flags being
switched in executables created by the OSF1 linker.
	(som_write_fixups): Handle R_EXIT just like the R_{F,L,R}SEL
	fixups.  Support R_ALT_ENTRY (handle just like R_EXIT).
1994-09-14 00:29:11 +00:00
Jeff Law c7ca67cb67 * som.c (som_reloc_skip): Correct off-by-one error for 4-byte
R_NO_RELOCATION fixups.
	(bfd_section_from_som_symbol): Return the absolute section if the
	symbol isn't contained in any section in the output file.
	(som_slurp_symbol_table): ST_PRI_PROG and ST_SEC_PROG symbols are
	not function symbols (they are magic code labels which *can* be the
	targets of cross space branches).  $START$ is not a section symbol.
1994-09-13 04:06:07 +00:00
Jeff Law 29f1ccee6d Revert last change (never should have been checked in to begin with). 1994-09-12 04:06:07 +00:00
Jeff Law 95bc714ee8 * config/hppaosf.mh (RANLIB): Do not set.
* config/hppabsd.mh (RANLIB): Likewise.
1994-09-12 04:04:09 +00:00
Jeff Law b905bde1a9 * som.c (som_write_fixups, case R_ENTRY): Handle case where no
unwind descriptor information is available.
1994-08-31 03:30:39 +00:00
Jeff Law fde543b5ff * som.c (som_prep_headers): If writing some form of an executable,
allocate and attach an exec header to the BFD private data.
	(som_begin_writing): Don't fill fields of the exec header based
	on BFD private data here (like the exec flags).  Do not write
	the exec header here.
	(som_write_headers): Instead do it here.
	* som.h (struct somdata): New field "exec_hdr" for the executable
	file header.
	(obj_som_exec_hdr): New accessor macro.
1994-08-16 23:11:59 +00:00
Ian Lance Taylor 2f3508ad05 * Many files: change all bfd_target vectors to be const. Change
all uses of bfd_target * to be const bfd_target *.  Change
	bfd_target_vector and bfd_default_vector arrays to be const
	bfd_target * const *.
1994-06-20 21:55:45 +00:00
Jeff Law 8117e1ea9a * som.c (EXEC_AUX_ID): Define based on availablity of HPUX_AUX_ID
or HIUX_AUX_ID.
	(som_begin_writing): Use EXEC_AUX_ID instead of HPUX_AUX_ID.
	(som_write_armap): Use CPU_PA_RISC1_0 as the magic number.  Note
	som.c is careful to always define CPU_PA_RISC1_0.
1994-06-13 02:31:43 +00:00
Jeff Law ada45a2a82 * som.c (som_prep_headers): Do not set the system_id here, private
bfd data has not been copied yet.
	(som_write_headers): Instead do it here.
1994-05-26 16:13:47 +00:00
Jeff Law 88bbe402bb * som.c (som_set_reloc_info): Do not set any relocation info
for SOM fixups which are never passed to BFD.
1994-05-20 19:43:18 +00:00
Ian Lance Taylor 82492ca110 * som.c: Don't include <sys/dir.h> or <sys/user.h>.
(som_reloc_queue_find): Call memcmp instead of bcmp.
	(som_bfd_reloc_type_lookup): Change first argument to bfd *.
	(compare_syms): Change types of arguments to const void *.
	(bfd_section_from_som_symbol): Removed unused local found.
	(som_write_armap): Add elength, map, orl_count and int arguments.
	(som_write_armap): Use %ld and cast to long for getuid result.
1994-05-18 15:32:15 +00:00
Jeff Law 673acecaa5 * elf32-hppa.h (R_HPPA_ABS_CALL): Define.
* elf32-hppa.c (hppa_elf_gen_reloc_type): Handle absolute calls.

	* som.h (R_HPPA_ABS_CALL): Define.
	* som.c (hppa_som_gen_reloc_type): Delete complex relocation types.
1994-05-18 15:13:27 +00:00
Jeff Law 41194a4a59 * som.c (som_write_fixups): Always emit at least
one relocation for any non-bss section.
1994-04-12 20:37:33 +00:00
Ian Lance Taylor dfc1c00613 * All backends: Added BFD_JUMP_TABLE_DYNAMIC to target vector. 1994-04-07 01:58:27 +00:00
Ian Lance Taylor 6812b6077e * targets.c (bfd_target): Rearranged fields in target vector.
Removed _bfd_debug_info_start, _bfd_debug_info_end and
	_bfd_debug_info_accumulate, which were never used.
	(BFD_JUMP_TABLE_GENERIC, BFD_JUMP_TABLE_COPY): Defined.
	(BFD_JUMP_TABLE_CORE, BFD_JUMP_TABLE_ARCHIVE): Defined.
	(BFD_JUMP_TABLE_SYMBOLS, BFD_JUMP_TABLE_RELOCS): Defined.
	(BFD_JUMP_TABLE_WRITE, BFD_JUMP_TABLE_LINK): Defined.
	* All backends: Changed to use the new BFD_JUMP_TABLE_* macros
	rather than the single JUMP_TABLE macro.  Removed many of the
	weird macro definitions needed to support the monolithic
	JUMP_TABLE.
	* bfd-in.h (JUMP_TABLE): Removed.
	* libbfd-in.h: Define a bunch of macros, and declare a few
	functions, for use with the new BFD_JUMP_TABLE_* macros.
	* libbfd.c (_bfd_dummy_new_section_hook): Removed.
	(bfd_false): Set bfd_error_invalid_operation.
	(bfd_nullvoidptr): Likewise.
	(bfd_n1): New function.
	(_bfd_nocore_core_file_matches_executable_p): Renamed from
	_bfd_dummy_core_file_matches_executable_p.
	(_bfd_nocore_core_file_failing_command): Similar rename.  Set
	bfd_error_invalid_operation.
	(_bfd_nocore_core_file_failing_signal): Likewise.
	(_bfd_generic_get_section_contents): Renamed from
	bfd_generic_get_section_contents.  Changed all callers.
	(_bfd_generic_set_section_contents): Similar rename.
	* ieee.c: #if 0 out ieee_bfd_debug_info_start,
	ieee_bfd_debug_info_end, ieee_bfd_debug_info_accumulate.  They
	were never called.
	* bfd-in2.h: Rebuilt.
	* libbfd.h: Rebuilt.
1994-04-06 22:00:40 +00:00
Jeff Law 65b1ef4963 * Crude support for examining dynamic libraries.
* som.c (som_object_setup): Set DYNAMIC flag for SHL_MAGIC and
        DL_MAGIC objects.
        (som_prep_headers): Preserve the system_id for DYNAMIC objects.
        Use SHL_MAGIC as the magic number of the DYNAMIC flag is set.
        Write exec headers for DYNAMIC objects.
        (som_begin_writing): DYNAMIC objects have the same alignment
        restrictions as D_PAGED objects.
        (bfd_section_from_som_symbol): Treat DYNAMIC objects like EXEC_P
        objects.
        (object_flags): Add DYNAMIC.
1994-04-06 05:11:31 +00:00
Jeff Law b2452d3918 * som.c (som_bfd_free_cached_info): Add missing PARAMS decl.
Don't free anything if we don't have a bfd_object.
        (som_close_and_cleanup): Call som_bfd_free_cached_info.
1994-04-05 22:50:42 +00:00
Ian Lance Taylor b3cee0a981 * aoutx.h (NAME(aout,canonicalize_reloc)): Don't error out if
section->relocation is NULL; malloc might have returned NULL when
	given a zero size if there were no relocations.
	* bout.c (b_out_canonicalize_reloc): Likewise.
	* coffcode.h (coff_canonicalize_reloc): Likewise.
	* ecoff.c (ecoff_canonicalize_reloc): Likewise.
	* elfcode.h (elf_canonicalize_reloc): Likewise.
	* mipsbsd.c (MY(canonicalize_reloc)): Likewise.
	* i386lynx.c (NAME(lynx,canonicalize_reloc)): Likewise.
	* nlmcode.h (nlm_canonicalize_reloc): Likewise.
	* som.c (som_canonicalize_reloc): Likewise.
	* hp300hpux.c (MY(slurp_reloc_table)): Likewise.  Also, if malloc
	returns NULL, don't report an error if we asked for zero bytes.
	* i386lynx.c (NAME(lynx,slurp_reloc_table)): If malloc returns
	NULL, don't report an error if we asked for zero bytes.
	* nlmcode.h (nlm_slurp_reloc_fixups): Likewise.
1994-04-05 15:32:49 +00:00
Jeff Law 1f46bba327 * som.c (som_slurp_string_table): Use malloc to allocate space
for the cached copy of the native string table.
        (som_slurp_symbol_table): Likewise for the native symbol table.
        (som_slurp_reloc_table): Likewise for the native and generic
        relocation tables.
        (som_bfd_free_cached_info): Free the cached native strings,
        symbols, and relocations.  Also free the canonical cached relocations.
1994-04-04 01:28:51 +00:00
Ian Lance Taylor 9deaaaf1b3 * targets.c (bfd_target): Add _bfd_free_cached_info field.
* bfd.c (bfd_free_cached_info): Define.
	* bfd-in.h (JUMP_TABLE): Add _bfd_free_cached_info.
	* bfd-in2.h: Rebuilt.
	* All backends: Initialize bfd_free_cached_info entry point to
	bfd_true.
1994-04-01 17:55:47 +00:00
Jeff Law 06e6eb0e53 * som.c (som_begin_writing): New approach at dealing with holes
in executables left by the HP linker.  Does not rely on subspace
        alignments as subspaces are *NOT* guaranteed to be properly
        aligned in an executable (can you believe that!).
1994-03-31 06:50:42 +00:00
Ian Lance Taylor 326e32d7ce Wed Mar 30 16:25:41 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
Changes to let BFD return an error indication from
	get_symtab_upper_bound, bfd_canonicalize_symtab,
	bfd_get_reloc_upper_bound, and bfd_canonicalize_reloc.  They now
	return long instead of unsigned int, and use -1 to indicate an
	error.  Along the way, rename get_symtab_upper_bound to
	bfd_get_symtab_upper_bound.
	* bfd.c (bfd_get_reloc_upper_bound): Return long, and -1 on
	errors.
	(bfd_canonicalize_reloc): Likewise.
	* syms.c (bfd_get_symtab_upper_bound): Renamed from
	get_symtab_upper_bound.
	* targets.c (bfd_target): Renamed _get_symtab_upper_bound to
	_bfd_get_symtab_upper_bound, and changed it and
	_bfd_canonicalize_symtab and _get_reloc_upper_bound and
	_bfd_canonicalize_reloc to all return long.
	* aoutx.h (NAME(aout,get_symtab)): Return long, and -1 on errors.
	(NAME(aout,canonicalize_reloc)): Likewise.
	(NAME(aout,get_reloc_upper_bound)): Likewise.
	(NAME(aout,get_symtab_upper_bound)): Likewise.
	* bout.c (b_out_canonicalize_reloc): Likewise.
	(b_out_get_reloc_upper_bound): Likewise.
	* coffcode.h (coff_canonicalize_reloc): Likewise.
	* coffgen.c (coff_get_symtab_upper_bound): Likewise.
	(coff_get_symtab): Likewise.
	(coff_get_reloc_upper_bound): Likewise.
	* ecoff.c (ecoff_get_symtab_upper_bound): Likewise.
	(ecoff_get_symtab): Likewise.
	(ecoff_canonicalize_reloc): Likewise.
	* elfcode.h (elf_get_symtab_upper_bound): Likewise.
	(elf_get_reloc_upper_bound): Likewise.
	(elf_canonicalize_reloc): Likewise.
	(elf_get_symtab): Likewise.
	* hp300hpux.c (MY(get_symtab)): Likewise.
	(MY(get_symtab_upper_bound)): Likewise.
	(MY(canonicalize_reloc)): Likewise.
	* i386lynx.c (NAME(lynx,canonicalize_reloc)): Likewise.
	* ieee.c (ieee_slurp_external_symbols): Change return type to
	boolean.  Check for errors from get_symbol.
	(ieee_slurp_symbol_table): Change return type to boolean.  Check
	for errors from ieee_slurp_external_symbols.
	(ieee_get_symtab_upper_bound): Return long, and -1 on errors.
	(ieee_get_symtab): Likewise.
	(ieee_get_reloc_upper_bound): Likewise.
	(ieee_canonicalize_reloc): Likewise.
	* mipsbsd.c (MY(canonicalize_reloc)): Likewise.
	* nlmcode.h (nlm_get_symtab_upper_bound): Likewise.
	(nlm_get_symtab): Likewise.
	(nlm_get_reloc_upper_bound): Likewise.
	(nlm_canonicalize_reloc): Likewise.
	* oasys.c (oasys_get_symtab_upper_bound): Likewise.
	(oasys_get_symtab): Likewise.
	(oasys_get_reloc_upper_bound): Likewise.
	(oasys_canonicalize_reloc): Likewise.
	* som.c (som_get_symtab_upper_bound): Likewise.
	(som_get_symtab): Likewise.
	(som_get_reloc_upper_bound): Likewise.
	(som_canonicalize_reloc): Likewise.
	* srec.c (srec_get_symtab_upper_bound): Likewise.
	(srec_get_symtab): Likewise.
	(srec_get_reloc_upper_bound): Define as bfd_0l.
	(srec_canonicalize_reloc): Likewise.
	* tekhex.c (tekhex_get_symtab): Return long, and -1 on errors.
	(tekhex_get_symtab_upper_bound): Likewise.
	(tekhex_get_reloc_upper_bound): Define as bfd_0l.
	(tekhex_canonicalize_reloc): Likewise.
	* libaout.h (NAME(aout,get_symtab_upper_bound)): Change
	declaration to return long.
	(NAME(aout,get_symtab)): Likewise.
	(NAME(aout,canonicalize_reloc)): Likewise.
	(NAME(aout,get_reloc_upper_bound)): Likewise.
	* libcoff-in.h (coff_get_symtab_upper_bound): Likewise.
	(coff_get_symtab): Likewise.
	(coff_get_reloc_upper_bound): Likewise.
	* libecoff.h (ecoff_get_symtab_upper_bound): Likewise.
	(ecoff_get_symtab): Likewise.
	(ecoff_canonicalize_reloc): Likewise.
	* libelf.h (bfd_elf32_get_symtab_upper_bound): Likewise.
	(bfd_elf32_get_symtab): Likewise.
	(bfd_elf32_get_reloc_upper_bound): Likewise.
	(bfd_elf32_canonicalize_reloc): Likewise.
	(bfd_elf64_get_symtab_upper_bound): Likewise.
	(bfd_elf64_get_symtab): Likewise.
	(bfd_elf64_get_reloc_upper_bound): Likewise.
	(bfd_elf64_canonicalize_reloc): Likewise.
	* libnlm.h (nlmNAME(get_symtab_upper_bound)): Likewise.
	(nlmNAME(get_symtab)): Likewise.
	(nlmNAME(get_reloc_upper_bound)): Likewise.
	(nlmNAME(canonicalize_reloc)): Likewise.
	* archive.c (compute_and_write_armap): Use error_return and
	no_memory_return labels rather than freeing information in various
	places.  Change storage, symcount and src_count to long.  Check
	errors from bfd_get_symtab_upper_bound and
	bfd_canonicalize_symtab.
	* bout.c (b_out_relax_section): Change reloc_size to long.  Check
	for errors from bfd_get_reloc_upper_bound and
	bfd_canonicalize_reloc.
	(b_out_get_relocated_section_contents): Likewise.
	* coff-alpha.c (alpha_ecoff_get_relocated_section_contents):
	Likewise.
	* elf32-mips.c: Likewise.
	* elf32-hppa.c (hppa_elf_stub_finish): Likewise.
	(hppa_look_for_stubs_in_section): Check for errors from
	bfd_get_symtab_upper_bound, bfd_canonicalize_symtab, and
	bfd_canonicalize_reloc.
	* ecofflink.c (bfd_ecoff_debug_accumulate_other): Check for errors
	from bfd_get_symtab_upper_bound and bfd_canonicalize_symtab.
	* linker.c (generic_link_read_symbols): Likewise.
	(_bfd_generic_final_link): Check for errors from
	bfd_get_reloc_upper_bound and bfd_canonicalize_reloc.
	* reloc.c (bfd_generic_get_relocated_section_contents): Likewise.
	* reloc16.c (bfd_coff_reloc16_relax_section): Likewise.
	(bfd_coff_reloc16_get_relocated_section_contents): Likewise.
	* libbfd.c (bfd_0l): New function.
	* libbfd-in.h (bfd_0l): Declare.
	* aix386-core.c: Change get_symtab_upper_bound, get_symtab,
	get_reloc_upper_bound, and canonicalize_reloc to use bfd_0l rather
	than bfd_0u.
	* cisco-core.c, hppabsd-core.c, hpux-core.c: Likewise.
	* irix-core.c, osf-core.c, ptrace-core.c, trad-core.c: Likewise.
	* bfd-in2.h: Rebuilt.
	* libbfd.h: Rebuilt.
	* libcoff.h: Rebuilt.

	* nlm32-sparc.c (nlm_sparc_read_reloc): Remove unused variables
	temp and name.
1994-03-30 22:15:07 +00:00
Jeff Law f977e865cb * som.c (som_get_section_contents): New function. Do not try
to actually read data from a section that doesn't have either
        SEC_LOAD or SEC_DEBUGGING set (eg $BSS$) just return true.
1994-03-26 20:25:48 +00:00
Jeff Law 250578363e * libbfd.c (bfd_read): Set bfd_error as appropriate for a short
read. (bfd_error_system_call or bfd_error_file_truncated).

        * som.c: Do not blindly set bfd_error_system_call after a
        failing bfd_read, bfd_write, or bfd_seek.  In a few places
        (like som_object_p) override the error status set by bfd_read.

        * aix386-core.c, aout-encap,c archive.c, bout.c: Likewise.
        * coff-rs6000.c, coffgen.c ecoff.c, elf.c: Likewise.
        * elf32-hppa.c, elfcode.h, hp300hpux.c, i386lynx.c: Likewise.
        * nlm32-alpha.c, nlm32-i386.c, nlm32-sparc.c: Likewise.

        * som.c: Check return values from several bfd_{seek,read,write}
        calls that we just assumed were not failing.
1994-03-26 18:28:29 +00:00
Jeff Law 9d7f682f8c * som.c (som_bfd_prep_for_ar_write): Ignore non-SOM objects.
(som_bfd_ar_write_symbol_stuff, som_write_armap): Likewise.
1994-03-24 17:21:50 +00:00
Jeff Law c2e1207b3a * som.c (bfd_section_from_som_symbol): Only to do the value
comparison for function symbols within executables.
1994-03-21 02:08:37 +00:00
Jeff Law c05d2d43a0 * som.c (bfd_section_from_som_symbol): Renamed from
som_section_from_subspace_index.  Pass in a native SOM symbol.
        For executables, iterate through the sections to find out
        which contains the symbol's address rather than using the
        symbol_info field.  (symbol_info has a different meaning for
        dynamicly linked executables.)
1994-03-20 23:27:37 +00:00
Jeff Law 517a6af632 * som.c (som_begin_writing): Fix braino (one call to align
space/subspace data was done unconditionally rather than
        just for executables.)
1994-03-20 19:22:04 +00:00
Jeff Law 142f59f4a9 * som.c (som_begin_writing): Align text in all executables to
make HPUX kernel happy.  Fixes strip/objcopy for shared
        executables.
1994-03-20 17:27:51 +00:00
Jeff Law 00806436cd * som.c (som_begin_writing): Account for alignment needs of
subspaces too when writing executables.  Never request a negative
        bss size.  Fixes some problems with demand paged executables,
        still having problems with pure executables and shared executables.
1994-03-19 15:08:12 +00:00
Jeff Law 1576691751 * som.h (som_copyable_section_data_struct): New structure
containing all the private section information which needs
	to be copied from input section to output section during
	objcopy or strip.
	(som_section_data_struct): Remove several fields now in
	som_copyable_section_data_struct.  Make the space and
	subspace dictionaries be pointers (to save space when
	only reading objects).

	* som.c (bfd_som_set_section_attributes): Now returns a boolean;
	some references changed.  Allocate a copyable data stucture if
	none exists.  Store info into the copyable data structure.
	(bfd_som_set_subsection_attributes): Likewise.
	(som_is_space, som_is_subspace, som_is_container): New functions.
	Use these instead of directly accessing private data.
	(som_prep_headers): Allocate space and subspace headers here.
	Fill in some fields in the space/subspace headers from the
	copyable data.
	(som_bfd_copy_private_section_data): Only copy the stuff
	that we really need to make objcopy and strip work.  Allocate
	the copy_data structure for the output bfd before copying.
1994-03-19 06:41:54 +00:00
Jeff Law 4359a7ef33 * som.h (struct som_exec_data): New structure to hold exec
info that must be preserved when running objcopy/strip.
	(struct somdata): Add new "exec_data" field and accessor
	macro.  Add some comments on how the various fields are used.
	(som_section_data_struct): Make is_space and is_subspace bitfields.
	Delete unused subspace_index.  All references now use the
	target_index field within the section structure itself.

	* som.c (make_unique_section): Delete unused declaration.
	(som_bfd_copy_private_bfd_data): New function.
	(som_object_setup): Allocate space for and save exec information
	that needs to be copied during objcopy/strip.
	(som_mkobject): Do not allocate space for a file header here.
	It is not used when only reading SOM objects.
	(som_prep_headers): Allocate space for and attach a file header
	to the output bfd.  For executables, use the saved system_id
	value rather than trying to guess the right value.  Do not abort
	wwhen setting file_hdr->entry* for executables.
	(som_begin_writing): For executables, set the exec_entry and
	exec_flags fields.
	(som_copy_private_backend_section_data): Always return a value.
1994-03-19 05:06:54 +00:00
Jeff Law 08b3c4f997 * libhppa.h (PA_PAGESIZE): Define.
* som.c (SOM_ALIGN): Define.
        (som_begin_writing): If writing an executable, initialize all
        fields in the exec header to zero.  Update fields in the exec
        header as sizes of loadable subspaces are computed.  Carefully
        preserve alignments when building executables.  Actually write the
        exec after all the fields are filled in.
1994-03-19 03:54:49 +00:00
Jeff Law 3b4994959e * Better long-filename handling. Reads SOM ABI compliant extended
names, but doesn't quite write compliant extended names yet.
        * som.c (som_slurp_extended_name_table): Delete function.  The
        generic code will handle things correctly.
        (som_slurp_armap): Seek to the beginning of the next member.
        (normalize): New function.
        (som_bfd_ar_write_symbol_stuff): Take the size of the extended
        name table into account when computing the file offsets in the
        SOM dictionary.  Make sure to align to an even boundary.
        (som_write_armap): Initialize the checksum to zero.
        (ar_maxchars): Fix.  Opps.
1994-03-19 02:17:15 +00:00
Jim Kingdon 8eb5d4be69 * aoutx.h, elfcode.h, coff-alpha.c, bout.c, ecoff.c, ecofflink.c,
elf32-hppa.c, elf32-mips.c, linker.c, som.c, sunos.c: If malloc(0)
	returns NULL, it is not an error.  It's possible that some of
	these checks are not necessary (because the size can never be
	zero), but putting in the checks is the conservative thing to do
	in light of the fact that some of these malloc calls replaced
	unchecked alloca calls, in which a zero argument would work fine.
1994-03-17 18:54:48 +00:00
Jeff Law 5b3577cb7a * bfd-in2.h, libbfd.h, libcoff.h: Rebuilt.
* bfd-in.h (JUMP_TABLE): Add new entries to the jump table
	for bfd_copy_private_section_data, bfd_copy_private_bfd_data,
	and bfd_is_local_label.

	* targets.c: Add new entries to the bfd_target structure.

	* bfd.c (bfd_copy_private_bfd_data): New definition.

	* section.c (bfd_copy_private_section_data): New definition.

	* syms.c (bfd_is_local_label): New definition.

	* libbfd-in.h (bfd_generic_is_local_label): Declare.

	* libbfd.c (bfd_generic_is_local_label): New function.

	* *-core.c: Provide default definitions for new functions in
	the target vector which all point to bfd_false.

	* aout-target.h, coffcode.h, elf32-target.h elf64-target.h, ieee.c
	libaout.h, libecoff.h, nlm-target.h, oasys.c, srec.c, tekhex.c
	Default new vectors for copying private backend data to bfd_true.
	Default new vector for determining if a symbol is a local label
	to bfd_generic_is_local_label.

	* som.c (som_bfd_copy_private_section_data): New function.
	(som_bfd_is_local_label): New function.
	(som_bfd_copy_private_bfd_data): For now default to bfd_true.

	* elf32-hppa.c (hppa_elf_is_local_label): New function.
1994-03-16 07:02:05 +00:00
Jeff Law baef2065d0 * som.c (som_prep_for_fixups): A relocation involving the section
symbol for the *ABS* section is really a relocation involving
        no symbol.
        (som_slurp_symbol_table): Do not set BSF_GLOBAL or BSF_EXPORT for
        undefined symbols.  Correctly distinguish between debugger symbols
        and section symbols.
1994-03-15 05:21:51 +00:00
Jeff Law b486fb13be * som (setup_sections): Set SEC_DEBUGGING and the section attributes
for spaces and subspaces.
1994-03-15 04:40:51 +00:00
Jeff Law 4c9db344d2 * som.c (som_bfd_count_ar_symbols): Fix typo. 1994-03-14 21:53:29 +00:00
Jeff Law ec743ceff2 * som.c (som_object_setup): Set EXEC_P, D_PAGED, WP_TEXT, and
HAS_RELOC based on the object's magic number.
        (make_unique_section): Delete function.  BFD and its users are
        prepared to handle multiple sections with the same name.
        (setup_sections): Allocate space on the BFD's obstack to hold
        section names.  Use bfd_make_setion_anyway rather than the
        obsolete make_unique_section.
        (som_prep_headers): Choose the correct SOM magic number based
        on the BFD's flags.
        (som_bfd_fill_in_ar_symbols): Return false, not NULL on error.
1994-03-14 19:43:01 +00:00
Jim Kingdon 80425e6c82 * libbfd-in.h: Remove alloca cruft. It was missing some necessary
cruft (like the #pragma alloca for AIX).
	In addition to that problem, the C alloca calls xmalloc, which
	means checking for being out of memory can't work right.  The
	following changes remove all uses of alloca from BFD.
	* hosts/solaris2.h: Remove alloca cruft.
	* som.c: Replace alloca with a fixed size auto array.
	* aoutx.h, elfcode.h, nlmcode.h, bout.c, coff-alpha.c, ecoff.c,
	ecofflink.c, elf32-hppa.c, elf32-mips.c, linker.c, reloc.c, som.c:
	Replace alloca with malloc and appropriate error checking and
	freeing.
	* linker.c: Replace alloca with obstack_alloc.
	* libbfd.h: Rebuilt.
1994-03-10 02:09:10 +00:00
Jeff Law 4e64845ca5 * som.[ch]: Do not include libhppa.h in som.c, instead include
it in som.h.

        * elf32-hppa.[ch]: Do not include libhppa.h in elf32-hppa.c, instead
        include it in elf32-hppa.h.
1994-03-02 23:04:29 +00:00
Jeff Law 98ecc94548 * som.c (log2): Return -1 on error rather than aborting.
(setup_sections): Bubble up an error from log2.
1994-03-02 20:32:10 +00:00
Jeff Law 44fd66228a * som.c (hppa_som_gen_reloc_type): Use correct enum type for
field parameter.
        (bfd_som_set_section_attributes): Use unsigned int rather than
        unsigned char to avoid GNU-C extensions.
        (bfd_som_attach_aux_hdr): Return a boolean to indicate success
        or failure rather than aborting on failure.

        * som.h (bfd_som_set_section_attributes): Fix prototype to match
        som.c changes.
        (bfd_som_attach_aux_hdr): Add prototype.
        (hppa_som-gen_reloc_type): Likewise.

        * elf32-hppa.c: Add a couple casts to make HP compiler happy.
        (hppa_look_for_stubs_in_section): Do not return false on failure
        until rest of code is ready to handle it.  Abort for now.
1994-03-02 19:59:03 +00:00