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  <palves@redhat.com>

	* 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.
This commit is contained in:
Pedro Alves 2017-02-17 01:26:12 +00:00
parent 4265548c65
commit c7c3d11bea
7 changed files with 41 additions and 22 deletions

View file

@ -1,3 +1,20 @@
2017-02-17 Pedro Alves <palves@redhat.com>
* 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 <palves@redhat.com> 2017-02-17 Pedro Alves <palves@redhat.com>
* dwarf2.c, elf-attrs.c, elf32-nds32.c: Adjust all callers. * dwarf2.c, elf-attrs.c, elf32-nds32.c: Adjust all callers.

View file

@ -41,7 +41,7 @@
#endif #endif
file_ptr file_ptr
real_ftell (FILE *file) _bfd_real_ftell (FILE *file)
{ {
#if defined (HAVE_FTELLO64) #if defined (HAVE_FTELLO64)
return ftello64 (file); return ftello64 (file);
@ -53,7 +53,7 @@ real_ftell (FILE *file)
} }
int int
real_fseek (FILE *file, file_ptr offset, int whence) _bfd_real_fseek (FILE *file, file_ptr offset, int whence)
{ {
#if defined (HAVE_FSEEKO64) #if defined (HAVE_FSEEKO64)
return fseeko64 (file, offset, whence); return fseeko64 (file, offset, whence);
@ -82,7 +82,7 @@ close_on_exec (FILE *file)
} }
FILE * FILE *
real_fopen (const char *filename, const char *modes) _bfd_real_fopen (const char *filename, const char *modes)
{ {
#ifdef VMS #ifdef VMS
char *vms_attr; char *vms_attr;

View file

@ -212,7 +212,7 @@ close_one (void)
return TRUE; 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); 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) if (bfd_open_file (abfd) == NULL)
; ;
else if (!(flag & CACHE_NO_SEEK) 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)) && !(flag & CACHE_NO_SEEK_ERROR))
bfd_set_error (bfd_error_system_call); bfd_set_error (bfd_error_system_call);
else else
@ -280,7 +281,7 @@ cache_btell (struct bfd *abfd)
FILE *f = bfd_cache_lookup (abfd, CACHE_NO_OPEN); FILE *f = bfd_cache_lookup (abfd, CACHE_NO_OPEN);
if (f == NULL) if (f == NULL)
return abfd->where; return abfd->where;
return real_ftell (f); return _bfd_real_ftell (f);
} }
static int 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); FILE *f = bfd_cache_lookup (abfd, whence != SEEK_CUR ? CACHE_NO_SEEK : CACHE_NORMAL);
if (f == NULL) if (f == NULL)
return -1; 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. /* 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 read_direction:
case no_direction: case no_direction:
abfd->iostream = real_fopen (abfd->filename, FOPEN_RB); abfd->iostream = _bfd_real_fopen (abfd->filename, FOPEN_RB);
break; break;
case both_direction: case both_direction:
case write_direction: case write_direction:
if (abfd->opened_once) 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) if (abfd->iostream == NULL)
abfd->iostream = real_fopen (abfd->filename, FOPEN_WUB); abfd->iostream = _bfd_real_fopen (abfd->filename, FOPEN_WUB);
} }
else else
{ {
@ -647,7 +648,7 @@ bfd_open_file (bfd *abfd)
if (stat (abfd->filename, &s) == 0 && s.st_size != 0) if (stat (abfd->filename, &s) == 0 && s.st_size != 0)
unlink_if_ordinary (abfd->filename); unlink_if_ordinary (abfd->filename);
#endif #endif
abfd->iostream = real_fopen (abfd->filename, FOPEN_WUB); abfd->iostream = _bfd_real_fopen (abfd->filename, FOPEN_WUB);
abfd->opened_once = TRUE; abfd->opened_once = TRUE;
} }
break; break;

View file

@ -906,7 +906,8 @@ read_abbrevs (bfd *abfd, bfd_uint64_t offset, struct dwarf2_debug *stash)
abbrev_ptr = stash->dwarf_abbrev_buffer + offset; abbrev_ptr = stash->dwarf_abbrev_buffer + offset;
abbrev_end = stash->dwarf_abbrev_buffer + stash->dwarf_abbrev_size; 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; abbrev_ptr += bytes_read;
/* Loop until we reach an abbrev number of 0. */ /* Loop until we reach an abbrev number of 0. */

