From 26c61946fb633ecbe25126dfb5c600f09ccdc487 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Sat, 28 Mar 1998 21:54:33 +0000 Subject: [PATCH] Fix some gcc -Wall warnings: * ldcref.c (output_cref): Add casts to avoid warnings. * ldfile.c (ldfile_add_arch): Likewise. * ldlang.c (lang_leave_overlay_section): Likewise. * lexsup.c (OPTION_COUNT): Likewise. (parse_args): Likewise. * emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Likewise. * emultempl/sunos.em (gld${EMULATION_NAME}_search_dir): Likewise. * ldlang.c (lang_check): Initialize variables to avoid warnings. * ldwrite.c (build_link_order): Likewise. * emultempl/sunos.em (gld${EMULATION_NAME}_find_so): Likewise. * emultempl/armcoff.em (gld${EMULATION_NAME}_before_allocation): Remove unused variables. --- ld/ChangeLog | 21 +++++++++++++++++++++ ld/ldlang.c | 29 ++++++++++++++++++++++++----- 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 4a344b9aefb..c5dea9cb576 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,24 @@ +Sat Mar 28 16:48:19 1998 Ian Lance Taylor + + Fix some gcc -Wall warnings: + * ldcref.c (output_cref): Add casts to avoid warnings. + * ldfile.c (ldfile_add_arch): Likewise. + * ldlang.c (lang_leave_overlay_section): Likewise. + * lexsup.c (OPTION_COUNT): Likewise. + (parse_args): Likewise. + * emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): + Likewise. + * emultempl/sunos.em (gld${EMULATION_NAME}_search_dir): Likewise. + * ldlang.c (lang_check): Initialize variables to avoid warnings. + * ldwrite.c (build_link_order): Likewise. + * emultempl/sunos.em (gld${EMULATION_NAME}_find_so): Likewise. + * emultempl/armcoff.em (gld${EMULATION_NAME}_before_allocation): + Remove unused variables. + + * Makefile.am (MOSTLYCLEANFILES): Correct name (was + MOSTCLEANFILES). + * Makefile.in: Rebuild. + Fri Mar 27 16:39:25 1998 Ian Lance Taylor * emultempl/pe.em (gld_${EMULATION_NAME}_before_allocation): Put diff --git a/ld/ldlang.c b/ld/ldlang.c index b364f9dea07..6cdab2b1e71 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -1,5 +1,6 @@ /* Linker command language support. - Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. + Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 1998 + Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -471,7 +472,7 @@ lang_memory_default (section) flagword sec_flags = section->flags; /* Override SEC_DATA to mean a writable section. */ - if (sec_flags & (SEC_ALLOC | SEC_READONLY | SEC_CODE) == SEC_ALLOC) + if ((sec_flags & (SEC_ALLOC | SEC_READONLY | SEC_CODE)) == SEC_ALLOC) sec_flags |= SEC_DATA; for (p = lang_memory_region_list; @@ -2165,10 +2166,28 @@ lang_size_sections (s, output_section_statement, prev, fill, dot, relax) /* No address specified for this section, get one from the region specification */ - if (os->region == (lang_memory_region_type *) NULL) + if (os->region == (lang_memory_region_type *) NULL + || (((bfd_get_section_flags (output_bfd, os->bfd_section) + & (SEC_ALLOC | SEC_LOAD)) != 0) + && os->region->name[0] == '*' + && strcmp (os->region->name, "*default*") == 0)) { os->region = lang_memory_default (os->bfd_section); } + + /* If a loadable section is using the default memory + region, and some non default memory regions were + defined, issue a warning. */ + if ((bfd_get_section_flags (output_bfd, os->bfd_section) + & (SEC_ALLOC | SEC_LOAD)) != 0 + && ! link_info.relocateable + && strcmp (os->region->name, "*default*") == 0 + && lang_memory_region_list != NULL + && (strcmp (lang_memory_region_list->name, "*default*") != 0 + || lang_memory_region_list->next != NULL)) + einfo ("%P: warning: no memory region specified for section `%s'\n", + bfd_get_section_name (output_bfd, os->bfd_section)); + dot = os->region->current; if (os->section_alignment == -1) { @@ -2737,7 +2756,7 @@ lang_check () } else { - bfd_error_handler_type pfn; + bfd_error_handler_type pfn = NULL; /* If we aren't supposed to warn about mismatched input files, temporarily set the BFD error handler to a @@ -3893,7 +3912,7 @@ lang_leave_overlay_section (fill, phdrs) clean = xmalloc (strlen (name) + 1); s2 = clean; for (s1 = name; *s1 != '\0'; s1++) - if (isalnum (*s1) || *s1 == '_') + if (isalnum ((unsigned char) *s1) || *s1 == '_') *s2++ = *s1; *s2 = '\0'; -- 2.30.2