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

47 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
13c70d6ec5 (amiga_ardata): Cast through void to appease GCC4.
(amiga_add_reloc): Likewise.
2008-11-25 20:50:40 +00:00
048908e339 (amiga_archive_p): Enhance link library detection by checking the filename. 2008-11-25 20:49:37 +00:00
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
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
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
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
ed264daf4f (determine_datadata_relocs): Fix comment.
(amiga_write_section_contents): Likewise.
(amiga_write_symbols): Likewise.
2008-11-25 20:40:30 +00:00
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
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
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
9a683d1b51 (amiga_write_object_contents): Use symbolic constants for hunk memory type. 2008-11-25 20:34:08 +00:00
5199e4dead (amiga_object_p,amiga_read_unit,amiga_write_object_contents): Tweak comment.
(amiga_write_object_contents): Tweak debug message and fix formatting.
(amiga_openr_next_archived_file): Fix formatting.
2008-11-25 20:33:17 +00:00
d6af3b0691 applied patch to bring it in sync with latest CVS head 2006-03-16 00:07:44 +00:00
8c09c6eb7c applied BUTILS_2_14->BUTILS_AMIGA_20031201 patch 2006-03-15 23:35:05 +00:00