This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: more sysroot support in the linker
- From: Nick Clifton <nickc at redhat dot com>
- To: Alexandre Oliva <aoliva at redhat dot com>
- Cc: binutils at sources dot redhat dot com
- Date: 24 Mar 2003 15:27:20 +0000
- Subject: Re: more sysroot support in the linker
- References: <orznnnwqun.fsf@free.redhat.lsd.ic.unicamp.br>
Hi Alex,
> Tested on athlon-pc-linux-gnu-x-mips64-linux-gnu. Ok to install?
>
> Index: ld/ChangeLog
> from Alexandre Oliva <aoliva at redhat dot com>
>
> * ldmain.h (ld_canon_sysroot, ld_canon_sysroot_len): Declare.
> * ldmain.c (ld_canon_sysroot, ld_canon_sysroot_len): Define.
> (main): Initialize them.
> * ldfile.c: Include pathnames.h.
> (is_sysrooted_pathname): New.
> (ldfile_add_library_path): Use it.
> (ldfile_open_file_search): Likewise. Use IS_ABSOLUTE_PATH. Don't
> search_dirs if given an absolute pathname.
> (ldfile_open_file): Issue error message for sysrooted
> absolute pathnames.
Sorry - the patch needs tidying up first.
There are two problems:
> +++ ld/ldfile.c 22 Mar 2003 11:55:01 -0000
> @@ -35,6 +35,7 @@ Software Foundation, 59 Temple Place - S
> #include "ldlex.h"
> #include "ldemul.h"
> #include "libiberty.h"
> +#include "filenames.h"
You are adding a new #include to ldfile.c but not updating Makefile.am
with the new dependency.
> +static bfd_boolean
> +is_sysrooted_pathname (name, notsame)
> + const char *name;
> + bfd_boolean notsame;
> +{
> + char *realname = ld_canon_sysroot ? lrealpath (name) : NULL;
> + int len;
> + bfd_boolean result;
> +
> + if (! realname)
> + return FALSE;
> +
> + if (((! notsame && len == ld_canon_sysroot_len)
> + || (len >= ld_canon_sysroot_len
> + && IS_DIR_SEPARATOR (realname[ld_canon_sysroot_len])
> + && (realname[ld_canon_sysroot_len] = '\0') == '\0'))
> + && FILENAME_CMP (ld_canon_sysroot, realname) == 0)
> + result = TRUE;
> + else
> + result = FALSE;
> +
> + if (realname)
> + free (realname);
> +
> + return result;
> +}
The variable 'len' is used without being initialised.
Cheers
Nick