[Bug other/42333] complex division failure on darwin10 with -lm

iains at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sun Apr 11 10:18:00 GMT 2010



------- Comment #36 from iains at gcc dot gnu dot org  2010-04-11 10:18 -------
(In reply to comment #33)
> (In reply to comment #32)
> 
> Note that when using the patch in comment #22 triggers pr43254: another side
> effect of -lm is to prevent the run of dsymutil even with -g.

my 0,02 euro...

1. the whole dsymutil thing is a mess and  needs sorting out separately - it's
not being run at all for Fortran at the moment - and it's inconsistent in any
event (not run when only objects are present on the cl, for e.g.)  .. I'm going
to take a look at that - but need to discuss with people what the 'correct'
behavior should be.

2. we should test what is intended:
  (a) ergo Jack should submit his patch (at comment 23) to DejaGnu - if -lm is
not needed on Darwin > x it should not be applied 
  (b) whilst it is "the User's Problem" if they put the wrong libraries on the
C/L,  IMO we should try to help them .. therefore we should control the
placement and/or inclusion of lm (this is already done for Fortran and we have
a "" don't include for g++ - so there's a precedent).

3. maybe we need to look at how to work around the debug generation for darwin
< 10 ;
 it's unlikely that dsymutil will be updated on those systems and, as of now,
it's not part of the Open Source stuff so we can't fix it ourselves.

=====
assuming people agree with the philosophy of 2. --- on the "How To" side.
=====

It seems one can't use %<lm  to swallow '-lm'  because '-lm' is already
declared as an "output file" and therefore unaffected by the process.

This trick is a bit dirty, but it works:  
translate the lib flag to something else ; act on it where required and then
delete it .
* you must delete it after use - or it will error out as an unrecognized flag *

(darwin.h)
- not a patch - but guidance for anyone who wants to try it out ... 

   /* We want to be able to edit '-lm' out of the command line (or 
   control its positioning) so that math routines are provided from the
   source that we intend.  I put a -force_lm option to allow comparative
   testing .. it's not a serious proposition */

#define TARGET_OPTION_TRANSLATE_TABLE \
  { "-lm", "-Zlm" },  \
  { "-force_lm", "-lm" }, \


and then:

/* Machine dependent libraries.  
   Link -lm explicitly for versions of darwin that don't include the
   functions in libSystem, otherwise don't duplicate info. */

#define LIB_SPEC \
  "%{Zlm:%:version-compare(< 10.4 mmacosx-version-min= -lm) } %<Zlm \
   %{!static:-lSystem}"

===
in darwin10.h:

/* Machine dependent libraries.  
   Link -lm explicitly for versions of darwin that don't include the
   functions in libSystem, otherwise don't duplicate info. */

/* Fix PR41260 by passing -no_compact_unwind on darwin10 and later until
unwinder in libSystem is fixed to digest new epilog unwinding notes. */

#define LIB_SPEC \
  "%{Zlm:%:version-compare(< 10.4 mmacosx-version-min= -lm) } %<Zlm \
   %{!static:-no_compact_unwind -lSystem}"


-- 


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



More information about the Gcc-bugs mailing list