2010-11-22 05:27:15 +08:00
|
|
|
|
/* elfcomm.h -- include file of common code for ELF format file.
|
2022-01-02 06:30:17 +08:00
|
|
|
|
Copyright (C) 2010-2022 Free Software Foundation, Inc.
|
2010-11-22 05:27:15 +08:00
|
|
|
|
|
|
|
|
|
Originally developed by Eric Youngdale <eric@andante.jic.com>
|
|
|
|
|
Modifications by Nick Clifton <nickc@redhat.com>
|
|
|
|
|
|
|
|
|
|
This file is part of GNU Binutils.
|
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
|
|
|
|
|
02110-1301, USA. */
|
|
|
|
|
|
|
|
|
|
#ifndef _ELFCOMM_H
|
|
|
|
|
#define _ELFCOMM_H
|
|
|
|
|
|
|
|
|
|
#include "aout/ar.h"
|
|
|
|
|
|
2020-05-05 23:16:03 +08:00
|
|
|
|
extern void error (const char *, ...) ATTRIBUTE_PRINTF_1;
|
|
|
|
|
extern void warn (const char *, ...) ATTRIBUTE_PRINTF_1;
|
2010-11-22 05:27:15 +08:00
|
|
|
|
|
|
|
|
|
typedef unsigned HOST_WIDEST_INT elf_vma;
|
|
|
|
|
|
SAFE_BYTE_GET64
Functions dealing with lack of a 64-bit integer type can disappear now
that we require C99. Printing using dwarf_vmatoa is better too.
binutils/
* dwarf.c (dwarf_vmatoa64, SAFE_BYTE_GET64, add64): Delete.
(skip_attr_bytes): Replace use of SAFE_BYTE_GET64 with
SAFE_BYTE_GET_AND_INC.
(read_and_display_attr_value): Likewise. Print using dwarf_vmatoa.
(process_debug_info, process_cu_tu_index): Likewise.
* elfcomm.c (byte_put, byte_put_little_endian, byte_put_big_endian),
(byte_get, byte_get_little_endian, byte_get_big_endian),
(byte_get_signed): Make size param unsigned. Remove code dealing
with 4-byte elf_vma.
(byte_get_64): Delete.
* elfcomm.h (byte_put, byte_put_little_endian, byte_put_big_endian),
(byte_get, byte_get_little_endian, byte_get_big_endian),
(byte_get_signed): Update prototypes.
(byte_get_64): Delete.
gas/
* testsuite/gas/elf/dwarf-5-file0.d: Update.
* testsuite/gas/i386/dwarf5-line-1.d: Update.
2021-05-12 16:18:13 +08:00
|
|
|
|
extern void (*byte_put) (unsigned char *, elf_vma, unsigned int);
|
|
|
|
|
extern void byte_put_little_endian (unsigned char *, elf_vma, unsigned int);
|
|
|
|
|
extern void byte_put_big_endian (unsigned char *, elf_vma, unsigned int);
|
|
|
|
|
|
|
|
|
|
extern elf_vma (*byte_get) (const unsigned char *, unsigned int);
|
|
|
|
|
extern elf_vma byte_get_signed (const unsigned char *, unsigned int);
|
|
|
|
|
extern elf_vma byte_get_little_endian (const unsigned char *, unsigned int);
|
|
|
|
|
extern elf_vma byte_get_big_endian (const unsigned char *, unsigned int);
|
2010-11-22 05:27:15 +08:00
|
|
|
|
|
|
|
|
|
#define BYTE_PUT(field, val) byte_put (field, val, sizeof (field))
|
|
|
|
|
#define BYTE_GET(field) byte_get (field, sizeof (field))
|
|
|
|
|
#define BYTE_GET_SIGNED(field) byte_get_signed (field, sizeof (field))
|
|
|
|
|
|
|
|
|
|
/* This is just a bit of syntatic sugar. */
|
|
|
|
|
#define streq(a,b) (strcmp ((a), (b)) == 0)
|
|
|
|
|
|
|
|
|
|
/* Structure to hold information about an archive file. */
|
|
|
|
|
|
|
|
|
|
struct archive_info
|
|
|
|
|
{
|
|
|
|
|
char * file_name; /* Archive file name. */
|
|
|
|
|
FILE * file; /* Open file descriptor. */
|
2012-07-18 00:29:36 +08:00
|
|
|
|
elf_vma index_num; /* Number of symbols in table. */
|
|
|
|
|
elf_vma * index_array; /* The array of member offsets. */
|
2010-11-22 05:27:15 +08:00
|
|
|
|
char * sym_table; /* The symbol table. */
|
|
|
|
|
unsigned long sym_size; /* Size of the symbol table. */
|
|
|
|
|
char * longnames; /* The long file names table. */
|
|
|
|
|
unsigned long longnames_size; /* Size of the long file names table. */
|
|
|
|
|
unsigned long nested_member_origin; /* Origin in the nested archive of the current member. */
|
|
|
|
|
unsigned long next_arhdr_offset; /* Offset of the next archive header. */
|
2020-03-19 13:03:03 +08:00
|
|
|
|
int is_thin_archive; /* 1 if this is a thin archive. */
|
|
|
|
|
int uses_64bit_indices; /* 1 if the index table uses 64bit entries. */
|
2010-11-22 05:27:15 +08:00
|
|
|
|
struct ar_hdr arhdr; /* Current archive header. */
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Return the path name for a proxy entry in a thin archive. */
|
2014-12-01 19:19:39 +08:00
|
|
|
|
extern char *adjust_relative_path (const char *, const char *, unsigned long);
|
2010-11-22 05:27:15 +08:00
|
|
|
|
|
|
|
|
|
/* Read the symbol table and long-name table from an archive. */
|
|
|
|
|
extern int setup_archive (struct archive_info *, const char *, FILE *,
|
2020-03-19 13:03:03 +08:00
|
|
|
|
off_t, int, int);
|
2010-11-22 05:27:15 +08:00
|
|
|
|
|
|
|
|
|
/* Open and setup a nested archive, if not already open. */
|
|
|
|
|
extern int setup_nested_archive (struct archive_info *, const char *);
|
|
|
|
|
|
|
|
|
|
/* Release the memory used for the archive information. */
|
|
|
|
|
extern void release_archive (struct archive_info *);
|
|
|
|
|
|
|
|
|
|
/* Get the name of an archive member from the current archive header. */
|
|
|
|
|
|
|
|
|
|
extern char *get_archive_member_name (struct archive_info *,
|
|
|
|
|
struct archive_info *);
|
|
|
|
|
|
|
|
|
|
/* Get the name of an archive member at a given offset within an
|
|
|
|
|
archive. */
|
|
|
|
|
|
|
|
|
|
extern char *get_archive_member_name_at (struct archive_info *,
|
|
|
|
|
unsigned long,
|
|
|
|
|
struct archive_info *);
|
|
|
|
|
|
|
|
|
|
/* Construct a string showing the name of the archive member, qualified
|
|
|
|
|
with the name of the containing archive file. */
|
|
|
|
|
|
|
|
|
|
extern char *make_qualified_name (struct archive_info *,
|
|
|
|
|
struct archive_info *,
|
|
|
|
|
const char *);
|
|
|
|
|
|
|
|
|
|
#endif /* _ELFCOMM_H */
|