gnu/53476: [patch] gcc improperly handles GCC_EXEC_PREFIX (FreeBSD
specific)
Geoff Morrison
geoffcm at uclink.berkeley.edu
Wed Jun 18 19:40:17 PDT 2003
>Number: 53476
>Category: gnu
>Synopsis: [patch] gcc improperly handles GCC_EXEC_PREFIX (FreeBSD specific)
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Jun 18 19:40:14 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator: Geoff Morrison
>Release: FreeBSD 5.1-CURRENT i386
>Organization:
>Environment:
System: FreeBSD lt.dom 5.1-CURRENT FreeBSD 5.1-CURRENT #5: Tue Jun 17 07:23:48 PDT 2003 root at lt.dom:/usr/obj/usr/src/sys/LAPTOP i386
Sources from June 17 02:00 PDT
GCC version 3.2.2 [FreeBSD] 20030205 (release)
>Description:
gcc allows the user to specify an alternate location to search for
its subprograms (cpp, cc1, as, ld, and so on) by using the -B flag
to gcc or by setting the GCC_EXEC_PREFIX environment variable. The
manpage states that gcc uses the -B argument, then the GCC_EXEC_PREFIX
environment variable, then the standard prefixes. Internally, these
prefixes are added to exec_prefixes with the add_prefix function,
which takes a priority as an argument. For most invocations, this
argument is PREFIX_PRIORITY_LAST; for the invocation that uses the
-B flag, the priority is PREFIX_PRIORITY_B_OPT. In the FreeBSD
specific code that adds PREFIX/bin (normally /usr/bin) to exec_prefixes,
this argument is set to 0. This value is (1) bogus, since all other
invocations of add_prefix use one of the PREFIX_PRIORITY_* fields
(which are defined in enum path_prefix_priority); and (2) wrong,
since it causes /usr/bin to be searched before the value specified
in GCC_EXEC_PREFIX. The -B flag is handled correctly.
>How-To-Repeat:
gm at lt ~ % unset GCC_EXEC_PREFIX
gm at lt ~ % gcc --print-search-dirs
install: /usr/libexec/(null)
programs: =/usr/bin/:/usr/libexec/
libraries: =/usr/lib/
gm at lt ~ % GCC_EXEC_PREFIX=/tmp gcc --print-search-dirs
install: /usr/libexec/(null)
programs: =/usr/bin/:/tmp/:/usr/libexec/
libraries: =/tmp:/usr/lib/
The second invocation should read:
programs: =/tmp/:/usr/bin/:/usr/libexec/
>Fix:
Index: gcc.c
===================================================================
RCS file: /home/ncvs/src/contrib/gcc/gcc.c,v
retrieving revision 1.35
diff -u -r1.35 gcc.c
--- gcc.c 10 Feb 2003 06:03:16 -0000 1.35
+++ gcc.c 19 Jun 2003 01:05:46 -0000
@@ -3852,7 +3852,7 @@
as well as trying the machine and the version. */
#ifdef FREEBSD_NATIVE
add_prefix (&exec_prefixes, PREFIX"/bin/", "BINUTILS",
- 0, 0, warn_std_ptr, 0);
+ PREFIX_PRIORITY_LAST, 0, warn_std_ptr, 0);
#endif /* FREEBSD_NATIVE */
#ifndef OS2
add_prefix (&exec_prefixes, standard_exec_prefix, "GCC",
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list