summaryrefslogtreecommitdiff
path: root/bfd/aout-tic30.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2001-09-18 09:57:26 +0000
committerAlan Modra <amodra@bigpond.net.au>2001-09-18 09:57:26 +0000
commit439c22790eb92fc38c0c4e91bc343ef8d0e55427 (patch)
treeeb49f3489bb7e104ca1c425d07d5d954ab03148f /bfd/aout-tic30.c
parent8ff532ca9bf72656df68051c20729d9fdec919b9 (diff)
downloadgdb-439c22790eb92fc38c0c4e91bc343ef8d0e55427.tar.gz
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become bfd_bread and bfd_bwrite. o bfd_*alloc now all take a bfd_size_type arg, and will error if size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files or bugs in linker scripts etc. o file_ptr becomes a bfd_signed_vma. Besides matching sizes with various other types involved in handling sections, this should make it easier for bfd to support a 64 bit off_t on 32 bit hosts that provide it. o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*) generally available. They now cast their args to bfd_vma and bfd_byte * as appropriate, which removes a swag of casts from the source. o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and aout-encap.c. o Zillions of formatting and -Wconversion fixes.
Diffstat (limited to 'bfd/aout-tic30.c')
-rw-r--r--bfd/aout-tic30.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/bfd/aout-tic30.c b/bfd/aout-tic30.c
index 5d25c209f09..3fad7ac26fd 100644
--- a/bfd/aout-tic30.c
+++ b/bfd/aout-tic30.c
@@ -57,13 +57,18 @@ static const bfd_target *tic30_aout_object_p PARAMS ((bfd *));
static boolean tic30_aout_write_object_contents PARAMS ((bfd *));
static boolean tic30_aout_set_sizes PARAMS ((bfd *));
static const bfd_target * tic30_aout_callback PARAMS ((bfd *));
-static boolean MY_bfd_copy_private_section_data PARAMS ((bfd *, asection *, bfd *, asection *));
+static boolean MY_bfd_copy_private_section_data
+ PARAMS ((bfd *, asection *, bfd *, asection *));
static boolean MY_bfd_final_link PARAMS ((bfd *, struct bfd_link_info *));
-reloc_howto_type * tic30_aout_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type));
-enum machine_type tic30_aout_machine_type PARAMS ((enum bfd_architecture, unsigned long, boolean *));
-boolean tic30_aout_set_arch_mach PARAMS ((bfd *, enum bfd_architecture, unsigned long));
-
-#define MY_reloc_howto(BFD,REL,IN,EX,PC) tic30_aout_reloc_howto(BFD,REL,&IN,&EX,&PC)
+reloc_howto_type * tic30_aout_reloc_type_lookup
+ PARAMS ((bfd *, bfd_reloc_code_real_type));
+enum machine_type tic30_aout_machine_type
+ PARAMS ((enum bfd_architecture, unsigned long, boolean *));
+boolean tic30_aout_set_arch_mach
+ PARAMS ((bfd *, enum bfd_architecture, unsigned long));
+
+#define MY_reloc_howto(BFD, REL, IN, EX, PC) \
+ tic30_aout_reloc_howto(BFD, REL, &IN, &EX, &PC)
#define MY_final_link_relocate tic30_aout_final_link_relocate
#define MY_object_p tic30_aout_object_p
#define MY_mkobject NAME(aout,mkobject)
@@ -107,7 +112,7 @@ boolean tic30_aout_set_arch_mach PARAMS ((bfd *, enum bfd_architecture, unsigne
#define MY_finish_dynamic_link 0
#endif
-static CONST struct aout_backend_data tic30_aout_backend_data =
+static const struct aout_backend_data tic30_aout_backend_data =
{
MY_zmagic_contiguous,
MY_text_includes_header,
@@ -352,7 +357,7 @@ tic30_aout_callback (abfd)
#ifdef SET_ARCH_MACH
SET_ARCH_MACH (abfd, *execp);
#else
- bfd_default_set_arch_mach (abfd, DEFAULT_ARCH, 0);
+ bfd_default_set_arch_mach (abfd, DEFAULT_ARCH, 0L);
#endif
/* Now that we know the architecture, set the alignments of the
@@ -496,7 +501,9 @@ tic30_aout_relocate_contents (howto, input_bfd, relocation, location)
case complain_overflow_bitfield:
{
bfd_vma reloc_bits = (((1 << (howto->bitsize - 1)) - 1) << 1) | 1;
- if ((check & ~reloc_bits) != 0 && (((bfd_vma) signed_check & ~reloc_bits) != (-1 & ~reloc_bits)))
+ if ((check & ~reloc_bits) != 0
+ && (((bfd_vma) signed_check & ~reloc_bits)
+ != ((bfd_vma) -1 & ~reloc_bits)))
overflow = true;
}
break;
@@ -538,9 +545,9 @@ tic30_aout_object_p (abfd)
struct external_exec exec_bytes; /* Raw exec header from file. */
struct internal_exec exec; /* Cleaned-up exec header. */
const bfd_target *target;
+ bfd_size_type amt = EXEC_BYTES_SIZE;
- if (bfd_read ((PTR) & exec_bytes, 1, EXEC_BYTES_SIZE, abfd)
- != EXEC_BYTES_SIZE)
+ if (bfd_bread ((PTR) &exec_bytes, amt, abfd) != amt)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
@@ -550,7 +557,7 @@ tic30_aout_object_p (abfd)
#ifdef SWAP_MAGIC
exec.a_info = SWAP_MAGIC (exec_bytes.e_info);
#else
- exec.a_info = bfd_h_get_32 (abfd, exec_bytes.e_info);
+ exec.a_info = H_GET_32 (abfd, exec_bytes.e_info);
#endif /* SWAP_MAGIC */
if (N_BADMAG (exec))
@@ -638,9 +645,11 @@ tic30_aout_write_object_contents (abfd)
if (adata (abfd).exec_bytes_size > 0)
{
+ bfd_size_type amt;
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
return false;
- if (bfd_write ((PTR) & exec_bytes, 1, adata (abfd).exec_bytes_size, abfd) != adata (abfd).exec_bytes_size)
+ amt = adata (abfd).exec_bytes_size;
+ if (bfd_bwrite ((PTR) &exec_bytes, amt, abfd) != amt)
return false;
}