Commit Graph

169 Commits

Author SHA1 Message Date
Gunther Nikl c1f1f943e1 Backport fixes for PR gas/3041 (bfd assembler):
[gas]
2010-09-09  Gunther Nikl  <gnikl@users.sourceforge.net>

	* gas/config/tc-m68k.c (tc_gen_reloc): Handle references to defined
	weak symbols first if generating an a.out object.

2009-10-013  Vincent Riviere  <vincent.riviere@freesbee.fr>

	PR gas/3041
	* config/tc-m68k.c (tc_gen_reloc): Fix addend for relocations
	located in data section an referencing a weak symbol.

2007-05-15  Vincent Riviere  <vincent.riviere@freesbee.fr>

	PR gas/3041
	* config/tc-m68k.c (relaxable_symbol): Make sure that the correct
	addend is stored for relocs against weak symbols.
	(md_apply_fix): So not loose track of addend for relocs against
	weak symbols.

2007-05-03  Vincent Riviere  <vincent.riviere@freesbee.fr>
	    Nick Clifton  <nickc@redhat.com>

	PR gas/3041
	* config/tc-m68k.c (relaxable_symbol): Do not relax weak symbols.
	(tc_gen_reloc): Adjust the addend of relocs against weak symbols.
	(md_apply_fix): Put zero values into the frags referencing weak
	symbols.

[bfd]
2007-05-03  Vincent Riviere  <vincent.riviere@freesbee.fr>
	    Nick Clifton  <nickc@redhat.com>

	PR gas/3041
	* aoutx.h (swap_std_reloc_out): Treat relocs against weak symbols
	in the same way as relocs against external symbols.


Weak fixes for the non-bfd assembler:

* gas/config/tc-m68k.h (S_IS_WEAK): Define for !BFD_ASSEMBLER.
* gas/config/tc-m68k.c (tc_aout_fix_to_chars): Check weak symbol state.
* gas/write.c (fixup_segment): Treat a weak symbol as undefined.
2014-11-17 20:24:28 +00:00
Gunther Nikl bc58512a28 The upper bits of some instruction data should be zero.
* gas/config/tc-m68k.c (m68k_ip): Sanitize opcode data.
2014-11-17 19:42:40 +00:00
Gunther Nikl c796c52d23 Fix assembler output of the non-bfd version when running on a 64bit host.
* gas/config/aout_gnu.h (BYTES_IN_WORD): New define.
  (struct exec_bytes): Use it.
  (EXEC_BYTES_SIZE): Likewise.
* gas/config/obj-aout.c (CROSS_COMPILE): Convert to a compile time constant
  of 0 or 1.
  (obj_header_append): Use "struct exec_bytes" when cross compiling.
  (obj_symbol_to_chars): Output symbol data with a local "struct nlist_bytes"
  utilizing BYTES_IN_WORD.
  (obj_crawl_symbol_chain): Ignore symbols without a valid name like BFD.
  (obj_emit_strings): Use BYTES_IN_WORD to output string table size when
  cross compiling.
  Suppress symbols without a valid name like BFD.
* gas/write.c (write_object_file): Replace "sizeof (string_byte_count)" with
  BYTES_IN_WORD.
