2
0
mirror of https://frontier.innolan.net/github/amigaos-binutils.git synced 2025-11-23 21:43:03 +00:00
Commit Graph

98 Commits

Author SHA1 Message Date
4e19233665 Add support for relocation hunks with short (16bit) data.
* bfd/amigaos.c (write_words): Add protototype.
  (write_words): New function to write 16bit words.
  (amiga_write_section_contents): Use write_words to write 16bit relocs.
2015-05-15 19:35:50 +00:00
0c09613c8f Fix RELRELOC32 reading and decoding. AmigaOS 3.x expects short data.
* bfd/amigaos.c (parse_archive_units): Add support for HUNK_RELOC32SHORT.
  Parse HUNK_RELRELOC32 the same way.
  (amiga_handle_rest): Check for HUNK_RELRELOC32 when reading short data.
  (read_raw_relocs): Likewise.
2015-05-15 19:22:06 +00:00
5df18f43a6 Merge normal RELOC32 and RELOC32SHORT howto selection.
* bfd/amigaos.c (R_ABS32SHORT): Remove.
  (howto_table): Remove H_ABS32SHORT entry.
  (howto_for_raw_reloc): Use R_ABS32 entry for HUNK_RELOC32SHORT.
2015-05-15 18:53:34 +00:00
179c404953 Change HOWTO enumeration.
* bfd/libamiga.h (H_PC32SHORT): New enum value.
  (H_PC26): Moved to end of enumeration.
2015-05-15 18:45:53 +00:00
39cb210148 Fix behaviour of a core bfd function generating sections.
For details check https://sourceware.org/ml/binutils/2003-07/msg00077.html
about the patch.

* bfd/section.c (bfd_make_section): Return NULL for existing section.
2015-05-05 19:01:47 +00:00
e2b5906c8a Accept additional hunk types containing raw relocation data at two places
missed before.

* bfd/amigaos.c (parse_archive_units): Handle HUNK_RELRELOC32, HUNK_ABSRELOC16
  and HUNK_RELRELOC26.
  (amiga_handle_rest): Likewise.
2015-04-29 19:07:20 +00:00
ddc877b3d3 Minor white space changes.
* bfd/amigaos.c (amiga_handle_rest): Use TABs.
  (amiga_write_object_contents): Likewise.
  (read_raw_relocs): Likewise.
2015-04-29 18:52:24 +00:00
f723c5d6ef Unify relocation read logic.
* bfd/amigaos.c (read_raw_relocs): Replace switch with an if test.
2015-04-29 18:48:43 +00:00
48a6d2ca95 Handle more relocation hunk types and treat absolute relocations as such
where possible.

* bfd/amigaos.c (reloc_types array): Add HUNK_ABSRELOC16 and HUNK_RELRELOC32.
  (determine_type): Update for layout change of reloc_types array.
2015-04-29 18:36:00 +00:00
6a60985980 Add support for EXT_RELCOMMON.
* bfd/amigaos.c (howto_for_reloc): Handle EXT_RELCOMMON.
  (parse_archive_units): Likewise.
  (amiga_handle_rest): Likewise.
  (amiga_write_symbols): Likewise.
  (amiga_slurp_symbol_table): Likewise.
  (amiga_slurp_relocs): Likewise.
  (amiga_slurp_armap): Likewise.
2015-04-29 18:27:38 +00:00
6bda262494 Group common reloc types.
* bfd/amigaos.c (reloc enum): Move R_PC32 entry.
  (howto_table): Likewise.
2015-04-29 18:21:58 +00:00
52d21eb1f2 Handle absolute 8-bit and 16-bit amigaos relocations.
* bfd/amigaos.c (reloc enum): Add values for 8-bit and 16-bit absolute relocs.
  (howto_table): Add entries for the new enum values.
  (howto_for_raw_reloc): Handle HUNK_ABSRELOC16.
  (howto_for_reloc): Handle EXT_ABSREF9 and EXT_ABSREF16.
  (parse_archive_units): Likewise.
  (amiga_handle_rest): Likewise.
  (amiga_write_symbols): Likewise.
  (amiga_slurp_armap): Likewise.
  (amiga_bfd_reloc_type_lookup): Map normal 8-bit and 16-bit BFD relocs to
  their absolute amigaos variants.
2015-04-29 18:16:46 +00:00
fc73468ff9 Prefer BFD data where available.
* bfd/amigaos.c (amiga_write_section_contents): Consult relocation howto
  for the size of the relocation object.
2015-04-29 17:18:00 +00:00
865652483c Handle more hunk types containing raw relocation data.
* bfd/amigaos.c (howto_for_raw_reloc): Handle HUNK_RELRELOC32 and HUNK_RELRELOC26.
2015-04-29 17:08:54 +00:00
cc69950864 Make reading HUNK_EXT data robust.
* bfd/amigaos.c (howto_for_reloc): New helper function to select a relocation
  howto entry.
  (amiga_slurp_relocs): Use it.
2015-04-29 17:03:03 +00:00
1bb550cac5 Make reading raw relocation data robust.
* bfd/amigaos.c (howto_for_raw_reloc): New function to select a relocation
  howto entry.
  (read_raw_relocs): Use it.
