+2019-09-18 Alan Modra <amodra@gmail.com>
+
+ * bfd-in.h (carsym.name): Make const.
+ * reloc.c (struct reloc_howto_struct.name): Likewise.
+ * targets.c (bfd_target.name): Likewise.!
+ * bfd.c (bfd_get_sign_extend_vma): Make variable const.
+ * som.c (som_bfd_fill_in_ar_symbols): Use an intermediary variable
+ when setting carsym.name.
+ * bfd-in2.h: Regenerate.
+
2019-09-18 Alan Modra <amodra@gmail.com>
* mach-o.c (bfd_mach_o_fat_member_init): Likewise. Replace
/* This is a type pun with struct ranlib on purpose! */
typedef struct carsym
{
- char *name;
+ const char *name;
file_ptr file_offset; /* Look here to find the file. */
}
carsym; /* To make these you call a carsymogen. */
/* This is a type pun with struct ranlib on purpose! */
typedef struct carsym
{
- char *name;
+ const char *name;
file_ptr file_offset; /* Look here to find the file. */
}
carsym; /* To make these you call a carsymogen. */
bfd *, char **);
/* The textual name of the relocation type. */
- char *name;
+ const char *name;
};
#define HOWTO(type, right, size, bits, pcrel, left, ovf, func, name, \
typedef struct bfd_target
{
/* Identifies the kind of target, e.g., SunOS4, Ultrix, etc. */
- char *name;
+ const char *name;
/* The "flavour" of a back end is a general indication about
the contents of a file. */
int
bfd_get_sign_extend_vma (bfd *abfd)
{
- char *name;
+ const char *name;
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
return get_elf_backend_data (abfd)->sign_extend_vma;
. bfd *, char **);
.
. {* The textual name of the relocation type. *}
-. char *name;
+. const char *name;
.};
.
*/
unsigned int hash_val;
unsigned int len;
unsigned char ext_len[4];
+ char *name;
/* An empty chain has zero as it's file offset. */
hash_val = bfd_getb32 (hash_table + 4 * i);
len = bfd_getb32 (ext_len);
/* Allocate space for the name and null terminate it too. */
- set->name = bfd_zalloc (abfd, (bfd_size_type) len + 1);
- if (!set->name)
+ name = bfd_zalloc (abfd, (bfd_size_type) len + 1);
+ if (!name)
goto error_return;
- if (bfd_bread (set->name, (bfd_size_type) len, abfd) != len)
+ if (bfd_bread (name, (bfd_size_type) len, abfd) != len)
goto error_return;
- set->name[len] = 0;
+ name[len] = 0;
+ set->name = name;
/* Fill in the file offset. Note that the "location" field points
to the SOM itself, not the ar_hdr in front of it. */
len = bfd_getb32 (ext_len);
/* Allocate space for the name and null terminate it too. */
- set->name = bfd_zalloc (abfd, (bfd_size_type) len + 1);
- if (!set->name)
+ name = bfd_zalloc (abfd, (bfd_size_type) len + 1);
+ if (!name)
goto error_return;
- if (bfd_bread (set->name, (bfd_size_type) len, abfd) != len)
+ if (bfd_bread (name, (bfd_size_type) len, abfd) != len)
goto error_return;
- set->name[len] = 0;
+ name[len] = 0;
+ set->name = name;
/* Fill in the file offset. Note that the "location" field points
to the SOM itself, not the ar_hdr in front of it. */
.typedef struct bfd_target
.{
. {* Identifies the kind of target, e.g., SunOS4, Ultrix, etc. *}
-. char *name;
+. const char *name;
.
. {* The "flavour" of a back end is a general indication about
. the contents of a file. *}
+2019-09-18 Alan Modra <amodra@gmail.com>
+
+ * amd64-dicos-tdep.c (amd64_dicos_osabi_sniffer): Constify target.
+ * i386-cygwin-tdep.c (i386_cygwin_init_abi): Likewise.
+ * i386-dicos-tdep.c (i386_dicos_osabi_sniffer): Likewise.
+
2019-09-18 Alan Modra <amodra@gmail.com>
* solib-spu.c (spu_bfd_open): Use bfd_set_filename.
static enum gdb_osabi
amd64_dicos_osabi_sniffer (bfd *abfd)
{
- char *target_name = bfd_get_target (abfd);
+ const char *target_name = bfd_get_target (abfd);
/* On amd64-DICOS, the Load Module's "header" section is 72
bytes. */
static enum gdb_osabi
i386_cygwin_osabi_sniffer (bfd *abfd)
{
- char *target_name = bfd_get_target (abfd);
+ const char *target_name = bfd_get_target (abfd);
if (strcmp (target_name, "pei-i386") == 0)
return GDB_OSABI_CYGWIN;
static enum gdb_osabi
i386_dicos_osabi_sniffer (bfd *abfd)
{
- char *target_name = bfd_get_target (abfd);
+ const char *target_name = bfd_get_target (abfd);
/* On x86-DICOS, the Load Module's "header" section is 36 bytes. */
if (strcmp (target_name, "elf32-i386") == 0
+2019-09-18 Alan Modra <amodra@gmail.com>
+
+ * ldlang.c (stricpy, strcut, name_compare): Constify params.
+ (get_first_input_target): Make return and "target" const.
+
2019-09-18 Alan Modra <amodra@gmail.com>
* emultempl/pe.em (after_open): Use bfd_set_filename.
/* Like strcpy() but convert to lower case as well. */
static void
-stricpy (char *dest, char *src)
+stricpy (char *dest, const char *src)
{
char c;
from haystack. */
static void
-strcut (char *haystack, char *needle)
+strcut (char *haystack, const char *needle)
{
haystack = strstr (haystack, needle);
Return a value indicating how "similar" they are. */
static int
-name_compare (char *first, char *second)
+name_compare (const char *first, const char *second)
{
char *copy1;
char *copy2;
/* Return the BFD target format of the first input file. */
-static char *
+static const char *
get_first_input_target (void)
{
- char *target = NULL;
+ const char *target = NULL;
LANG_FOR_EACH_INPUT_STATEMENT (s)
{