aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/bfd-in.h5
-rw-r--r--bfd/bfd-in2.h31
-rw-r--r--bfd/libbfd.c48
-rw-r--r--bfd/po/bfd.pot10
5 files changed, 83 insertions, 18 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index c0d5df6..4830e2b 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2000-12-21 Richard Sandiford <rsandifo@redhat.com>
+
+ * libbfd.c (bfd_get_bits): Added
+ (bfd_put_bits): Likewise
+ * bfd-in.h: Declared the above.
+ * bfd-in2.h: Regenerated.
+
2000-12-20 Kazu Hirata <kazu@hxi.com>
* targets.c: Fix formatting.
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index cc03024..08d597f 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -538,6 +538,11 @@ void bfd_putb32 PARAMS ((bfd_vma, unsigned char *));
void bfd_putl32 PARAMS ((bfd_vma, unsigned char *));
void bfd_putb16 PARAMS ((bfd_vma, unsigned char *));
void bfd_putl16 PARAMS ((bfd_vma, unsigned char *));
+
+/* Byte swapping routines which take size and endiannes as arguments. */
+
+bfd_vma bfd_get_bits PARAMS ((bfd_byte *, int, boolean));
+void bfd_put_bits PARAMS ((bfd_vma, bfd_byte *, int, boolean));
/* Externally visible ECOFF routines. */
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 03794fa..5fe2b47 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -538,6 +538,11 @@ void bfd_putb32 PARAMS ((bfd_vma, unsigned char *));
void bfd_putl32 PARAMS ((bfd_vma, unsigned char *));
void bfd_putb16 PARAMS ((bfd_vma, unsigned char *));
void bfd_putl16 PARAMS ((bfd_vma, unsigned char *));
+
+/* Byte swapping routines which take size and endiannes as arguments. */
+
+bfd_vma bfd_get_bits PARAMS ((bfd_byte *, int, boolean));
+void bfd_put_bits PARAMS ((bfd_vma, bfd_byte *, int, boolean));
/* Externally visible ECOFF routines. */
@@ -1303,7 +1308,7 @@ bfd_set_section_flags PARAMS ((bfd *abfd, asection *sec, flagword flags));
void
bfd_map_over_sections PARAMS ((bfd *abfd,
- void (*func)(bfd *abfd,
+ void (*func) (bfd *abfd,
asection *sect,
PTR obj),
PTR obj));
@@ -3186,13 +3191,13 @@ core_file_matches_executable_p
(bfd_assert (__FILE__,__LINE__), NULL))
#endif
#define BFD_SEND_FMT(bfd, message, arglist) \
- (((bfd)->xvec->message[(int)((bfd)->format)]) arglist)
+ (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist)
#ifdef DEBUG_BFD_SEND
#undef BFD_SEND_FMT
#define BFD_SEND_FMT(bfd, message, arglist) \
(((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
- (((bfd)->xvec->message[(int)((bfd)->format)]) arglist) : \
+ (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) : \
(bfd_assert (__FILE__,__LINE__), NULL))
#endif
enum bfd_flavour {
@@ -3227,10 +3232,10 @@ typedef struct bfd_target
enum bfd_flavour flavour;
enum bfd_endian byteorder;
enum bfd_endian header_byteorder;
- flagword object_flags;
+ flagword object_flags;
flagword section_flags;
char symbol_leading_char;
- char ar_pad_char;
+ char ar_pad_char;
unsigned short ar_max_namelen;
bfd_vma (*bfd_getx64) PARAMS ((const bfd_byte *));
bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((const bfd_byte *));
@@ -3269,7 +3274,7 @@ CAT(NAME,_get_section_contents_in_window)
/* Called when a new section is created. */
boolean (*_new_section_hook) PARAMS ((bfd *, sec_ptr));
/* Read the contents of a section. */
- boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
+ boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
file_ptr, bfd_size_type));
boolean (*_bfd_get_section_contents_in_window)
PARAMS ((bfd *, sec_ptr, bfd_window *,
@@ -3293,7 +3298,7 @@ CAT(NAME,_bfd_print_private_bfd_data)\
to another. */
boolean (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr,
bfd *, sec_ptr));
- /* Called to copy BFD private symbol data from one symbol
+ /* Called to copy BFD private symbol data from one symbol
to another. */
boolean (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *,
bfd *, asymbol *));
@@ -3329,10 +3334,10 @@ CAT(NAME,_update_armap_timestamp)
boolean (*_bfd_construct_extended_name_table)
PARAMS ((bfd *, char **, bfd_size_type *, const char **));
void (*_bfd_truncate_arname) PARAMS ((bfd *, CONST char *, char *));
- boolean (*write_armap) PARAMS ((bfd *arch,
+ boolean (*write_armap) PARAMS ((bfd *arch,
unsigned int elength,
struct orl *map,
- unsigned int orl_count,
+ unsigned int orl_count,
int stridx));
PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *));
bfd * (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev));
@@ -3465,11 +3470,11 @@ CAT(NAME,_canonicalize_dynamic_reloc)
long (*_bfd_canonicalize_dynamic_reloc)
PARAMS ((bfd *, arelent **, struct symbol_cache_entry **));
- /* Opposite endian version of this target. */
+ /* Opposite endian version of this target. */
const struct bfd_target * alternative_target;
-
+
PTR backend_data;
-
+
} bfd_target;
boolean
bfd_set_default_target PARAMS ((const char *name));
@@ -3481,7 +3486,7 @@ const char **
bfd_target_list PARAMS ((void));
const bfd_target *
-bfd_search_for_target PARAMS ((int (* search_func)(const bfd_target *, void *), void *));
+bfd_search_for_target PARAMS ((int (* search_func) (const bfd_target *, void *), void *));
boolean
bfd_check_format PARAMS ((bfd *abfd, bfd_format format));
diff --git a/bfd/libbfd.c b/bfd/libbfd.c
index 47f1ebb..c570ddf 100644
--- a/bfd/libbfd.c
+++ b/bfd/libbfd.c
@@ -1190,6 +1190,54 @@ bfd_putl64 (data, addr)
BFD_FAIL();
#endif
}
+
+void
+bfd_put_bits (data, addr, bits, big_p)
+ bfd_vma data;
+ bfd_byte *addr;
+ int bits;
+ boolean big_p;
+{
+ int i;
+ int bytes;
+
+ if (bits % 8 != 0)
+ abort ();
+
+ bytes = bits / 8;
+ for (i = 0; i < bytes; i++)
+ {
+ int index = big_p ? bytes - i - 1 : i;
+
+ addr[index] = (bfd_byte) data;
+ data >>= 8;
+ }
+}
+
+bfd_vma
+bfd_get_bits (addr, bits, big_p)
+ bfd_byte *addr;
+ int bits;
+ boolean big_p;
+{
+ bfd_vma data;
+ int i;
+ int bytes;
+
+ if (bits % 8 != 0)
+ abort ();
+
+ data = 0;
+ bytes = bits / 8;
+ for (i = 0; i < bytes; i++)
+ {
+ int index = big_p ? i : bytes - i - 1;
+
+ data = (data << 8) | addr[index];
+ }
+
+ return data;
+}
/* Default implementation */
diff --git a/bfd/po/bfd.pot b/bfd/po/bfd.pot
index 249b50c..2009791 100644
--- a/bfd/po/bfd.pot
+++ b/bfd/po/bfd.pot
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2000-12-18 10:57-0800\n"
+"POT-Creation-Date: 2000-12-21 10:12-0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -1425,12 +1425,12 @@ msgstr ""
msgid "not mapping: env var not set\n"
msgstr ""
-#: libbfd.c:1335
+#: libbfd.c:1383
#, c-format
msgid "%s: compiled for a big endian system and target is little endian"
msgstr ""
-#: libbfd.c:1337
+#: libbfd.c:1385
#, c-format
msgid "%s: compiled for a little endian system and target is big endian"
msgstr ""
@@ -1864,12 +1864,12 @@ msgstr ""
msgid "som_sizeof_headers unimplemented"
msgstr ""
-#: srec.c:301
+#: srec.c:300
#, c-format
msgid "%s:%d: Unexpected character `%s' in S-record file\n"
msgstr ""
-#: syms.c:974
+#: syms.c:968
msgid "Unsupported .stab relocation"
msgstr ""