2014-11-16 18:42:30 +00:00
Gunther Nikl 29a0d609c6 (parse_archive_units): Ignore memory type bits when examining hunk type.
(amiga_read_unit): Directly read hunk type into hunk_type variable.
(amiga_read_load): Likewise.
(amiga_handle_cdb_hunk): Ignore memory type bits when examining hunk type.
(amiga_handle_rest): Likewise.
2014-11-16 18:19:02 +00:00
Gunther Nikl 3710c56d3b (amiga_read_ar_hdr): Increase the allocated file name buffer in case the
found hunk name has to be modified.
Add an "unique" file name extension if the read hunk name does not have
an .o or .obj extension.
2014-11-16 17:21:24 +00:00
Jens Maus c774dae693 - moved the 2.14 branch from our main binutils trunk to our branches top-level dir.
Further development on our 2.14 series of GCC should be applied here instead.
2009-08-18 20:04:53 +00:00
Gunther Nikl 3d7cf01998 (amiga_perform_reloc): Catch baserelative relocations against code symbols.
(aout_perform_reloc): Likewise.
2009-03-07 19:28:21 +00:00
Gunther Nikl f089ef8a68 (MAX_NAME_SIZE): Set to 124.
(write_name): Limit name to MAX_NAME_SIZE when writing a loadfile.
2009-03-07 19:27:05 +00:00
Gunther Nikl 94d81690b0 Symbols on m68k-amigaos have underscores. 2009-01-14 16:57:05 +00:00
Gunther Nikl e431b46fb2 (amiga_write_section_contents): Use datatype of "reloc_counts" also for
"reloc_count". Better error message for a relocation against an omitted
section. Replace BFD_FAIL with "bfd_set_error/return FALSE" since linking
cannot succeed. Prevent a possible endless loop when writing relocations.
Fail link operation if not all relocations could be written.
2009-01-08 13:10:10 +00:00
Gunther Nikl 8aa59c7193 * ld/emulparams/amiga.sh (PAGE_SIZE, NONPAGED_TEXT_START_ADDR): Remove
unused values.
* ld/emulparams/amiga_bss.sh (PAGE_SIZE, NONPAGED_TEXT_START_ADDR): Likewise.
* ld/scripttempl/amiga.sc (___machtype): Move out of .text section and drop
ABSOLUTE.
(___text_size): Move out of .text section and replace ABSOLUTE with SIZEOF
to compute its value.
(___data_size): Move out of .data section and replace ABSOLUTE with SIZEOF
to compute its value.
(___bss_size): Move out of .bss section and replace ABSOLUTE with SIZEOF
to compute its value.
* ld/scripttempl/amiga_bss.sc (___machtype): Move out of .text section and
drop ABSOLUTE.
(___text_size): Move out of .text section and replace ABSOLUTE with SIZEOF
to compute its value.
(___data_size): Move out of .data section and replace ABSOLUTE with SIZEOF
on .data and .bss to compute its value.
(___bss_size): Move out of .data section and drop useless ABSOLUTE.
(__edata): Move to its expected place at the end of .data section.
(__bss_start): Move to its expected place at the start of .bss section.
2009-01-05 12:52:12 +00:00
Gunther Nikl b0b16e9038 * amigaos.c (parse_archive_units): Strip final \n from bfd_msg format string.
(amiga_read_load): Likewise.
(amiga_handle_rest): Likewise.
(amiga_write_object_contents): Likewise.
(amiga_write_section_contents): Likewise.
(amiga_write_symbols): Likewise.
(amiga_slurp_armap): Likewise.
* amigaoslink.c (amiga_perform_reloc): Likewise.
(aout_perform_reloc): Likewise.
(amiga_final_link): Likewise.
2009-01-05 12:48:24 +00:00
Gunther Nikl f7a41d0cc6 (MY_bfd_link_add_symbols): Don't define in terms of MY. 2008-12-24 10:22:55 +00:00
Gunther Nikl 5391bb7612 (howto_table[H_PC26]): Lower two bits in mask values are not set. 2008-12-23 16:58:37 +00:00
Gunther Nikl f571c97eaa (determine_size): Remove macro.
(amiga_write_section_contents): Directly use reloc type as switch value.
2008-12-23 16:54:30 +00:00
Gunther Nikl 046f38d206 (amiga_handle_cdb_hunk): Only use non-empty HUNK_NAME content. 2008-12-23 16:53:36 +00:00
Gunther Nikl a4ccb0ea31 (amiga_handle_rest): Factor out common code. Rearrange switch. 2008-12-23 16:52:27 +00:00
Gunther Nikl c769148c66 (generic_link_check_archive_element): Use flavour from info->hash->creator
to really catch an amiga link when computing maximal symbol alignment.
(_bfd_generic_link_add_one_symbol): Likewise. Add the same kludge to case
'BIG' as used for case 'COM'.
2008-12-23 16:51:39 +00:00
Gunther Nikl cfc38a6ae0 * bfd/libamiga.h (comments): Improve comments.
* bfd/linker.c (generic_link_check_archive_element): Likewise.
(_bfd_generic_link_add_one_symbol): Likewise.
2008-12-23 16:50:39 +00:00
Gunther Nikl aeb7e01420 (fixup_segment): Move baserel adjustment for non-BFD _before_ md_apply_fix3.
Do not modify add_number for relocations against undefined symbols.
2008-12-23 16:49:46 +00:00
Gunther Nikl cd50ea2f0a (MY_bfd_link_add_symbols): Define to override generic a.out function.
(link_add_symbols): New wrapper function to handle symbols the same way
as the amiga backend by using a generic linker function when doing a
final link. This makes --wrap option of ld work.
2008-12-23 16:48:47 +00:00
Gunther Nikl 31f7d6e4ba * bfd/aoutx.h (swap_std_reloc_out): Use bfd_asymbol_flavour.
* ld/emultempl/amiga.em (amiga_assign_attribute): Use bfd_get_flavour.
* ld/ldctor.c (ldctor_build_sets): Likewise.
2008-12-23 16:23:14 +00:00
Gunther Nikl 895c223cb3 (my_add_to): Replace boolean argument with a flags mask. Read addends as
requested in that mask either signed or unsigned.
(amiga_perform_reloc): Test final relocation always signed. Request reading
the addend of baserel relocations as unsigned value. Note that this is not
always correct but should only be done for symbols that came from the same
unit as the relocation.
(aout_perform_reloc): Likewise.
2008-12-23 16:09:09 +00:00
Gunther Nikl cdc68c3310 (my_add_to): Replace offset and size arguments with an arelent argument.
Change p from "signed char" to "bfd_byte" to avoid warnings. Always read
addends as a signed value (this is not always correct and will be fixed
with a later change).
(amiga_perform_reloc): Adapt arguments to new world order.
(aout_perform_reloc): Likewise.
2008-12-23 16:04:08 +00:00
Gunther Nikl 5de376a191 (amiga_perform_reloc): Use size from r->howto.
(aout_perform_reloc): Likewise.
2008-12-23 16:02:43 +00:00
Gunther Nikl f741547ded (my_set_to): Remove dead function.
(aout_perform_reloc): Do not adjust relocation with r->address, but use the
value the assembler left at *r->address. This fixes the relocation values
for mc68020+ instructions with an extension word and obsoletes the kludge
for 8bit pcrel relocations.
2008-12-23 16:01:55 +00:00
Gunther Nikl 73d923df29 (amiga_perform_reloc): Use a single debug statement to print reloc type.
Reduce differences to aout_perform_reloc (more verbose return debug).
(aout_perform_reloc): Use a single debug statement to print reloc type.
Reduce differences to amiga_perform_reloc (enhanced/added comments).
2008-12-23 15:58:48 +00:00
Gunther Nikl 98df952a7e (amiga_perform_reloc): Use reloc size from arelent.
(aout_perform_reloc): Likewise.
2008-12-23 15:57:42 +00:00
Gunther Nikl 7e9eeafb9b * libamiga.h (amiga_reloc_type): Remove target_hunk.
* amigaos.c (amiga_add_reloc): Do not cache target_hunk.
(amiga_get_reloc_upper_bound): Remove format check since this is already
done in bfd_get_reloc_upper_bound before going into the bfd.
2008-12-07 18:54:51 +00:00
Gunther Nikl 1a66b4b1bf * libamiga.h (amiga_reloc_type): Switch from amiga_symbol to generic asymbol.
* amigaos.c (amiga_add_reloc): Use bfd_alloc. Reorder reloc initialization
slightly. Remove symbol casts.
2008-12-07 18:53:39 +00:00
Gunther Nikl c726353e0d * libamiga.h (amiga_symbol_type): Remove hunk_number.
* amigaos.c (amiga_get_section_by_hunk_number): Remove test for negative
hunk_numbers.
(amiga_slurp_symbol_table): Do not cache hunk_number.
2008-12-07 18:51:57 +00:00
Gunther Nikl 5efbce0a00 * libamiga.h (amiga_symbol_type): Add new member.
* amigaos.c (amiga_slurp_symbol_table): Remember reference count for
HUNK_EXT entries when applicable.
(amiga_print_symbol): Replace a.out style information with more relevant
amiga specific data.
2008-12-07 18:50:15 +00:00
Gunther Nikl f9d73f7bf9 (amiga_slurp_symbol_table): Use bfd_zalloc to allocate symbol space.
(amiga_get_symtab): Terminate symbol list with NULL.
2008-12-07 18:49:02 +00:00
Gunther Nikl 2f857ac23a (amiga_write_object_contents): Use bfd_get_symcount.
(amiga_write_symbols): Likewise.
(amiga_slurp_symbol_table): Likewise.
(amiga_get_symtab_upper_bound): Likewise.
(amiga_get_symtab): Likewise.
2008-12-07 18:47:58 +00:00
Gunther Nikl 598ece60e9 (aout_amiga_final_link): Declare.
(get_relocated_section_contents): Use bfd_get_flavour.
(amiga_perform_reloc): Likewise.
(amiga_final_link): Likewise.
2008-12-07 18:46:58 +00:00
Gunther Nikl 6e32e92ebf (get_relocated_section_contents): Merge changes of generic function between
2.9.1 and 2.14.
(amiga_final_link): Likewise.
(amiga_reloc_link_order): Likewise.
2008-12-07 18:45:56 +00:00
Gunther Nikl 18829e7a7a * (md_apply_fix3): Remove broken OBJ_AMIGAHUNK specific code.
* (md_pcrel_from): Only use adjust when generating a hunk object.