View file

@ -782,9 +782,9 @@ extern void _bfd_abort
/* Manipulate a system FILE but using BFD's "file_ptr", rather than /* Manipulate a system FILE but using BFD's "file_ptr", rather than
the system "off_t" or "off64_t", as the offset. */ the system "off_t" or "off64_t", as the offset. */
extern file_ptr real_ftell (FILE *file); extern file_ptr _bfd_real_ftell (FILE *file);
extern int real_fseek (FILE *file, file_ptr offset, int whence); extern int _bfd_real_fseek (FILE *file, file_ptr offset, int whence);
extern FILE *real_fopen (const char *filename, const char *modes); extern FILE *_bfd_real_fopen (const char *filename, const char *modes);
/* List of supported target vectors, and the default vector (if /* List of supported target vectors, and the default vector (if
bfd_default_vector[0] is NULL, there is no default). */ bfd_default_vector[0] is NULL, there is no default). */

View file

@ -787,9 +787,9 @@ extern void _bfd_abort
/* Manipulate a system FILE but using BFD's "file_ptr", rather than /* Manipulate a system FILE but using BFD's "file_ptr", rather than
the system "off_t" or "off64_t", as the offset. */ the system "off_t" or "off64_t", as the offset. */
extern file_ptr real_ftell (FILE *file); extern file_ptr _bfd_real_ftell (FILE *file);
extern int real_fseek (FILE *file, file_ptr offset, int whence); extern int _bfd_real_fseek (FILE *file, file_ptr offset, int whence);
extern FILE *real_fopen (const char *filename, const char *modes); extern FILE *_bfd_real_fopen (const char *filename, const char *modes);
/* List of supported target vectors, and the default vector (if /* List of supported target vectors, and the default vector (if
bfd_default_vector[0] is NULL, there is no default). */ bfd_default_vector[0] is NULL, there is no default). */

View file

@ -219,7 +219,7 @@ bfd_fopen (const char *filename, const char *target, const char *mode, int fd)
nbfd->iostream = fdopen (fd, mode); nbfd->iostream = fdopen (fd, mode);
else else
#endif #endif
nbfd->iostream = real_fopen (filename, mode); nbfd->iostream = _bfd_real_fopen (filename, mode);
if (nbfd->iostream == NULL) if (nbfd->iostream == NULL)
{ {
bfd_set_error (bfd_error_system_call); 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); BFD_ASSERT (name);
f = real_fopen (name, FOPEN_RB); f = _bfd_real_fopen (name, FOPEN_RB);
if (f == NULL) if (f == NULL)
return FALSE; return FALSE;
@ -1321,7 +1321,7 @@ separate_alt_debug_file_exists (const char *name,
BFD_ASSERT (name); BFD_ASSERT (name);
f = real_fopen (name, FOPEN_RB); f = _bfd_real_fopen (name, FOPEN_RB);
if (f == NULL) if (f == NULL)
return FALSE; 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 .gnu_debuglink section, we insist upon the user providing us with a
correct-for-section-creation-time path, but this need not conform to correct-for-section-creation-time path, but this need not conform to
the gdb location algorithm. */ the gdb location algorithm. */
handle = real_fopen (filename, FOPEN_RB); handle = _bfd_real_fopen (filename, FOPEN_RB);
if (handle == NULL) if (handle == NULL)
{ {
bfd_set_error (bfd_error_system_call); bfd_set_error (bfd_error_system_call);