This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] ld/ldlang.h: use 'etree_base' instead of 'base' to avoid cross-compiling warning

On Sat, May 24, 2014 at 07:34:49PM +0800, Chen Gang wrote:
> It is not recommend to use a simple name to express a global variable,
> for it is easy to get '-Wshadow'. So use 'etree_base' instead of.

Better, move base into mri.c.

    	* ldlang.c (base): Move variable to..
    	* mri.c:, and make static.
    	* ldlang.h (base): Delete declaration.

diff --git a/ld/ldlang.c b/ld/ldlang.c
index 7c076a2..b48a9b3 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -112,8 +112,6 @@ struct asneeded_minfo **asneeded_list_tail;
     DEFINED() need to increment this at the start of the traversal.  */
 int lang_statement_iteration = 0;
-etree_type *base; /* Relocation base - or null */
 /* Return TRUE if the PATTERN argument is a wildcard pattern.
    Although backslashes are treated specially if a pattern contains
    wildcards, we do not consider the mere presence of a backslash to
diff --git a/ld/ldlang.h b/ld/ldlang.h
index 47cc4df..7d69c56 100644
--- a/ld/ldlang.h
+++ b/ld/ldlang.h
@@ -505,7 +505,6 @@ extern lang_output_section_statement_type *abs_output_section;
 extern lang_statement_list_type lang_output_section_statement;
 extern struct lang_input_statement_flags input_flags;
 extern bfd_boolean lang_has_input_file;
-extern etree_type *base;
 extern lang_statement_list_type *stat_ptr;
 extern bfd_boolean delete_output_file_on_failure;
diff --git a/ld/mri.c b/ld/mri.c
index 6db22a6..70d4e02 100644
--- a/ld/mri.c
+++ b/ld/mri.c
@@ -44,6 +44,8 @@ struct section_name_struct {
 static unsigned int symbol_truncate = 10000;
+static etree_type *base; /* Relocation base - or null */
 static struct section_name_struct *order;
 static struct section_name_struct *only_load;
 static struct section_name_struct *address;

Alan Modra
Australia Development Lab, IBM

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]