This reverts r184. Afterall the old code was correct...
2008-12-07 18:44:12 +00:00
Gunther Nikl 96fb56c052 (amiga_ardata_type): Add new member.
(amiga_read_ar_hdr): Strip path part from read hunk name. If object file does
not have a valid hunk name, fake an unique object name to match expectations
of eg. the GCC build machinery about extracted object names from a link lib.
2008-11-25 20:53:47 +00:00
Gunther Nikl 13c70d6ec5 (amiga_ardata): Cast through void to appease GCC4.
(amiga_add_reloc): Likewise.
2008-11-25 20:50:40 +00:00
Gunther Nikl 048908e339 (amiga_archive_p): Enhance link library detection by checking the filename. 2008-11-25 20:49:37 +00:00
Gunther Nikl acade3748e (MAX_NAME_SIZE): Change its value to zero which enables unlimited length of
symbol names in write_name.
(write_name): Fix 64bit bug. The old code used a structure with an embedded
long and assumed its size as 4 bytes. The new code writes all data with
single writes. Now the AmigaOS backend should really be 64bit clean.
The length of a symbol name is no longer restricted to MAX_NAME_SIZE
characters. The old behaviour can be re-enabled by setting it to a non-zero
value which will then be used as length limit.
2008-11-25 20:48:34 +00:00
Gunther Nikl 47416d6915 (write_name): Make a parameter unsigned to get rid of a GCC warning.
(amiga_write_section_contents): Likewise.
2008-11-25 20:46:57 +00:00
Gunther Nikl 24c5353b1a (aout_perform_reloc): Resolve undefined weak symbols against the absolute
section.
2008-11-25 20:45:59 +00:00
Gunther Nikl 36ab9c5495 (amiga_write_symbols): Implement a long requested FIXME: only write a single
HUNK_EXT entry for all references to a specific symbol to reduce the size of
the created object.
2008-11-25 20:44:32 +00:00
Gunther Nikl 94f06162bc (amiga_write_object_contents): Remove unnecessary cast. Use better size
calculation when writing padding.
(amiga_write_symbols): Simplify type expression. Tweak formatting.
2008-11-25 20:41:46 +00:00
Gunther Nikl ed264daf4f (determine_datadata_relocs): Fix comment.
(amiga_write_section_contents): Likewise.
(amiga_write_symbols): Likewise.
2008-11-25 20:40:30 +00:00
Gunther Nikl 22ac4a8137 * amigaos.c (bfd_is_bfd_section): New macro.
(determine_datadata_relocs): Use section_ptr macros.
(amiga_write_object_contents): Likewise.
(amiga_write_symbols): Likewise.
(amiga_get_symbol_info): Likewise.
* amigaoslink.c (amiga_perform_reloc): Use section_ptr macros.
(aout_perform_reloc): Likewise.
2008-11-25 20:39:10 +00:00
Gunther Nikl cb64fb89dd (amiga_perform_reloc): Always use cached value of sym->section.
(aout_perform_reloc): Likewise.
2008-11-25 20:37:30 +00:00
Gunther Nikl bc70a333d4 (amiga_handle_rest): Tolerate a missing HUNK_END. Apparently the AmigaDOS
loader accepts such files which are created by broken crunchers.
2008-11-25 20:36:29 +00:00
Gunther Nikl 39fd9226dd (amiga_write_archive_contents): Fix extracting of link library members.
(amiga_archive_p): Do not preset a BFD error condition because it might be
clobbered by later code. Order initialization of amiga_ardata.
(amiga_generic_stat_arch_elt): Use more sane 0644 as st_mode. Use the more
correct 1.1.1978 as st_mtime. Set st_size using arelt_size.
2008-11-25 20:35:22 +00:00