This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [RESEND][PATCH] ld: -rpath must search under sysroot
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Andy Ross <andy dot ross at windriver dot com>
- Cc: <binutils at sourceware dot org>
- Date: Fri, 7 Sep 2012 21:31:10 +0000
- Subject: Re: [RESEND][PATCH] ld: -rpath must search under sysroot
- References: <1346949467-6565-1-git-send-email-andy.ross@windriver.com>
On Thu, 6 Sep 2012, Andy Ross wrote:
> diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
> index de51050..35e0e7e 100644
> --- a/ld/emultempl/elf32.em
> +++ b/ld/emultempl/elf32.em
> @@ -1263,9 +1263,13 @@ fragment <<EOF
> EOF
> if [ "x${USE_LIBPATH}" = xyes ] ; then
> fragment <<EOF
> - if (gld${EMULATION_NAME}_search_needed (command_line.rpath,
> - &n, force))
> - break;
> + if (command_line.rpath) {
> + char *tmprp = gld${EMULATION_NAME}_add_sysroot (command_line.rpath);
> + found = gld${EMULATION_NAME}_search_needed (tmprp, &n, force);
> + free(tmprp);
> + if (found)
> + break;
> + }
This looks like it may change what happens when there is no RPATH option
at all. Previously, gld${EMULATION_NAME}_search_needed would still be
called even if command_line.rpath is NULL, and it in turn has logic:
if (name[0] == '/')
return gld${EMULATION_NAME}_try_needed (n, force);
if (path == NULL || *path == '\0')
return FALSE;
which handles the name[0] == '/' case *before* returning in the NULL rpath
case. Is this an intentional change? If so, I think you need to give
more explanation of why it's OK to change what the function does in this
case (no -rpath option, name[0] == '/').
Note for coding style that the opening '{' goes on the line after the
"if", appropriately indented, and that a space is needed after "free".
--
Joseph S. Myers
joseph@codesourcery.com