[PATCH]: gold support for -Y and -relax
David Miller
davem@davemloft.net
Fri Apr 11 00:41:00 GMT 2008
GCC passes -Y and -relax to the linker on Sparc, so we
have to support this just to even run the testsuite.
For -Y I just made it preempt the default /lib:/usr/lib thing that
Global_options::finalize() is doing.
-relax just sets a boolean that we'll eventually test in the
target to decide whether to do relaxation optimizations or not.
2008-04-10 David S. Miller <davem@davemloft.net>
* options.h (General_options): Add entries for '-Y' and
'-relax'.
* options.cc (General_options::parse_Y): New.
(General_options:finalize): If default_dirlist is non-NULL,
add those entries to the library path instead of the
default "/lib" and "/usr/lib".
Index: options.cc
===================================================================
RCS file: /cvs/src/src/gold/options.cc,v
retrieving revision 1.68
diff -u -p -r1.68 options.cc
--- options.cc 9 Apr 2008 00:48:13 -0000 1.68
+++ options.cc 11 Apr 2008 00:01:37 -0000
@@ -294,6 +294,18 @@ General_options::parse_R(const char* opt
this->parse_just_symbols(option, arg, cmdline);
}
+static char *default_dirlist = NULL;
+
+void
+General_options::parse_Y(const char*, const char* arg, Command_line*)
+{
+ if (strncmp(arg, "P,", 2))
+ arg += 2;
+ if (default_dirlist)
+ free(default_dirlist);
+ default_dirlist = xstrdup(arg);
+}
+
void
General_options::parse_just_symbols(const char*, const char* arg,
Command_line* cmdline)
@@ -717,10 +729,30 @@ General_options::finalize()
program_name);
#endif
- // Even if they don't specify it, we add -L /lib and -L /usr/lib.
- // FIXME: We should only do this when configured in native mode.
- this->add_to_library_path_with_sysroot("/lib");
- this->add_to_library_path_with_sysroot("/usr/lib");
+ if (default_dirlist)
+ {
+ char *ptr = default_dirlist;
+
+ while (1)
+ {
+ char *p = strchr(ptr, ':');
+ if (p)
+ *p = '\0';
+ if (*ptr != '\0')
+ this->add_to_library_path_with_sysroot(ptr);
+ if (!p)
+ break;
+ ptr = p + 1;
+ }
+ free(default_dirlist);
+ }
+ else
+ {
+ // Even if they don't specify it, we add -L /lib and -L /usr/lib.
+ // FIXME: We should only do this when configured in native mode.
+ this->add_to_library_path_with_sysroot("/lib");
+ this->add_to_library_path_with_sysroot("/usr/lib");
+ }
// Normalize library_path() by adding the sysroot to all directories
// in the path, as appropriate.
Index: options.h
===================================================================
RCS file: /cvs/src/src/gold/options.h,v
retrieving revision 1.68
diff -u -p -r1.68 options.h
--- options.h 9 Apr 2008 01:19:09 -0000 1.68
+++ options.h 11 Apr 2008 00:01:37 -0000
@@ -535,6 +535,9 @@ class General_options
DEFINE_dirlist(library_path, options::TWO_DASHES, 'L',
N_("Add directory to search path"), N_("DIR"));
+ DEFINE_special(Y, options::EXACTLY_ONE_DASH, 'Y',
+ N_("Default search path for Solaris compatibility"), N_("PATH"));
+
DEFINE_string(m, options::EXACTLY_ONE_DASH, 'm', "",
N_("Ignored for compatibility"), N_("EMULATION"));
@@ -556,6 +559,9 @@ class General_options
DEFINE_bool(relocatable, options::EXACTLY_ONE_DASH, 'r', false,
N_("Generate relocatable output"), NULL);
+ DEFINE_bool(relax, options::TWO_DASHES, '\0', false,
+ N_("Relax branches on certain targets"), NULL);
+
// -R really means -rpath, but can mean --just-symbols for
// compatibility with GNU ld. -rpath is always -rpath, so we list
// it separately.
More information about the Binutils
mailing list