public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/32411]  New: GCC Collect2 adds extra "-lm"'s to link commands even when not linking with "-lm".
@ 2007-06-20  5:06 rob1weld at aol dot com
  2007-06-20 12:55 ` [Bug other/32411] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: rob1weld at aol dot com @ 2007-06-20  5:06 UTC (permalink / raw)
  To: gcc-bugs

The page http://gcc.gnu.org/gcc-4.3/changes.html#mpfropts says libm is being
replaced with libmpfr. I set out to remove all the excess references to "-lm"
in the configure scripts and Makefiles produced.

I found that I could remove "-lm" from everywhere and GCC _compiled_ OK. When
I ran the testsuite there where a lot of extra errors in Gfortran so I put the
un-modified configure file back and re-compiled GCC.

I noticed that everything still compiled OK but the errors in libstdc++ where
not well explained in the logs. I investigated and found that collect2 may have
some problems with including "-lm" even when it is not specified on the command
line.


GNU C version 4.3.0 20070619 (experimental), GMP version 4.2.1, MPFR version
2.3.0-dev.
GNU assembler version 2.17.50 (i686-pc-linux-gnu) using BFD version (GNU
Binutils) 2.17.50.20070426


# /opt/gcc-4_3-build-2/gcc/collect2 -v      
collect2 version 4.3.0 20070619 (experimental) (i386 Linux/ELF)
/usr/bin/ld -v
GNU ld (GNU Binutils) 2.17.50.20070426

See these tests results for a further explanation:
http://gcc.gnu.org/ml/gcc-testresults/2007-06/msg00919.html


-- 
           Summary: GCC Collect2 adds extra "-lm"'s to link commands even
                    when not linking with "-lm".
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rob1weld at aol dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32411


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug other/32411] GCC Collect2 adds extra "-lm"'s to link commands even when not linking with "-lm".
  2007-06-20  5:06 [Bug other/32411] New: GCC Collect2 adds extra "-lm"'s to link commands even when not linking with "-lm" rob1weld at aol dot com
@ 2007-06-20 12:55 ` pinskia at gcc dot gnu dot org
  2007-06-20 16:46 ` rob1weld at aol dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-06-20 12:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2007-06-20 12:55 -------
> The page http://gcc.gnu.org/gcc-4.3/changes.html#mpfropts says libm is being
> replaced with libmpfr.

No it does not say that, please stop reading the changes page incorrectly. 
What it is saying is that inside the compiler, GCC will now do constant
folding.

You are wrong that GCC is replacing libm with mpfr.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32411


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug other/32411] GCC Collect2 adds extra "-lm"'s to link commands even when not linking with "-lm".
  2007-06-20  5:06 [Bug other/32411] New: GCC Collect2 adds extra "-lm"'s to link commands even when not linking with "-lm" rob1weld at aol dot com
  2007-06-20 12:55 ` [Bug other/32411] " pinskia at gcc dot gnu dot org