2015-04-29 16:53:23 +00:00
1dc1e0d965 Add a helper function to read a 16-bit value.
* bfd/amigaos.c (get_word): New helper function.
  (amiga_handle_rest): Use new helper function.
  (read_raw_relocs): Likewise.
2015-04-29 16:39:36 +00:00
d726b16546 Stop accessing BFD backend data member with type-punning. This silences
modern GCC versions.

* bfd/bfd-in2.h (struct bfd): Add amiga_ar_data to tdata union.
* bfd/amigaos.c (amiga_ardata): Use amiga_ar_data union member.
2015-03-29 13:01:31 +00:00
9658695df9 Tolerate bfd_link_hash_warning for input BFD symbols.
* bfd/linker.c (_bfd_generic_link_output_symbols): Accept bfd_link_hash_warning.
2015-03-29 12:38:57 +00:00
449a4bb122 Completely backport _bfd_ar_spacepad() changes from
X-Git-Url: http://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff_plain;h=390c0e4288ca46982c7702ec420d277c021032f4

* bfd/libbfd-in.h (_bfd_ar_spacepad): New prototype.
* bfd/libbfd.h (_bfd_ar_spacepad): Likewise.
* bfd/archive.c (_bfd_ar_spacepad): Use K&R style as rest of file.
* bfd/archive64.c (bfd_elf64_archive_write_armap): Use _bfd_ar_spacepad.
2015-03-29 12:32:37 +00:00
681f013ef9 Override m68k_aout_machtype value when building an amiga target.
* gas/config/tc-m68k.c (TE_AMIGA): Provide a zero default.
  (FRAME): Check TE_AMIGA for zero/non-zero value.
  (m68k_init_after_args): Tweak m68k_aout_machtype for TE_AMIGA case.
2015-03-27 17:17:52 +00:00
5c77c5df76 - checkin of certain files being automatically generated with newer version of flex/bison&co. 2015-03-26 08:15:01 +00:00
b8fa24d6f7 - backported function _bfd_ar_spacepad() from newer binutils versions in archive.c which fixes buffer overflow problems in these older versions of binutils. 2015-03-26 08:13:01 +00:00
a8d9343dc8 Use FLAG_SMALL_CODE at all places.
* gas/config/tc-m68k.c (md_estimate_size_before_relax): Use FLAG_SMALL_CODE.
2015-03-08 20:37:47 +00:00
3e83a383d7 Consistently disable small-code checks.
* gas/config/tc-m68k.c (FLAG_SMALL_CODE): New define.
  (m68k_ip): Replace checking of flag_small_code with FLAG_SMALL_CODE.
  (md_convert_frag_1): Likewise.
  (md_estimate_size_before_relax): Likewise.
2015-03-08 20:17:32 +00:00
f25adb075e Remove N_TEXT usage.
* gas/config/tc-m68k.c (N_TEXT): Delete.
  (md_convert_frag_1): Replace S_GET_TYPE check for N_TEXT with a check of
  S_GET_SEGMENT for text_segment.
2015-03-08 20:12:47 +00:00
a7120aeaef Fix N_WARNING .stabs handling.
* gas/config/obj-aout.h (N_REGISTER): Use 18 as fake N_TYPE for SEG_REGISTER.
* gas/config/obj-aout.c (N_TYPE_seg): Move SEG_REGISTER to its new position.
* gas/symbols.h (N_REGISTER): Do not redefine if already present.
2015-03-08 20:02:08 +00:00
f4a1fde5e7 * (amiga_write_object_contents): Use amiga_symbol macro.
* (amiga_slurp_relocs): Likewise.
2014-11-27 21:05:24 +00:00
11b5fe1b1d * (amiga_write_object_contents): Fix HUNK_DEBUG size calculation for 64bit hosts.
The broken code used the wrong structure for the size calculation. This bug was
  hidden on 32bit hosts since both structures have the same size on such hosts.
  The AmigaOS program loader refuses to load programs with a defective structure.
2014-11-27 21:01:50 +00:00
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
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
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
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
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
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
3d7cf01998 (amiga_perform_reloc): Catch baserelative relocations against code symbols.
(aout_perform_reloc): Likewise.
2009-03-07 19:28:21 +00:00
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
94d81690b0 Symbols on m68k-amigaos have underscores. 2009-01-14 16:57:05 +00:00
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
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
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
f7a41d0cc6 (MY_bfd_link_add_symbols): Don't define in terms of MY. 2008-12-24 10:22:55 +00:00
5391bb7612 (howto_table[H_PC26]): Lower two bits in mask values are not set. 2008-12-23 16:58:37 +00:00
f571c97eaa (determine_size): Remove macro.
(amiga_write_section_contents): Directly use reloc type as switch value.
2008-12-23 16:54:30 +00:00
046f38d206 (amiga_handle_cdb_hunk): Only use non-empty HUNK_NAME content. 2008-12-23 16:53:36 +00:00
a4ccb0ea31 (amiga_handle_rest): Factor out common code. Rearrange switch. 2008-12-23 16:52:27 +00:00
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
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
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
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