aboutsummaryrefslogtreecommitdiff
path: root/bfd/libbfd.c
diff options
context:
space:
mode:
authorJohn Gilmore <gnu@cygnus>1993-04-15 04:53:14 +0000
committerJohn Gilmore <gnu@cygnus>1993-04-15 04:53:14 +0000
commitb6090f4d654d4eb195d6729f7e04d9d1440269be (patch)
tree383d5be622a026c152c3bb341d956e6b4a111f21 /bfd/libbfd.c
parent8f8fefccf585d0870449d4ce27a4312d428a8948 (diff)
downloadgdb-b6090f4d654d4eb195d6729f7e04d9d1440269be.zip
gdb-b6090f4d654d4eb195d6729f7e04d9d1440269be.tar.gz
gdb-b6090f4d654d4eb195d6729f7e04d9d1440269be.tar.bz2
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.
Diffstat (limited to 'bfd/libbfd.c')
-rw-r--r--bfd/libbfd.c39
1 files changed, 35 insertions, 4 deletions
diff --git a/bfd/libbfd.c b/bfd/libbfd.c
index e11f794..a462449 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) |