@ 2007-06-20 16:46 ` rob1weld at aol dot com
  2007-06-20 20:04 ` pinskia at gcc dot gnu dot org
  2007-06-20 22:27 ` rob1weld at aol dot com
  3 siblings, 0 replies; 5+ messages in thread
From: rob1weld at aol dot com @ 2007-06-20 16:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rob1weld at aol dot com  2007-06-20 16:46 -------
This bug report is titled 'GCC Collect2 adds extra "-lm"'s to link commands
even when not linking with "-lm".'.


The page http://gcc.gnu.org/gcc-4.3/changes.html#mpfropts says:

The GCC middle-end has been integrated with the MPFR library. This allows GCC
to evaluate and replace at compile-time calls to built-in math functions having
constant arguments with their mathematically equivalent results. In making use
of MPFR, GCC can generate correct results regardless of the math library
implementation or floating point precision of the host platform. This also
allows GCC to generate identical results regardless of whether one compiles in
native or cross-compile configurations to a particular target. The following
built-in functions take advantage of this ...


> Andrew Pinski 2007-06-20 12:55 [reply] ------- 
> No it does not say that, please stop reading the changes page incorrectly. 
> What it is saying is that inside the compiler, GCC will now do constant folding.

The word "fold" or "folding" does not appear on that page.

It does say:

"evaluate and replace at compile-time calls to built-in math functions having
constant arguments with their ..."

"The sqrt and cabs functions with constant arguments were already optimized in
prior GCC releases. Now they also use MPFR."

Is that so different from saying that it uses mpfr instead of libm ?


This bug report is titled 'GCC Collect2 adds extra "-lm"'s to link commands
even when not linking with "-lm".'.

Even if we disagree on the libm vs. mpfr issue it does not explain that
collect2 tosses in extra "-lm"'s when the files do NOT have any calls to libm
(since it was removed in _my_ modified test version).

What if we want to link with another math library and the function names
conflict, we would not want "-lm" to overwrite them.


-- 

rob1weld at aol dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32411


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug other/32411] GCC Collect2 adds extra "-lm"'s to link commands even when not linking with "-lm".
  2007-06-20  5:06 [Bug other/32411] New: GCC Collect2 adds extra "-lm"'s to link commands even when not linking with "-lm" rob1weld at aol dot com
  2007-06-20 12:55 ` [Bug other/32411] " pinskia at gcc dot gnu dot org
  2007-06-20 16:46 ` rob1weld at aol dot com
@ 2007-06-20 20:04 ` pinskia at gcc dot gnu dot org
  2007-06-20 22:27 ` rob1weld at aol dot com
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-06-20 20:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2007-06-20 20:04 -------
Did you miss "constant arguments", see constant.  Nothing is done with non
constant arguments.  So we are not replacing libm with mpfr.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32411


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug other/32411] GCC Collect2 adds extra "-lm"'s to link commands even when not linking with "-lm".
  2007-06-20  5:06 [Bug other/32411] New: GCC Collect2 adds extra "-lm"'s to link commands even when not linking with "-lm" rob1weld at aol dot com
                   ` (2 preceding siblings ...)
  2007-06-20 20:04 ` pinskia at gcc dot gnu dot org
@ 2007-06-20 22:27 ` rob1weld at aol dot com
  3 siblings, 0 replies; 5+ messages in thread
From: rob1weld at aol dot com @ 2007-06-20 22:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rob1weld at aol dot com  2007-06-20 22:26 -------
My complaint is that collect2 hitlers-in a couple of "-lm"s when I try to link
without it. Since I modifed __my__ copy of GCC source to not use "-lm" I wish
that collect2 did not add the extra library. 

I should have to add "-lm" to _my_ GCC command line to make collect2 add "-lm"
- it ought not to do so on it's own. That is all I am bug-reporting about here.

---
On the other issue (which I do not complain about in this bug report) I noticed
that GCC is very lax about the contents of libm. An example is in the file
gcc-4_3-trunk/libstdc++-v3/linkage.m4 - it will let libm be _any_ version and
contain _any_ functions it cares to.

Line 501-503 of gcc-4_3-trunk/libstdc++-v3/linkage.m4 says:
  dnl Check for complex versions of math functions of platform.  This will
  dnl always pass if libm is available, and fail if it isn't.  If it is
  dnl available, we assume we'll need it later, so add it to LIBS.


This is why _I_ am trying to standardize the math and attempt to create a patch
for consideration. If I can show that it works _correctly_ and _accurately_ on
all platforms then it would be a great benefit. GCC on Cygwin does have
accurate math, I would like to see the same on Linux. This is why I am fiddling
with this.

I accept that FSF has no formal plans to remove the usage of unknown versions
of libm being linked with GCC, resulting in unknown results.


My most recent test results are here. It works as well as it did 2 weeks ago.
http://gcc.gnu.org/ml/gcc-testresults/2007-06/msg00942.html


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32411


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-06-20 22:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-20  5:06 [Bug other/32411] New: GCC Collect2 adds extra "-lm"'s to link commands even when not linking with "-lm" rob1weld at aol dot com
2007-06-20 12:55 ` [Bug other/32411] " pinskia at gcc dot gnu dot org
2007-06-20 16:46 ` rob1weld at aol dot com
2007-06-20 20:04 ` pinskia at gcc dot gnu dot org
2007-06-20 22:27 ` rob1weld at aol dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).