Bug 11902 - [3.3 only] spec file improperly inserts rpath even when none needed
Summary: [3.3 only] spec file improperly inserts rpath even when none needed
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.3.1
: P1 normal
Target Milestone: 3.3.2
Assignee: Kazumoto Kojima
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-08-13 03:42 UTC by dank
Modified: 2003-08-13 04:17 UTC (History)
2 users (show)

See Also:
Host:
Target: sh4-*-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed: 2003-08-13 03:45:51


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dank 2003-08-13 03:42:11 UTC
As is, if you compile libc.so with gcc-3.3.1 on sh4, it will
be marked with DT_RPATH even though it doesn't need it,
which causes ld.so to crash silently when loading libc.so.
This is catastrophic, since all dynamically loaded programs crash.
The crash is caused by the line
  assert (info[DT_RPATH] == NULL);
which occurs too early for an error message to be printed.

This is caused by the line

!rpath:-rpath /lib

in the spec file.  A patch written by Kaz to fix this is at
http://www.kegel.com/crosstool/current/gcc-3.3-patches/sh-spec.patch
I have tried it, and it seems to solve the problem for me.
Please include this patch in gcc-3.3.2.
Comment 1 Andrew Pinski 2003-08-13 03:45:51 UTC
Same as before:
        * config/sh/linux.h (SUBTARGET_LINK_SPEC): Don't set rpath.
        (LIB_SPEC): Set -lpthread always when -pthread set.  Set -lieee
        when -mieee-fp set and -shared not set.   
        (SH_FALLBACK_FRAME_FLOAT_STATE): Don't define for SH5.
Comment 2 kkojima@rr.iij4u.or.jp 2003-08-13 04:11:51 UTC
Subject: Re:  [3.3 only] spec file improperly inserts rpath
 even when none needed

> Same as before:
>         * config/sh/linux.h (SUBTARGET_LINK_SPEC): Don't set rpath.
>         (LIB_SPEC): Set -lpthread always when -pthread set.  Set -lieee
>         when -mieee-fp set and -shared not set.   
>         (SH_FALLBACK_FRAME_FLOAT_STATE): Don't define for SH5.

The corresponding patch was checked in already to 3.3.2
under the approval with Mark Mitchell:
2003-08-08  Kaz Kojima  <kkojima@gcc.gnu.org>

        * config/sh/linux.h (SUBTARGET_LINK_SPEC): Don't set rpath.
        (LIB_SPEC): Set -lpthread always when -pthread set.  Set -lieee
        when -mieee-fp set and -shared not set.
Comment 3 Andrew Pinski 2003-08-13 04:16:38 UTC
Closing as fixed.  I should have looked before confirming bugs (it is too late for me need sleep).
Comment 4 dank 2003-08-13 04:17:44 UTC
Oh, man, I am so embarassed... thanks, guys!