From dc810e3900d47ab2eea86d50231ff2e70b596847 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 18 Sep 2001 09:57:26 +0000 Subject: 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. --- bfd/hpux-core.c | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) (limited to 'bfd/hpux-core.c') diff --git a/bfd/hpux-core.c b/bfd/hpux-core.c index 199a6a1b0f..e39df79d6c 100644 --- a/bfd/hpux-core.c +++ b/bfd/hpux-core.c @@ -100,12 +100,21 @@ struct hpux_core_struct #define core_kernel_thread_id(bfd) (core_hdr(bfd)->lwpid) #define core_user_thread_id(bfd) (core_hdr(bfd)->user_tid) +static asection *make_bfd_asection + PARAMS ((bfd *, const char *, flagword, bfd_size_type, bfd_vma, + unsigned int)); +static asymbol *hpux_core_make_empty_symbol PARAMS ((bfd *)); +static const bfd_target *hpux_core_core_file_p PARAMS ((bfd *)); +static char *hpux_core_core_file_failing_command PARAMS ((bfd *)); +static int hpux_core_core_file_failing_signal PARAMS ((bfd *)); +static boolean hpux_core_core_file_matches_executable_p + PARAMS ((bfd *, bfd *)); static void swap_abort PARAMS ((void)); static asection * make_bfd_asection (abfd, name, flags, _raw_size, vma, alignment_power) bfd *abfd; - CONST char *name; + const char *name; flagword flags; bfd_size_type _raw_size; bfd_vma vma; @@ -114,7 +123,7 @@ make_bfd_asection (abfd, name, flags, _raw_size, vma, alignment_power) asection *asect; char *newname; - newname = bfd_alloc (abfd, strlen (name) + 1); + newname = bfd_alloc (abfd, (bfd_size_type) strlen (name) + 1); if (!newname) return NULL; @@ -137,7 +146,9 @@ static asymbol * hpux_core_make_empty_symbol (abfd) bfd *abfd; { - asymbol *new = (asymbol *) bfd_zalloc (abfd, sizeof (asymbol)); + asymbol *new; + + new = (asymbol *) bfd_zalloc (abfd, (bfd_size_type) sizeof (asymbol)); if (new) new->the_bfd = abfd; return new; @@ -160,7 +171,7 @@ hpux_core_core_file_p (abfd) int unknown_sections = 0; core_hdr (abfd) = (struct hpux_core_struct *) - bfd_zalloc (abfd, sizeof (struct hpux_core_struct)); + bfd_zalloc (abfd, (bfd_size_type) sizeof (struct hpux_core_struct)); if (!core_hdr (abfd)) return NULL; @@ -169,21 +180,23 @@ hpux_core_core_file_p (abfd) int val; struct corehead core_header; - val = bfd_read ((void *) &core_header, 1, sizeof core_header, abfd); + val = bfd_bread ((void *) &core_header, + (bfd_size_type) sizeof core_header, abfd); if (val <= 0) break; switch (core_header.type) { case CORE_KERNEL: case CORE_FORMAT: - bfd_seek (abfd, core_header.len, SEEK_CUR); /* Just skip this */ + /* Just skip this. */ + bfd_seek (abfd, (file_ptr) core_header.len, SEEK_CUR); good_sections++; break; case CORE_EXEC: { struct proc_exec proc_exec; - if (bfd_read ((void *) &proc_exec, 1, core_header.len, abfd) - != core_header.len) + if (bfd_bread ((void *) &proc_exec, (bfd_size_type) core_header.len, + abfd) != core_header.len) break; strncpy (core_command (abfd), proc_exec.cmd, MAXCOMLEN + 1); good_sections++; @@ -197,13 +210,13 @@ hpux_core_core_file_p (abfd) /* We need to read this section, 'cause we need to determine whether the core-dumped app was threaded before we create any .reg sections. */ - if (bfd_read (&proc_info, 1, core_header.len, abfd) + if (bfd_bread (&proc_info, (bfd_size_type) core_header.len, abfd) != core_header.len) break; /* However, we also want to create those sections with the file positioned at the start of the record, it seems. */ - if (bfd_seek (abfd, -core_header.len, SEEK_CUR) != 0) + if (bfd_seek (abfd, (file_ptr) -core_header.len, SEEK_CUR) != 0) break; #if defined(PROC_INFO_HAS_THREAD_ID) @@ -258,7 +271,7 @@ hpux_core_core_file_p (abfd) return NULL; } core_signal (abfd) = proc_info.sig; - if (bfd_seek (abfd, core_header.len, SEEK_CUR) != 0) + if (bfd_seek (abfd, (file_ptr) core_header.len, SEEK_CUR) != 0) break; good_sections++; } @@ -275,7 +288,7 @@ hpux_core_core_file_p (abfd) core_header.len, core_header.addr, 2)) return NULL; - bfd_seek (abfd, core_header.len, SEEK_CUR); + bfd_seek (abfd, (file_ptr) core_header.len, SEEK_CUR); good_sections++; break; @@ -327,7 +340,8 @@ hpux_core_core_file_failing_signal (abfd) /* ARGSUSED */ static boolean hpux_core_core_file_matches_executable_p (core_bfd, exec_bfd) - bfd *core_bfd, *exec_bfd; + bfd *core_bfd ATTRIBUTE_UNUSED; + bfd *exec_bfd ATTRIBUTE_UNUSED; { return true; /* FIXME, We have no way of telling at this point */ } @@ -346,7 +360,7 @@ hpux_core_core_file_matches_executable_p (core_bfd, exec_bfd) /* If somebody calls any byte-swapping routines, shoot them. */ static void -swap_abort() +swap_abort () { abort(); /* This way doesn't require any declaration for ANSI to fuck up */ } -- cgit v1.2.3