1 /* Assorted BFD support routines, only used internally.
2 Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 2000, 2001, 2002, 2003, 2004, 2005, 2007
4 Free Software Foundation, Inc.
5 Written by Cygnus Support.
7 This file is part of BFD, the Binary File Descriptor library.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
22 MA 02110-1301, USA. */
28 #ifndef HAVE_GETPAGESIZE
29 #define getpagesize() 2048
34 Implementation details
40 These routines are used within BFD.
41 They are not intended for export, but are documented here for
45 /* A routine which is used in target vectors for unsupported
49 bfd_false (bfd *ignore ATTRIBUTE_UNUSED)
51 bfd_set_error (bfd_error_invalid_operation);
55 /* A routine which is used in target vectors for supported operations
56 which do not actually do anything. */
59 bfd_true (bfd *ignore ATTRIBUTE_UNUSED)
64 /* A routine which is used in target vectors for unsupported
65 operations which return a pointer value. */
68 bfd_nullvoidptr (bfd *ignore ATTRIBUTE_UNUSED)
70 bfd_set_error (bfd_error_invalid_operation);
75 bfd_0 (bfd *ignore ATTRIBUTE_UNUSED)
81 bfd_0u (bfd *ignore ATTRIBUTE_UNUSED)
87 bfd_0l (bfd *ignore ATTRIBUTE_UNUSED)
92 /* A routine which is used in target vectors for unsupported
93 operations which return -1 on error. */
96 _bfd_n1 (bfd *ignore_abfd ATTRIBUTE_UNUSED)
98 bfd_set_error (bfd_error_invalid_operation);
103 bfd_void (bfd *ignore ATTRIBUTE_UNUSED)
108 _bfd_norelocs_get_reloc_upper_bound (bfd *abfd ATTRIBUTE_UNUSED,
109 asection *sec ATTRIBUTE_UNUSED)
111 return sizeof (arelent *);
115 _bfd_norelocs_canonicalize_reloc (bfd *abfd ATTRIBUTE_UNUSED,
116 asection *sec ATTRIBUTE_UNUSED,
118 asymbol **symbols ATTRIBUTE_UNUSED)
125 _bfd_nocore_core_file_matches_executable_p
126 (bfd *ignore_core_bfd ATTRIBUTE_UNUSED,
127 bfd *ignore_exec_bfd ATTRIBUTE_UNUSED)
129 bfd_set_error (bfd_error_invalid_operation);
133 /* Routine to handle core_file_failing_command entry point for targets
134 without core file support. */
137 _bfd_nocore_core_file_failing_command (bfd *ignore_abfd ATTRIBUTE_UNUSED)
139 bfd_set_error (bfd_error_invalid_operation);
143 /* Routine to handle core_file_failing_signal entry point for targets
144 without core file support. */
147 _bfd_nocore_core_file_failing_signal (bfd *ignore_abfd ATTRIBUTE_UNUSED)
149 bfd_set_error (bfd_error_invalid_operation);
154 _bfd_dummy_target (bfd *ignore_abfd ATTRIBUTE_UNUSED)
156 bfd_set_error (bfd_error_wrong_format);
160 /* Allocate memory using malloc. */
163 bfd_malloc (bfd_size_type size)
167 if (size != (size_t) size)
169 bfd_set_error (bfd_error_no_memory);
173 ptr = malloc ((size_t) size);
174 if (ptr == NULL && (size_t) size != 0)
175 bfd_set_error (bfd_error_no_memory);
180 /* Allocate memory using malloc, nmemb * size with overflow checking. */
183 bfd_malloc2 (bfd_size_type nmemb, bfd_size_type size)
187 if ((nmemb | size) >= HALF_BFD_SIZE_TYPE
189 && nmemb > ~(bfd_size_type) 0 / size)
191 bfd_set_error (bfd_error_no_memory);
197 if (size != (size_t) size)
199 bfd_set_error (bfd_error_no_memory);
203 ptr = malloc ((size_t) size);
204 if (ptr == NULL && (size_t) size != 0)
205 bfd_set_error (bfd_error_no_memory);
210 /* Reallocate memory using realloc. */
213 bfd_realloc (void *ptr, bfd_size_type size)
217 if (size != (size_t) size)
219 bfd_set_error (bfd_error_no_memory);
224 ret = malloc ((size_t) size);
226 ret = realloc (ptr, (size_t) size);
228 if (ret == NULL && (size_t) size != 0)
229 bfd_set_error (bfd_error_no_memory);
234 /* Reallocate memory using realloc, nmemb * size with overflow checking. */
237 bfd_realloc2 (void *ptr, bfd_size_type nmemb, bfd_size_type size)
241 if ((nmemb | size) >= HALF_BFD_SIZE_TYPE
243 && nmemb > ~(bfd_size_type) 0 / size)
245 bfd_set_error (bfd_error_no_memory);
251 if (size != (size_t) size)
253 bfd_set_error (bfd_error_no_memory);
258 ret = malloc ((size_t) size);
260 ret = realloc (ptr, (size_t) size);
262 if (ret == NULL && (size_t) size != 0)
263 bfd_set_error (bfd_error_no_memory);
268 /* Allocate memory using malloc and clear it. */
271 bfd_zmalloc (bfd_size_type size)
275 if (size != (size_t) size)
277 bfd_set_error (bfd_error_no_memory);
281 ptr = malloc ((size_t) size);
283 if ((size_t) size != 0)
286 bfd_set_error (bfd_error_no_memory);
288 memset (ptr, 0, (size_t) size);
294 /* Allocate memory using malloc (nmemb * size) with overflow checking
298 bfd_zmalloc2 (bfd_size_type nmemb, bfd_size_type size)
302 if ((nmemb | size) >= HALF_BFD_SIZE_TYPE
304 && nmemb > ~(bfd_size_type) 0 / size)
306 bfd_set_error (bfd_error_no_memory);
312 if (size != (size_t) size)
314 bfd_set_error (bfd_error_no_memory);
318 ptr = malloc ((size_t) size);
320 if ((size_t) size != 0)
323 bfd_set_error (bfd_error_no_memory);
325 memset (ptr, 0, (size_t) size);
333 bfd_write_bigendian_4byte_int
336 bfd_boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int);
339 Write a 4 byte integer @var{i} to the output BFD @var{abfd}, in big
340 endian order regardless of what else is going on. This is useful in
345 bfd_write_bigendian_4byte_int (bfd *abfd, unsigned int i)
348 bfd_putb32 ((bfd_vma) i, buffer);
349 return bfd_bwrite (buffer, (bfd_size_type) 4, abfd) == 4;
353 /** The do-it-yourself (byte) sex-change kit */
355 /* The middle letter e.g. get<b>short indicates Big or Little endian
356 target machine. It doesn't matter what the byte order of the host
357 machine is; these routines work for either. */
359 /* FIXME: Should these take a count argument?
360 Answer (gnu@cygnus.com): No, but perhaps they should be inline
361 functions in swap.h #ifdef __GNUC__.
362 Gprof them later and find out. */
371 These macros as used for reading and writing raw data in
372 sections; each access (except for bytes) is vectored through
373 the target format of the BFD and mangled accordingly. The
374 mangling performs any necessary endian translations and
375 removes alignment restrictions. Note that types accepted and
376 returned by these macros are identical so they can be swapped
377 around in macros---for example, @file{libaout.h} defines <<GET_WORD>>
378 to either <<bfd_get_32>> or <<bfd_get_64>>.
380 In the put routines, @var{val} must be a <<bfd_vma>>. If we are on a
381 system without prototypes, the caller is responsible for making
382 sure that is true, with a cast if necessary. We don't cast
383 them in the macro definitions because that would prevent <<lint>>
384 or <<gcc -Wall>> from detecting sins such as passing a pointer.
385 To detect calling these with less than a <<bfd_vma>>, use
386 <<gcc -Wconversion>> on a host with 64 bit <<bfd_vma>>'s.
389 .{* Byte swapping macros for user section data. *}
391 .#define bfd_put_8(abfd, val, ptr) \
392 . ((void) (*((unsigned char *) (ptr)) = (val) & 0xff))
393 .#define bfd_put_signed_8 \
395 .#define bfd_get_8(abfd, ptr) \
396 . (*(unsigned char *) (ptr) & 0xff)
397 .#define bfd_get_signed_8(abfd, ptr) \
398 . (((*(unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80)
400 .#define bfd_put_16(abfd, val, ptr) \
401 . BFD_SEND (abfd, bfd_putx16, ((val),(ptr)))
402 .#define bfd_put_signed_16 \
404 .#define bfd_get_16(abfd, ptr) \
405 . BFD_SEND (abfd, bfd_getx16, (ptr))
406 .#define bfd_get_signed_16(abfd, ptr) \
407 . BFD_SEND (abfd, bfd_getx_signed_16, (ptr))
409 .#define bfd_put_32(abfd, val, ptr) \
410 . BFD_SEND (abfd, bfd_putx32, ((val),(ptr)))
411 .#define bfd_put_signed_32 \
413 .#define bfd_get_32(abfd, ptr) \
414 . BFD_SEND (abfd, bfd_getx32, (ptr))
415 .#define bfd_get_signed_32(abfd, ptr) \
416 . BFD_SEND (abfd, bfd_getx_signed_32, (ptr))
418 .#define bfd_put_64(abfd, val, ptr) \
419 . BFD_SEND (abfd, bfd_putx64, ((val), (ptr)))
420 .#define bfd_put_signed_64 \
422 .#define bfd_get_64(abfd, ptr) \
423 . BFD_SEND (abfd, bfd_getx64, (ptr))
424 .#define bfd_get_signed_64(abfd, ptr) \
425 . BFD_SEND (abfd, bfd_getx_signed_64, (ptr))
427 .#define bfd_get(bits, abfd, ptr) \
428 . ((bits) == 8 ? (bfd_vma) bfd_get_8 (abfd, ptr) \
429 . : (bits) == 16 ? bfd_get_16 (abfd, ptr) \
430 . : (bits) == 32 ? bfd_get_32 (abfd, ptr) \
431 . : (bits) == 64 ? bfd_get_64 (abfd, ptr) \
432 . : (abort (), (bfd_vma) - 1))
434 .#define bfd_put(bits, abfd, val, ptr) \
435 . ((bits) == 8 ? bfd_put_8 (abfd, val, ptr) \
436 . : (bits) == 16 ? bfd_put_16 (abfd, val, ptr) \
437 . : (bits) == 32 ? bfd_put_32 (abfd, val, ptr) \
438 . : (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \
439 . : (abort (), (void) 0))
449 These macros have the same function as their <<bfd_get_x>>
450 brethren, except that they are used for removing information
451 for the header records of object files. Believe it or not,
452 some object files keep their header records in big endian
453 order and their data in little endian order.
455 .{* Byte swapping macros for file header data. *}
457 .#define bfd_h_put_8(abfd, val, ptr) \
458 . bfd_put_8 (abfd, val, ptr)
459 .#define bfd_h_put_signed_8(abfd, val, ptr) \
460 . bfd_put_8 (abfd, val, ptr)
461 .#define bfd_h_get_8(abfd, ptr) \
462 . bfd_get_8 (abfd, ptr)
463 .#define bfd_h_get_signed_8(abfd, ptr) \
464 . bfd_get_signed_8 (abfd, ptr)
466 .#define bfd_h_put_16(abfd, val, ptr) \
467 . BFD_SEND (abfd, bfd_h_putx16, (val, ptr))
468 .#define bfd_h_put_signed_16 \
470 .#define bfd_h_get_16(abfd, ptr) \
471 . BFD_SEND (abfd, bfd_h_getx16, (ptr))
472 .#define bfd_h_get_signed_16(abfd, ptr) \
473 . BFD_SEND (abfd, bfd_h_getx_signed_16, (ptr))
475 .#define bfd_h_put_32(abfd, val, ptr) \
476 . BFD_SEND (abfd, bfd_h_putx32, (val, ptr))
477 .#define bfd_h_put_signed_32 \
479 .#define bfd_h_get_32(abfd, ptr) \
480 . BFD_SEND (abfd, bfd_h_getx32, (ptr))
481 .#define bfd_h_get_signed_32(abfd, ptr) \
482 . BFD_SEND (abfd, bfd_h_getx_signed_32, (ptr))
484 .#define bfd_h_put_64(abfd, val, ptr) \
485 . BFD_SEND (abfd, bfd_h_putx64, (val, ptr))
486 .#define bfd_h_put_signed_64 \
488 .#define bfd_h_get_64(abfd, ptr) \
489 . BFD_SEND (abfd, bfd_h_getx64, (ptr))
490 .#define bfd_h_get_signed_64(abfd, ptr) \
491 . BFD_SEND (abfd, bfd_h_getx_signed_64, (ptr))
493 .{* Aliases for the above, which should eventually go away. *}
495 .#define H_PUT_64 bfd_h_put_64
496 .#define H_PUT_32 bfd_h_put_32
497 .#define H_PUT_16 bfd_h_put_16
498 .#define H_PUT_8 bfd_h_put_8
499 .#define H_PUT_S64 bfd_h_put_signed_64
500 .#define H_PUT_S32 bfd_h_put_signed_32
501 .#define H_PUT_S16 bfd_h_put_signed_16
502 .#define H_PUT_S8 bfd_h_put_signed_8
503 .#define H_GET_64 bfd_h_get_64
504 .#define H_GET_32 bfd_h_get_32
505 .#define H_GET_16 bfd_h_get_16
506 .#define H_GET_8 bfd_h_get_8
507 .#define H_GET_S64 bfd_h_get_signed_64
508 .#define H_GET_S32 bfd_h_get_signed_32
509 .#define H_GET_S16 bfd_h_get_signed_16
510 .#define H_GET_S8 bfd_h_get_signed_8
514 /* Sign extension to bfd_signed_vma. */
515 #define COERCE16(x) (((bfd_signed_vma) (x) ^ 0x8000) - 0x8000)
516 #define COERCE32(x) (((bfd_signed_vma) (x) ^ 0x80000000) - 0x80000000)
517 #define EIGHT_GAZILLION ((bfd_int64_t) 1 << 63)
518 #define COERCE64(x) \
519 (((bfd_int64_t) (x) ^ EIGHT_GAZILLION) - EIGHT_GAZILLION)
522 bfd_getb16 (const void *p)
524 const bfd_byte *addr = p;
525 return (addr[0] << 8) | addr[1];
529 bfd_getl16 (const void *p)
531 const bfd_byte *addr = p;
532 return (addr[1] << 8) | addr[0];
536 bfd_getb_signed_16 (const void *p)
538 const bfd_byte *addr = p;
539 return COERCE16 ((addr[0] << 8) | addr[1]);
543 bfd_getl_signed_16 (const void *p)
545 const bfd_byte *addr = p;
546 return COERCE16 ((addr[1] << 8) | addr[0]);
550 bfd_putb16 (bfd_vma data, void *p)
553 addr[0] = (data >> 8) & 0xff;
554 addr[1] = data & 0xff;
558 bfd_putl16 (bfd_vma data, void *p)
561 addr[0] = data & 0xff;
562 addr[1] = (data >> 8) & 0xff;
566 bfd_getb32 (const void *p)
568 const bfd_byte *addr = p;
571 v = (unsigned long) addr[0] << 24;
572 v |= (unsigned long) addr[1] << 16;
573 v |= (unsigned long) addr[2] << 8;
574 v |= (unsigned long) addr[3];
579 bfd_getl32 (const void *p)
581 const bfd_byte *addr = p;
584 v = (unsigned long) addr[0];
585 v |= (unsigned long) addr[1] << 8;
586 v |= (unsigned long) addr[2] << 16;
587 v |= (unsigned long) addr[3] << 24;
592 bfd_getb_signed_32 (const void *p)
594 const bfd_byte *addr = p;
597 v = (unsigned long) addr[0] << 24;
598 v |= (unsigned long) addr[1] << 16;
599 v |= (unsigned long) addr[2] << 8;
600 v |= (unsigned long) addr[3];
605 bfd_getl_signed_32 (const void *p)
607 const bfd_byte *addr = p;
610 v = (unsigned long) addr[0];
611 v |= (unsigned long) addr[1] << 8;
612 v |= (unsigned long) addr[2] << 16;
613 v |= (unsigned long) addr[3] << 24;
618 bfd_getb64 (const void *p ATTRIBUTE_UNUSED)
620 #ifdef BFD_HOST_64_BIT
621 const bfd_byte *addr = p;
624 v = addr[0]; v <<= 8;
625 v |= addr[1]; v <<= 8;
626 v |= addr[2]; v <<= 8;
627 v |= addr[3]; v <<= 8;
628 v |= addr[4]; v <<= 8;
629 v |= addr[5]; v <<= 8;
630 v |= addr[6]; v <<= 8;
641 bfd_getl64 (const void *p ATTRIBUTE_UNUSED)
643 #ifdef BFD_HOST_64_BIT
644 const bfd_byte *addr = p;
647 v = addr[7]; v <<= 8;
648 v |= addr[6]; v <<= 8;
649 v |= addr[5]; v <<= 8;
650 v |= addr[4]; v <<= 8;
651 v |= addr[3]; v <<= 8;
652 v |= addr[2]; v <<= 8;
653 v |= addr[1]; v <<= 8;
665 bfd_getb_signed_64 (const void *p ATTRIBUTE_UNUSED)
667 #ifdef BFD_HOST_64_BIT
668 const bfd_byte *addr = p;
671 v = addr[0]; v <<= 8;
672 v |= addr[1]; v <<= 8;
673 v |= addr[2]; v <<= 8;
674 v |= addr[3]; v <<= 8;
675 v |= addr[4]; v <<= 8;
676 v |= addr[5]; v <<= 8;
677 v |= addr[6]; v <<= 8;
688 bfd_getl_signed_64 (const void *p ATTRIBUTE_UNUSED)
690 #ifdef BFD_HOST_64_BIT
691 const bfd_byte *addr = p;
694 v = addr[7]; v <<= 8;
695 v |= addr[6]; v <<= 8;
696 v |= addr[5]; v <<= 8;
697 v |= addr[4]; v <<= 8;
698 v |= addr[3]; v <<= 8;
699 v |= addr[2]; v <<= 8;
700 v |= addr[1]; v <<= 8;
711 bfd_putb32 (bfd_vma data, void *p)
714 addr[0] = (data >> 24) & 0xff;
715 addr[1] = (data >> 16) & 0xff;
716 addr[2] = (data >> 8) & 0xff;
717 addr[3] = data & 0xff;
721 bfd_putl32 (bfd_vma data, void *p)
724 addr[0] = data & 0xff;
725 addr[1] = (data >> 8) & 0xff;
726 addr[2] = (data >> 16) & 0xff;
727 addr[3] = (data >> 24) & 0xff;
731 bfd_putb64 (bfd_uint64_t data ATTRIBUTE_UNUSED, void *p ATTRIBUTE_UNUSED)
733 #ifdef BFD_HOST_64_BIT
735 addr[0] = (data >> (7*8)) & 0xff;
736 addr[1] = (data >> (6*8)) & 0xff;
737 addr[2] = (data >> (5*8)) & 0xff;
738 addr[3] = (data >> (4*8)) & 0xff;
739 addr[4] = (data >> (3*8)) & 0xff;
740 addr[5] = (data >> (2*8)) & 0xff;
741 addr[6] = (data >> (1*8)) & 0xff;
742 addr[7] = (data >> (0*8)) & 0xff;
749 bfd_putl64 (bfd_uint64_t data ATTRIBUTE_UNUSED, void *p ATTRIBUTE_UNUSED)
751 #ifdef BFD_HOST_64_BIT
753 addr[7] = (data >> (7*8)) & 0xff;
754 addr[6] = (data >> (6*8)) & 0xff;
755 addr[5] = (data >> (5*8)) & 0xff;
756 addr[4] = (data >> (4*8)) & 0xff;
757 addr[3] = (data >> (3*8)) & 0xff;
758 addr[2] = (data >> (2*8)) & 0xff;
759 addr[1] = (data >> (1*8)) & 0xff;
760 addr[0] = (data >> (0*8)) & 0xff;
767 bfd_put_bits (bfd_uint64_t data, void *p, int bits, bfd_boolean big_p)
777 for (i = 0; i < bytes; i++)
779 int index = big_p ? bytes - i - 1 : i;
781 addr[index] = data & 0xff;
787 bfd_get_bits (const void *p, int bits, bfd_boolean big_p)
789 const bfd_byte *addr = p;
799 for (i = 0; i < bytes; i++)
801 int index = big_p ? i : bytes - i - 1;
803 data = (data << 8) | addr[index];
809 /* Default implementation */
812 _bfd_generic_get_section_contents (bfd *abfd,
822 sz = section->rawsize ? section->rawsize : section->size;
823 if (offset + count < count
824 || offset + count > sz)
826 bfd_set_error (bfd_error_invalid_operation);
830 if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
831 || bfd_bread (location, count, abfd) != count)
838 _bfd_generic_get_section_contents_in_window
839 (bfd *abfd ATTRIBUTE_UNUSED,
840 sec_ptr section ATTRIBUTE_UNUSED,
841 bfd_window *w ATTRIBUTE_UNUSED,
842 file_ptr offset ATTRIBUTE_UNUSED,
843 bfd_size_type count ATTRIBUTE_UNUSED)
850 if (abfd->xvec->_bfd_get_section_contents
851 != _bfd_generic_get_section_contents)
853 /* We don't know what changes the bfd's get_section_contents
854 method may have to make. So punt trying to map the file
855 window, and let get_section_contents do its thing. */
856 /* @@ FIXME : If the internal window has a refcount of 1 and was
857 allocated with malloc instead of mmap, just reuse it. */
859 w->i = bfd_zmalloc (sizeof (bfd_window_internal));
862 w->i->data = bfd_malloc (count);
863 if (w->i->data == NULL)
871 w->size = w->i->size = count;
872 w->data = w->i->data;
873 return bfd_get_section_contents (abfd, section, w->data, offset, count);
875 sz = section->rawsize ? section->rawsize : section->size;
876 if (offset + count > sz
877 || ! bfd_get_file_window (abfd, section->filepos + offset, count, w,
886 /* This generic function can only be used in implementations where creating
887 NEW sections is disallowed. It is useful in patching existing sections
888 in read-write files, though. See other set_section_contents functions
889 to see why it doesn't work for new sections. */
891 _bfd_generic_set_section_contents (bfd *abfd,
893 const void *location,
900 if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
901 || bfd_bwrite (location, count, abfd) != count)
912 unsigned int bfd_log2 (bfd_vma x);
915 Return the log base 2 of the value supplied, rounded up. E.g., an
916 @var{x} of 1025 returns 11. A @var{x} of 0 returns 0.
922 unsigned int result = 0;
924 while ((x = (x >> 1)) != 0)
930 bfd_generic_is_local_label_name (bfd *abfd, const char *name)
932 char locals_prefix = (bfd_get_symbol_leading_char (abfd) == '_') ? 'L' : '.';
934 return name[0] == locals_prefix;
937 /* Can be used from / for bfd_merge_private_bfd_data to check that
938 endianness matches between input and output file. Returns
939 TRUE for a match, otherwise returns FALSE and emits an error. */
941 _bfd_generic_verify_endian_match (bfd *ibfd, bfd *obfd)
943 if (ibfd->xvec->byteorder != obfd->xvec->byteorder
944 && ibfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN
945 && obfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN)
949 if (bfd_big_endian (ibfd))
950 msg = _("%B: compiled for a big endian system and target is little endian");
952 msg = _("%B: compiled for a little endian system and target is big endian");
954 (*_bfd_error_handler) (msg, ibfd);
956 bfd_set_error (bfd_error_wrong_format);
963 /* Give a warning at runtime if someone compiles code which calls
967 warn_deprecated (const char *what,
972 /* Poor man's tracking of functions we've already warned about. */
973 static size_t mask = 0;
975 if (~(size_t) func & ~mask)
977 /* Note: separate sentences in order to allow
978 for translation into other languages. */
980 fprintf (stderr, _("Deprecated %s called at %s line %d in %s\n"),
981 what, file, line, func);
983 fprintf (stderr, _("Deprecated %s called\n"), what);
984 mask |= ~(size_t) func;
988 /* Helper function for reading uleb128 encoded data. */
991 read_unsigned_leb128 (bfd *abfd ATTRIBUTE_UNUSED,
993 unsigned int *bytes_read_ptr)
996 unsigned int num_read;
1005 byte = bfd_get_8 (abfd, buf);
1008 result |= (((bfd_vma) byte & 0x7f) << shift);
1011 while (byte & 0x80);
1012 *bytes_read_ptr = num_read;
1016 /* Helper function for reading sleb128 encoded data. */
1019 read_signed_leb128 (bfd *abfd ATTRIBUTE_UNUSED,
1021 unsigned int *bytes_read_ptr)
1025 unsigned int num_read;
1033 byte = bfd_get_8 (abfd, buf);
1036 result |= (((bfd_vma) byte & 0x7f) << shift);
1039 while (byte & 0x80);
1040 if (shift < 8 * sizeof (result) && (byte & 0x40))
1041 result |= (((bfd_vma) -1) << shift);
1042 *bytes_read_ptr = num_read;
1047 _bfd_generic_find_line (bfd *abfd ATTRIBUTE_UNUSED,
1048 asymbol **symbols ATTRIBUTE_UNUSED,
1049 asymbol *symbol ATTRIBUTE_UNUSED,
1050 const char **filename_ptr ATTRIBUTE_UNUSED,
1051 unsigned int *linenumber_ptr ATTRIBUTE_UNUSED)
1057 _bfd_generic_init_private_section_data (bfd *ibfd ATTRIBUTE_UNUSED,
1058 asection *isec ATTRIBUTE_UNUSED,
1059 bfd *obfd ATTRIBUTE_UNUSED,
1060 asection *osec ATTRIBUTE_UNUSED,
1061 struct bfd_link_info *link_info ATTRIBUTE_UNUSED)