aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-09-06 12:07:05 +0930
committerAlan Modra <amodra@gmail.com>2019-09-06 12:22:59 +0930
commitb16c44debcf8a446e94e161e328169f5c8d5d811 (patch)
treef402c08e8f7fc00a404055e36c416580377f1b3a /ld
parent6ade8373c9e689dece1057366b5adf9f8e86fa22 (diff)
downloadgdb-b16c44debcf8a446e94e161e328169f5c8d5d811.zip
gdb-b16c44debcf8a446e94e161e328169f5c8d5d811.tar.gz
gdb-b16c44debcf8a446e94e161e328169f5c8d5d811.tar.bz2
bfd_get_filename
This macro says: /* Cast from const char * to char * so that caller can assign to a char * without a warning. */ I reckon that isn't such a good idea since it can result in char* variables where const char* is appropriate. Not very many places need the char* cast. bfd/ * aout-target.h (object_p): Formatting. * bfd-in.h (bfd_get_filename): Don't cast to char*. * corefile.c (generic_core_file_matches_executable_p): Constify variables and remove cast. * bfd-in2.h: Regenerate. binutils/ * nm.c (print_object_filename_bsd, print_object_filename_sysv), (print_object_filename_posix, print_archive_filename_bsd), (print_archive_filename_sysv, print_archive_filename_posix), (print_archive_member_bsd, print_archive_member_sysv), (print_archive_member_posix): Constify parameter. (struct output_fns <print_object_filename, print_archive_filename>), (<print_archive_member>): Likewise. * objcopy.c (copy_archive): Add cast for make_tempdir. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_search_needed): Constify variable. * emultempl/pe.em (gld_${EMULATION_NAME}_after_open): Likewise. * emultempl/pep.em (gld_${EMULATION_NAME}_after_open): Likewise. gdb/ * coffread.c (coff_symfile_read): Constify filename variable. * dbxread.c (dbx_symfile_init, coffstab_build_psymtabs), (elfstab_build_psymtabs, stabsect_build_psymtabs): Likewise. * gdb_bfd.c (gdb_bfd_close_or_warn): Likewise. * solib.c (reload_shared_libraries_1): Likewise. * symfile.c (reread_symbols): Likewise. * solib-aix.c (solib_aix_bfd_open): Add cast for xfree of filename. * solib-darwin.c (darwin_bfd_open): Likewise. * symfile-mem.c (symbol_file_add_from_memory): Likewise. sim/cris/ * sim-if.c (sim_open): Constify filename variable.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog7
-rw-r--r--ld/emultempl/elf32.em2
-rw-r--r--ld/emultempl/pe.em2
-rw-r--r--ld/emultempl/pep.em2
4 files changed, 10 insertions, 3 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 37836aa..13abd72 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,10 @@
+2019-09-06 Alan Modra <amodra@gmail.com>
+
+ * emultempl/elf32.em (gld${EMULATION_NAME}_search_needed): Constify
+ variable.
+ * emultempl/pe.em (gld_${EMULATION_NAME}_after_open): Likewise.
+ * emultempl/pep.em (gld_${EMULATION_NAME}_after_open): Likewise.
+
2019-09-05 Eric Botcazou <ebotcazou@adacore.com>
PR ld/24574
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index b3c012c..52db0fd 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -552,7 +552,7 @@ gld${EMULATION_NAME}_search_needed (const char *path,
FIXME: The code could be a lot cleverer about allocating space
for the processed string. */
char * end = strchr (var, '/');
- char * replacement = NULL;
+ const char *replacement = NULL;
char * v = var + 1;
char * freeme = NULL;
unsigned flen = strlen (filename);
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index 834215a..49bb66b 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -1513,7 +1513,7 @@ gld_${EMULATION_NAME}_after_open (void)
{
struct bfd_symbol *s;
struct bfd_link_hash_entry * blhe;
- char *other_bfd_filename;
+ const char *other_bfd_filename;
char *n;
s = (relocs[i]->sym_ptr_ptr)[0];
diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em
index 9eb7cd7..4daa32b 100644
--- a/ld/emultempl/pep.em
+++ b/ld/emultempl/pep.em
@@ -1480,7 +1480,7 @@ gld_${EMULATION_NAME}_after_open (void)
{
struct bfd_symbol *s;
struct bfd_link_hash_entry * blhe;
- char *other_bfd_filename;
+ const char *other_bfd_filename;
char *n;
s = (relocs[i]->sym_ptr_ptr)[0];