Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 18153
Product:  
Component:  
Status: RESOLVED
Resolution: FIXED
Assigned To: H.J. Lu <hjl.tools@gmail.com>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: H.J. Lu <hjl.tools@gmail.com>
Add CC:
CC:
Remove selected CCs
Build:
URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 18153 depends on: Show dependency tree
Show dependency graph
Bug 18153 blocks:

Additional Comments:






View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: 2004-10-26 00:49 Opened: 2004-10-26 00:43
-static-libgcc links in libunwind.so.7 even if it isn't used at all:

[hjl@gnu-4 tmp]$ cat f.c
int
main ()
{
  return 0;
}
[hjl@gnu-4 tmp]$ /usr/gcc-3.4/bin/gcc -static-libgcc f.c
[hjl@gnu-4 tmp]$ ./a.out
./a.out: error while loading shared libraries: libunwind.so.7: cannot open 
shared object file: No such file or directory

------- Comment #1 From Andrew Pinski 2004-10-26 00:49 -------
Your self caused this regression.

------- Comment #2 From H.J. Lu 2004-10-26 01:07 -------
A patch is posted at

http://gcc.gnu.org/ml/gcc-patches/2004-10/msg02141.html

------- Comment #3 From Mark Mitchell 2004-11-01 00:45 -------
Postponed until GCC 3.4.4.

------- Comment #4 From H.J. Lu 2004-11-01 16:29 -------
An alternative is posted at

http://gcc.gnu.org/ml/gcc-patches/2004-10/msg02209.html

------- Comment #5 From H.J. Lu 2004-12-10 17:11 -------
An updated patch is posted at

http://gcc.gnu.org/ml/gcc-patches/2004-12/msg00757.html

------- Comment #6 From H.J. Lu 2004-12-14 17:52 -------
Mark, can you take a look at the patch? Thanks.

------- Comment #7 From Mark Mitchell 2004-12-15 19:54 -------
Why would we want to link libunwind statically?  I don't see why it shouldn't
be
a shared library just like everything else.

In fact, I don't see this as a bug at all.  Binaries depend on libgcc already;
so, now they depend on libunwind too.

------- Comment #8 From H.J. Lu 2004-12-15 22:54 -------
We tried very hard to provide -static-libgcc which links against
libgcc.a and libgcc_eh.a instead of libgcc.a and libgcc_s.so.1.
The main purpose of -static-libgcc is to link in the copy of
the unwind stuff. Introduction of libunwind moved the unwind
stuff from libgcc_s.so.1/libgcc_eh.a into libunwind.so.7/libunwind.a.
With libunwind, -static-libgcc should still link in the copy of
the unwind stuff, instead of from a shared library. Otherwise,
applications which expect that behavior of -static-libgcc won't
work correctly.

------- Comment #9 From Mark Mitchell 2004-12-15 23:30 -------
Subject: Re:  [3.4/4.0 Regression] -static-libgcc links
 in libunwind.so.7

hjl at lucon dot org wrote:
> ------- Additional Comments From hjl at lucon dot org  2004-12-15 22:54 -------
> We tried very hard to provide -static-libgcc which links against
> libgcc.a and libgcc_eh.a instead of libgcc.a and libgcc_s.so.1.
> The main purpose of -static-libgcc is to link in the copy of
> the unwind stuff. Introduction of libunwind moved the unwind
> stuff from libgcc_s.so.1/libgcc_eh.a into libunwind.so.7/libunwind.a.
> With libunwind, -static-libgcc should still link in the copy of
> the unwind stuff, instead of from a shared library. Otherwise,
> applications which expect that behavior of -static-libgcc won't
> work correctly.

OK.  I understand now that your patch is just modifying the static 
linking case.  In that case, your change is OK.


------- Comment #10 From CVS Commits 2004-12-15 23:50 -------
Subject: Bug 18153

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	hjl@gcc.gnu.org	2004-12-15 23:50:30

Modified files:
	gcc            : ChangeLog config.in configure configure.ac 
	                 gcc.c 

Log message:
	2004-12-15  H.J. Lu  <hongjiu.lu@intel.com>
	
	PR target/18153
	* configure.ac: Define HAVE_LD_STATIC_DYNAMIC if linker supports
	-Bstatic/-Bdynamic option.
	* config.in: Regenerated.
	* configure: Likewise.
	
	* gcc.c (init_spec): Pass -Bstatic/-Bdynamic to ld for static
	-lunwind if possible.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.6847&r2=2.6848
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config.in.diff?cvsroot=gcc&r1=1.201&r2=1.202
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/configure.diff?cvsroot=gcc&r1=1.880&r2=1.881
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/configure.ac.diff?cvsroot=gcc&r1=2.89&r2=2.90
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/gcc.c.diff?cvsroot=gcc&r1=1.441&r2=1.442


------- Comment #11 From CVS Commits 2004-12-16 00:17 -------
Subject: Bug 18153

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	hjl@gcc.gnu.org	2004-12-16 00:15:07

Modified files:
	gcc            : ChangeLog config.in configure configure.ac 
	                 gcc.c 

Log message:
	2004-12-15  H.J. Lu  <hongjiu.lu@intel.com>
	
	PR target/18153
	* configure.ac: Define HAVE_LD_STATIC_DYNAMIC if linker supports
	-Bstatic/-Bdynamic option.
	* config.in: Regenerated.
	* configure: Likewise.
	
	* gcc.c (init_spec): Pass -Bstatic/-Bdynamic to ld for static
	-lunwind if possible.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.739&r2=2.2326.2.740
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config.in.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.181.4.4&r2=1.181.4.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/configure.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.794.2.19&r2=1.794.2.20
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/configure.ac.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.6.2.17&r2=2.6.2.18
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/gcc.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.403.4.9&r2=1.403.4.10


------- Comment #12 From H.J. Lu 2004-12-16 00:19 -------
Fixed.

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug