diff options
author | Andi Kleen <ak@linux.intel.com> | 2014-09-01 16:41:17 +0000 |
---|---|---|
committer | Andi Kleen <ak@gcc.gnu.org> | 2014-09-01 16:41:17 +0000 |
commit | b5617e5f69bdd5ad7a3da9b34d1871fb2aff940a (patch) | |
tree | 002ff8316f4430d4d2d699fc668daaa5256ff01a /gcc/file-find.c | |
parent | fc4f981d25a2b03e6c15303d531c272689c71187 (diff) | |
download | gcc-b5617e5f69bdd5ad7a3da9b34d1871fb2aff940a.zip gcc-b5617e5f69bdd5ad7a3da9b34d1871fb2aff940a.tar.gz gcc-b5617e5f69bdd5ad7a3da9b34d1871fb2aff940a.tar.bz2 |
Add -B support to gcc-ar/ranlib/nm
To use gcc-{ar,ranlib} for boot strap we need to add a -B option
to the tool. Since ar has weird and unusual argument conventions
implement the code by hand instead of using any libraries.
gcc/:
2014-09-01 Andi Kleen <ak@linux.intel.com>
* file-find.c (add_prefix_begin): Add.
(do_add_prefix): Rename from add_prefix with first argument.
(add_prefix): Add new wrapper.
* file-find.h (add_prefix_begin): Add.
* gcc-ar.c (main): Support -B option.
From-SVN: r214800
Diffstat (limited to 'gcc/file-find.c')
-rw-r--r-- | gcc/file-find.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/gcc/file-find.c b/gcc/file-find.c index 87d486d..be608b2 100644 --- a/gcc/file-find.c +++ b/gcc/file-find.c @@ -105,15 +105,16 @@ find_a_file (struct path_prefix *pprefix, const char *name, int mode) return 0; } -/* Add an entry for PREFIX to prefix list PPREFIX. */ +/* Add an entry for PREFIX to prefix list PREFIX. + Add at beginning if FIRST is true. */ void -add_prefix (struct path_prefix *pprefix, const char *prefix) +do_add_prefix (struct path_prefix *pprefix, const char *prefix, bool first) { struct prefix_list *pl, **prev; int len; - if (pprefix->plist) + if (pprefix->plist && !first) { for (pl = pprefix->plist; pl->next; pl = pl->next) ; @@ -138,6 +139,22 @@ add_prefix (struct path_prefix *pprefix, const char *prefix) *prev = pl; } +/* Add an entry for PREFIX at the end of prefix list PREFIX. */ + +void +add_prefix (struct path_prefix *pprefix, const char *prefix) +{ + do_add_prefix (pprefix, prefix, false); +} + +/* Add an entry for PREFIX at the begin of prefix list PREFIX. */ + +void +add_prefix_begin (struct path_prefix *pprefix, const char *prefix) +{ + do_add_prefix (pprefix, prefix, true); +} + /* Take the value of the environment variable ENV, break it into a path, and add of the entries to PPREFIX. */ |