Ryan Oliver wrote:

Very quick patch attached.

Patch is there for you to have a play around with as a starting point...

(for upstream they may want lib_str to be
#define static const char lib_str[] { DIR_SEPARATOR, "lib", DIR_SEPARATOR, 0 }
somewhere at the top of gcc.c, possibly with "lib" replaced by a macro.
This dispenses with the xmalloc, concat and free.
Also they may not like the way I have done the strcmp, but hey, we aren't altering the contents of value...)

Getting anything accepted upstream generally has more chance when you have more than one person making the request... If there isn't really an accepted need more voices can generally push it up the priority level...

If you come up with something better and want to push it upstream (you have more chance as the original requester), I'll happily add my voice to the list.

Gah, I should know better than to think that anything I send home from lotus notes will come out sanely...

This time with readable patch attached
[R]


--- gcc-4.3.2/gcc/gcc.c-orig    2008-03-03 09:55:19.000000000 +1100
+++ gcc-4.3.2/gcc/gcc.c 2009-01-15 18:09:23.181213559 +1100
@@ -3824,6 +3824,8 @@
              {
                const char *value;
                int len;
+               char *lib_str;
+               int lib_str_len;
 
                if (p[1] == 0 && i + 1 == argc)
                  fatal ("argument to '-B' is missing");
@@ -3851,10 +3853,24 @@
                    value = tmp;
                  }
 
+               len = strlen (value);
+
+               /* Check to see if the user is specifying a library path.
+                  If so use OS multilib scheme */
+               lib_str = XNEWVEC(char, 6);
+               lib_str = concat (dir_separator_str, "lib", dir_separator_str,
+                                 NULL);
+               lib_str_len = strlen (lib_str);
+               if (len >= lib_str_len 
+                   && strcmp (&value[len - lib_str_len], lib_str) == 0 )
+                   add_prefix (&startfile_prefixes, value, NULL,
+                               PREFIX_PRIORITY_B_OPT, 0, 1);
+               else
+                   add_prefix (&startfile_prefixes, value, NULL,
+                               PREFIX_PRIORITY_B_OPT, 0, 0);
+               XDELETEVEC(lib_str);
                add_prefix (&exec_prefixes, value, NULL,
                            PREFIX_PRIORITY_B_OPT, 0, 0);
-               add_prefix (&startfile_prefixes, value, NULL,
-                           PREFIX_PRIORITY_B_OPT, 0, 0);
                add_prefix (&include_prefixes, value, NULL,
                            PREFIX_PRIORITY_B_OPT, 0, 0);
                n_switches++;

-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to