From c7c3d11bead272b718bade379e3441ff239bbd16 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Fri, 17 Feb 2017 01:26:12 +0000 Subject: [PATCH] bfd: Rename real_{ftell, fseek, fopen} Give these bfd-internal symbols with external linkage a _bfd_ prefix to avoid collisions in the global symbol namespace. bfd/ChangeLog: 2017-02-17 Pedro Alves * bfdio.c (real_ftell): Rename to ... (_bfd_real_ftell): ... this. (real_fseek): Rename to ... (_bfd_real_fseek): ... this. (real_fopen): Rename to ... (_bfd_real_fopen): ... this. * libbfd-in.h (real_ftell): Rename to ... (_bfd_real_ftell): ... this. (real_fseek): Rename to ... (_bfd_real_fseek): ... this. (real_fopen): Rename to ... (_bfd_real_fopen): ... this. * cache.c, dwarf2.c, opncls.c: Adjust all callers. * libbfd.h: Regenerate. --- bfd/ChangeLog | 17 +++++++++++++++++ bfd/bfdio.c | 6 +++--- bfd/cache.c | 17 +++++++++-------- bfd/dwarf2.c | 3 ++- bfd/libbfd-in.h | 6 +++--- bfd/libbfd.h | 6 +++--- bfd/opncls.c | 8 ++++---- 7 files changed, 41 insertions(+), 22 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 34c9bb49e84..9b416ab4e34 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,20 @@ +2017-02-17 Pedro Alves + + * bfdio.c (real_ftell): Rename to ... + (_bfd_real_ftell): ... this. + (real_fseek): Rename to ... + (_bfd_real_fseek): ... this. + (real_fopen): Rename to ... + (_bfd_real_fopen): ... this. + * libbfd-in.h (real_ftell): Rename to ... + (_bfd_real_ftell): ... this. + (real_fseek): Rename to ... + (_bfd_real_fseek): ... this. + (real_fopen): Rename to ... + (_bfd_real_fopen): ... this. + * cache.c, dwarf2.c, opncls.c: Adjust all callers. + * libbfd.h: Regenerate. + 2017-02-17 Pedro Alves * dwarf2.c, elf-attrs.c, elf32-nds32.c: Adjust all callers. diff --git a/bfd/bfdio.c b/bfd/bfdio.c index e73acdf6129..792ccdab923 100644 --- a/bfd/bfdio.c +++ b/bfd/bfdio.c @@ -41,7 +41,7 @@ #endif file_ptr -real_ftell (FILE *file) +_bfd_real_ftell (FILE *file) { #if defined (HAVE_FTELLO64) return ftello64 (file); @@ -53,7 +53,7 @@ real_ftell (FILE *file) } int -real_fseek (FILE *file, file_ptr offset, int whence) +_bfd_real_fseek (FILE *file, file_ptr offset, int whence) { #if defined (HAVE_FSEEKO64) return fseeko64 (file, offset, whence); @@ -82,7 +82,7 @@ close_on_exec (FILE *file) } FILE * -real_fopen (const char *filename, const char *modes) +_bfd_real_fopen (const char *filename, const char *modes) { #ifdef VMS char *vms_attr; diff --git a/bfd/cache.c b/bfd/cache.c index 0f8a9d1bef9..17bca8ba85d 100644 --- a/bfd/cache.c +++ b/bfd/cache.c @@ -212,7 +212,7 @@ close_one (void) return TRUE; } - to_kill->where = real_ftell ((FILE *) to_kill->iostream); + to_kill->where = _bfd_real_ftell ((FILE *) to_kill->iostream); return bfd_cache_delete (to_kill); } @@ -262,7 +262,8 @@ bfd_cache_lookup_worker (bfd *abfd, enum cache_flag flag) if (bfd_open_file (abfd) == NULL) ; else if (!(flag & CACHE_NO_SEEK) - && real_fseek ((FILE *) abfd->iostream, abfd->where, SEEK_SET) != 0 + && _bfd_real_fseek ((FILE *) abfd->iostream, + abfd->where, SEEK_SET) != 0 && !(flag & CACHE_NO_SEEK_ERROR)) bfd_set_error (bfd_error_system_call); else @@ -280,7 +281,7 @@ cache_btell (struct bfd *abfd) FILE *f = bfd_cache_lookup (abfd, CACHE_NO_OPEN); if (f == NULL) return abfd->where; - return real_ftell (f); + return _bfd_real_ftell (f); } static int @@ -289,7 +290,7 @@ cache_bseek (struct bfd *abfd, file_ptr offset, int whence) FILE *f = bfd_cache_lookup (abfd, whence != SEEK_CUR ? CACHE_NO_SEEK : CACHE_NORMAL); if (f == NULL) return -1; - return real_fseek (f, offset, whence); + return _bfd_real_fseek (f, offset, whence); } /* Note that archive entries don't have streams; they share their parent's. @@ -609,15 +610,15 @@ bfd_open_file (bfd *abfd) { case read_direction: case no_direction: - abfd->iostream = real_fopen (abfd->filename, FOPEN_RB); + abfd->iostream = _bfd_real_fopen (abfd->filename, FOPEN_RB); break; case both_direction: case write_direction: if (abfd->opened_once) { - abfd->iostream = real_fopen (abfd->filename, FOPEN_RUB); + abfd->iostream = _bfd_real_fopen (abfd->filename, FOPEN_RUB); if (abfd->iostream == NULL) - abfd->iostream = real_fopen (abfd->filename, FOPEN_WUB); + abfd->iostream = _bfd_real_fopen (abfd->filename, FOPEN_WUB); } else { @@ -647,7 +648,7 @@ bfd_open_file (bfd *abfd) if (stat (abfd->filename, &s) == 0 && s.st_size != 0) unlink_if_ordinary (abfd->filename); #endif - abfd->iostream = real_fopen (abfd->filename, FOPEN_WUB); + abfd->iostream = _bfd_real_fopen (abfd->filename, FOPEN_WUB); abfd->opened_once = TRUE; } break; diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index 25a9ebce737..722ee0d9f55 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -906,7 +906,8 @@ read_abbrevs (bfd *abfd, bfd_uint64_t offset, struct dwarf2_debug *stash) abbrev_ptr = stash->dwarf_abbrev_buffer + offset; abbrev_end = stash->dwarf_abbrev_buffer + stash->dwarf_abbrev_size; - abbrev_number = safe_read_leb128 (abfd, abbrev_ptr, &bytes_read, FALSE, abbrev_end); + abbrev_number = _bfd_safe_read_leb128 (abfd, abbrev_ptr, &bytes_read, + FALSE, abbrev_end); abbrev_ptr += bytes_read; /* Loop until we reach an abbrev number of 0. */ diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index 2776d627000..99251e24635 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -782,9 +782,9 @@ extern void _bfd_abort /* Manipulate a system FILE but using BFD's "file_ptr", rather than the system "off_t" or "off64_t", as the offset. */ -extern file_ptr real_ftell (FILE *file); -extern int real_fseek (FILE *file, file_ptr offset, int whence); -extern FILE *real_fopen (const char *filename, const char *modes); +extern file_ptr _bfd_real_ftell (FILE *file); +extern int _bfd_real_fseek (FILE *file, file_ptr offset, int whence); +extern FILE *_bfd_real_fopen (const char *filename, const char *modes); /* List of supported target vectors, and the default vector (if bfd_default_vector[0] is NULL, there is no default). */ diff --git a/bfd/libbfd.h b/bfd/libbfd.h index 3ea747d2be3..f19b0db7ff8 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -787,9 +787,9 @@ extern void _bfd_abort /* Manipulate a system FILE but using BFD's "file_ptr", rather than the system "off_t" or "off64_t", as the offset. */ -extern file_ptr real_ftell (FILE *file); -extern int real_fseek (FILE *file, file_ptr offset, int whence); -extern FILE *real_fopen (const char *filename, const char *modes); +extern file_ptr _bfd_real_ftell (FILE *file); +extern int _bfd_real_fseek (FILE *file, file_ptr offset, int whence); +extern FILE *_bfd_real_fopen (const char *filename, const char *modes); /* List of supported target vectors, and the default vector (if bfd_default_vector[0] is NULL, there is no default). */ diff --git a/bfd/opncls.c b/bfd/opncls.c index b4d4dcf6464..2ab7dfec9c8 100644 --- a/bfd/opncls.c +++ b/bfd/opncls.c @@ -219,7 +219,7 @@ bfd_fopen (const char *filename, const char *target, const char *mode, int fd) nbfd->iostream = fdopen (fd, mode); else #endif - nbfd->iostream = real_fopen (filename, mode); + nbfd->iostream = _bfd_real_fopen (filename, mode); if (nbfd->iostream == NULL) { bfd_set_error (bfd_error_system_call); @@ -1288,7 +1288,7 @@ separate_debug_file_exists (const char *name, const unsigned long crc) BFD_ASSERT (name); - f = real_fopen (name, FOPEN_RB); + f = _bfd_real_fopen (name, FOPEN_RB); if (f == NULL) return FALSE; @@ -1321,7 +1321,7 @@ separate_alt_debug_file_exists (const char *name, BFD_ASSERT (name); - f = real_fopen (name, FOPEN_RB); + f = _bfd_real_fopen (name, FOPEN_RB); if (f == NULL) return FALSE; @@ -1704,7 +1704,7 @@ bfd_fill_in_gnu_debuglink_section (bfd *abfd, .gnu_debuglink section, we insist upon the user providing us with a correct-for-section-creation-time path, but this need not conform to the gdb location algorithm. */ - handle = real_fopen (filename, FOPEN_RB); + handle = _bfd_real_fopen (filename, FOPEN_RB); if (handle == NULL) { bfd_set_error (bfd_error_system_call); -- 2.30.2