From b6090f4d654d4eb195d6729f7e04d9d1440269be Mon Sep 17 00:00:00 2001 From: John Gilmore Date: Thu, 15 Apr 1993 04:53:14 +0000 Subject: [PATCH] Cleanup in preparation for better 64-bit host support. * bfd-in.h (bfd_64_type): Remove. * libbfd.c (_do_getb64, _do_putb64): Use bfd_vma, not bfd_64_type. * bfd-in.h (bfd_size): Remove. * bfd-in.h (bfd_offset): Remove, after fixing ld/ldlang.[ch]. * bfd-in.h (bfd_word): Remove. * reloc.c (reloc_howto_type): Replace bfd_word with bfd_vma. * bfd-in.h (rawdata_offset): Remove. * reloc.c (arelent): Replace rawdata_offset with bfd_size_type. (bfd_perform_relocation): Lint. (enum bfd_reloc_status): Comment cleanup. --- bfd/ChangeLog | 31 +++++++++++++++++++++++++------ bfd/bfd-in.h | 17 +++++------------ bfd/libbfd.c | 39 +++++++++++++++++++++++++++++++++++---- 3 files changed, 65 insertions(+), 22 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index ee35926fc7d..8294f5a7354 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,28 @@ +Wed Apr 14 20:34:54 1993 John Gilmore (gnu@cygnus.com) + + Cleanup in preparation for better 64-bit host support. + + * bfd-in.h (bfd_64_type): Remove. + * libbfd.c (_do_getb64, _do_putb64): Use bfd_vma, not bfd_64_type. + + * bfd-in.h (bfd_size): Remove. + + * bfd-in.h (bfd_offset): Remove, after fixing ld/ldlang.[ch]. + + * bfd-in.h (bfd_word): Remove. + * reloc.c (reloc_howto_type): Replace bfd_word with bfd_vma. + + * bfd-in.h (rawdata_offset): Remove. + * reloc.c (arelent): Replace rawdata_offset with bfd_size_type. + (bfd_perform_relocation): Lint. + (enum bfd_reloc_status): Comment cleanup. + + * aout-adobe.c, cpu-h8300.c, mipsbsd.c, srec.c: lint -Wall. + +Tue Apr 13 11:19:52 1993 Jim Kingdon (kingdon@cygnus.com) + + * aoutf1.h (swapcore_sparc): Guess the right value of USRSTACK. + Mon Apr 12 14:18:00 1993 John Gilmore (gnu@cygnus.com) * elf32.c: Clean up old comments. @@ -3375,7 +3400,6 @@ Mon May 20 17:12:17 1991 Steve Chamberlain (steve at cygint.cygnus.com) from which it was split out. Now 64 bit version is built with a -DHOST_64_BIT="long long" on the compile line. - Fri May 17 19:35:26 1991 Steve Chamberlain (steve at cygint.cygnus.com) Changed all the [get|put][name] routines to use [get|put]_[size @@ -3402,10 +3426,6 @@ Fri May 17 19:35:26 1991 Steve Chamberlain (steve at cygint.cygnus.com) be called b.out.c * coffcode.h: used to be called coff-code.h, now 64bit ized. * demo64.c: 64 bit a.out back end - - - - Thu May 16 16:02:07 1991 Steve Chamberlain (steve at cygint.cygnus.com) from bothner * libieee.h: Make ieee_data and ieee_ar_data macros usable @@ -3416,7 +3436,6 @@ Thu May 16 16:02:07 1991 Steve Chamberlain (steve at cygint.cygnus.com) * opncls.c: Define S_IXUSR, S_IXGRP, S_IXOTH if undefined. * targets.c: Add declaration of newsos3_vec. - Mon May 13 10:03:29 1991 Steve Chamberlain (steve at cygint.cygnus.com) * aout.c: fixxed some of the problems with filepos calculation. diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index d5eeb564b14..50e52461b9c 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -1,7 +1,7 @@ /* Main header file for the bfd library -- portable access to object files. ==> The bfd.h file is generated from bfd-in.h and various .c files; if you ==> change it, your changes will probably be lost. - Copyright 1990, 1991, 1992 Free Software Foundation, Inc. + Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc. Contributed by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -71,22 +71,13 @@ typedef long int file_ptr; /* Support for different sizes of target format ints and addresses */ #ifdef HOST_64_BIT -typedef HOST_64_BIT rawdata_offset; typedef HOST_64_BIT bfd_vma; -typedef HOST_64_BIT bfd_word; -typedef HOST_64_BIT bfd_offset; typedef HOST_64_BIT bfd_size_type; typedef HOST_64_BIT symvalue; -typedef HOST_64_BIT bfd_64_type; #define fprintf_vma(s,x) \ fprintf(s,"%08x%08x", uint64_typeHIGH(x), uint64_typeLOW(x)) #else -typedef struct {int a,b;} bfd_64_type; -typedef unsigned long rawdata_offset; typedef unsigned long bfd_vma; -typedef unsigned long bfd_offset; -typedef unsigned long bfd_word; -typedef unsigned long bfd_size; typedef unsigned long symvalue; typedef unsigned long bfd_size_type; #define fprintf_vma(s,x) fprintf(s, "%08lx", x) @@ -195,7 +186,7 @@ typedef struct sec *sec_ptr; #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0) -#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (val)), ((ptr)->user_set_vma = true), true) +#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma= (val)), ((ptr)->user_set_vma = true), true) #define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),true) #define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),true) @@ -290,7 +281,9 @@ CAT(NAME,_bfd_debug_info_end),\ CAT(NAME,_bfd_debug_info_accumulate),\ CAT(NAME,_bfd_get_relocated_section_contents),\ CAT(NAME,_bfd_relax_section),\ -CAT(NAME,_bfd_seclet_link) +CAT(NAME,_bfd_seclet_link),\ +CAT(NAME,_bfd_reloc_type_lookup),\ +CAT(NAME,_bfd_make_debug_symbol) #define COFF_SWAP_TABLE (PTR) &bfd_coff_std_swap_table diff --git a/bfd/libbfd.c b/bfd/libbfd.c index e11f7940cc6..a4624496625 100644 --- a/bfd/libbfd.c +++ b/bfd/libbfd.c @@ -267,8 +267,39 @@ DEFUN(bfd_seek,(abfd, position, direction), if (direction == SEEK_CUR && position == 0) return 0; #ifdef FILE_OFFSET_IS_CHAR_INDEX - if (direction == SEEK_SET && position == abfd->where) - return 0; + if (abfd->format != bfd_archive && abfd->my_archive == 0) + { +#ifndef NDEBUG + /* Explanation for this code: I'm only about 95+% sure that the above + conditions are sufficient and that all i/o calls are properly + adjusting the `where' field. So this is sort of an `assert' + that the `where' field is correct. If we can go a while without + tripping the abort, we can probably safely disable this code, + so that the real optimizations happen. */ + file_ptr where_am_i_now; + where_am_i_now = ftell (bfd_cache_lookup (abfd)); + if (abfd->my_archive) + where_am_i_now -= abfd->origin; + if (where_am_i_now != abfd->where) + abort (); +#endif + if (direction == SEEK_SET && position == abfd->where) + return 0; + } + else + { + /* We need something smarter to optimize access to archives. + Currently, anything inside an archive is read via the file + handle for the archive. Which means that a bfd_seek on one + component affects the `current position' in the archive, as + well as in any other component. + + It might be sufficient to put a spike through the cache + abstraction, and look to the archive for the file position, + but I think we should try for something cleaner. + + In the meantime, no optimization for archives. */ + } #endif f = bfd_cache_lookup (abfd); @@ -473,7 +504,7 @@ DEFUN(_do_getb64,(addr), register bfd_byte *addr) { #ifdef HOST_64_BIT - bfd_64_type low, high; + bfd_vma low, high; high= ((((((((addr[0]) << 8) | addr[1]) << 8) | @@ -499,7 +530,7 @@ DEFUN(_do_getl64,(addr), { #ifdef HOST_64_BIT - bfd_64_type low, high; + bfd_vma low, high; high= (((((((addr[7] << 8) | addr[6]) << 8) | addr[5]) << 8) | -- 2.30.2