Use libm, not fdlibm, on all/most platforms. bug 326842, patch from Josh Aas, r=brendan/shaver

This commit is contained in:
mrbkap%gmail.com 2006-03-04 03:58:55 +00:00
Родитель 42767dfaae
Коммит 17ad69885b
3 изменённых файлов: 14 добавлений и 124 удалений

Просмотреть файл

@ -153,8 +153,6 @@ ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
EXPORTS += jscpucfg.h EXPORTS += jscpucfg.h
endif endif
FDLIBM_LIBRARY = fdlibm/$(LIB_PREFIX)fdm.$(LIB_SUFFIX)
JSMATH_PRELINK = jsmathtemp.o
JS_SAFE_ARENA = 1 JS_SAFE_ARENA = 1
DASH_R = -r DASH_R = -r
@ -163,10 +161,6 @@ include $(topsrcdir)/config/config.mk
EXTRA_DSO_LDOPTS += $(NSPR_LIBS) EXTRA_DSO_LDOPTS += $(NSPR_LIBS)
ifeq (,$(filter-out OS2 WINNT WINCE,$(OS_ARCH)))
SHARED_LIBRARY_LIBS += $(FDLIBM_LIBRARY)
endif
# When using gcc the assembly is inlined in the C-file (see jslock.c) # When using gcc the assembly is inlined in the C-file (see jslock.c)
ifeq ($(OS_ARCH),SunOS) ifeq ($(OS_ARCH),SunOS)
ifneq ($(OS_TEST),i86pc) ifneq ($(OS_TEST),i86pc)
@ -218,7 +212,7 @@ LDFLAGS += -OPT:NOICF
endif endif
endif endif
GARBAGE += $(JSMATH_PRELINK) jscpucfg.o jsautocfg.h jsautocfg.tmp jscpucfg GARBAGE += jscpucfg.o jsautocfg.h jsautocfg.tmp jscpucfg
ifneq (,$(CROSS_COMPILE)$(filter-out WINNT,$(OS_ARCH))) ifneq (,$(CROSS_COMPILE)$(filter-out WINNT,$(OS_ARCH)))
TARGETS += jscpucfg$(HOST_BIN_SUFFIX) TARGETS += jscpucfg$(HOST_BIN_SUFFIX)
@ -297,13 +291,6 @@ LDFLAGS += -lposix4 -ldl -lnsl -lsocket
endif endif
endif endif
ifeq ($(OS_ARCH),QNX)
ifneq ($(OS_TARGET),NTO)
# Don't use wildcard here, because we only want this resolved at link time.
OBJS += fdlibm/*.o
endif
endif
ifeq ($(OS_ARCH),IRIX) ifeq ($(OS_ARCH),IRIX)
ifndef GNU_CC ifndef GNU_CC
_COMPILE_CFLAGS = $(patsubst -O%,-O1,$(COMPILE_CFLAGS)) _COMPILE_CFLAGS = $(patsubst -O%,-O1,$(COMPILE_CFLAGS))
@ -314,31 +301,6 @@ jsapi.o jsarena.o jsarray.o jsatom.o jsemit.o jsfun.o jsinterp.o jsregexp.o jspa
endif endif
endif endif
# On OS/2 & win32 we are already linking against fdlibm, so don't bother
# creating jsmathtemp
ifeq (,$(filter OS2 WINNT OpenVMS,$(OS_ARCH)))
# special rule for jsmath.o since we want to incrementally link
# against fdlibm to pull in only what is needed
# Do this in a single step to avoid dependency problems
jsmath.o: jsmath.c $(FDLIBM_LIBRARY) Makefile.in
$(REPORT_BUILD)
@$(MAKE_DEPS_AUTO)
$(ELOG) $(CC) $(OUTOPTION)$(JSMATH_PRELINK) -c $(COMPILE_CFLAGS) $<
ifeq ($(OS_ARCH),QNX)
ifneq ($(OS_TARGET),NTO)
@cp $(JSMATH_PRELINK) $@
else
$(LD) $(DASH_R) -o $@ $(JSMATH_PRELINK) $(FDLIBM_LIBRARY)
endif
else
$(LD) $(DASH_R) -o $@ $(JSMATH_PRELINK) $(FDLIBM_LIBRARY)
endif
@$(RM) -f $(JSMATH_PRELINK)
else
# Create dependency so we build fdlibm
jsmath.o: $(FDLIBM_LIBRARY) Makefile.in
endif
# An AIX Optimization bug causes PR_dtoa() & JS_dtoa to produce wrong result. # An AIX Optimization bug causes PR_dtoa() & JS_dtoa to produce wrong result.
# This suppresses optimization for this single compilation unit. # This suppresses optimization for this single compilation unit.
ifeq ($(OS_ARCH),AIX) ifeq ($(OS_ARCH),AIX)
@ -352,9 +314,6 @@ jsdtoa.o: jsdtoa.c Makefile.in
$(CC) -o $@ -c $(filter-out $(MOZ_OPTIMIZE_FLAGS), $(COMPILE_CFLAGS)) $< $(CC) -o $@ -c $(filter-out $(MOZ_OPTIMIZE_FLAGS), $(COMPILE_CFLAGS)) $<
endif endif
$(FDLIBM_LIBRARY):
$(MAKE) -C $(@D) $(@F)
jsopcode.h jsopcode.c: jsopcode.tbl jsopcode.h jsopcode.c: jsopcode.tbl
ifeq (,$(CROSS_COMPILE)$(filter-out WINNT,$(OS_ARCH))) ifeq (,$(CROSS_COMPILE)$(filter-out WINNT,$(OS_ARCH)))

Просмотреть файл

@ -58,12 +58,6 @@ ifdef NARCISSUS
DEFINES += -DNARCISSUS DEFINES += -DNARCISSUS
endif endif
ifdef USE_MSVC
OTHER_LIBS += fdlibm/$(OBJDIR)/fdlibm.lib
else
OTHER_LIBS += -Lfdlibm/$(OBJDIR) -lfdm
endif
# Look in OBJDIR to find jsautocfg.h and jsautokw.h # Look in OBJDIR to find jsautocfg.h and jsautokw.h
INCLUDES += -I$(OBJDIR) INCLUDES += -I$(OBJDIR)
@ -253,24 +247,6 @@ JS_CFILES = \
prmjtime.c \ prmjtime.c \
$(NULL) $(NULL)
PREDIRS += fdlibm
ifdef USE_MSVC
FDLIBM_LIBRARY = fdlibm/$(OBJDIR)/fdlibm.lib
else
FDLIBM_LIBRARY = fdlibm/$(OBJDIR)/libfdm.a
endif
JSMATH_PRELINK = $(OBJDIR)/jsmathtemp.$(OBJ_SUFFIX)
# Flag for incremental linking
DASH_R = -r
ifeq ($(OS_ARCH),QNX)
ifneq ($(OS_TARGET),NTO)
# Don't use wildcard here, because we only want this resolved at link time.
OBJS += fdlibm/*.$(OBJ_SUFFIX)
endif
endif
ifdef JS_LIVECONNECT ifdef JS_LIVECONNECT
DIRS += liveconnect DIRS += liveconnect
endif endif
@ -348,10 +324,10 @@ endif
# #
ifdef USE_MSVC ifdef USE_MSVC
$(PROGRAM): $(PROG_OBJS) $(LIBRARY) $(FDLIBM_LIBRARY) $(PROGRAM): $(PROG_OBJS) $(LIBRARY)
link.exe -out:"$@" $(EXE_LINK_FLAGS) $^ link.exe -out:"$@" $(EXE_LINK_FLAGS) $^
else else
$(PROGRAM): $(PROG_OBJS) $(LIBRARY) $(FDLIBM_LIBRARY) $(PROGRAM): $(PROG_OBJS) $(LIBRARY)
$(CC) -o $@ $(CFLAGS) $(PROG_OBJS) $(LIBRARY) $(LDFLAGS) $(OTHER_LIBS) \ $(CC) -o $@ $(CFLAGS) $(PROG_OBJS) $(LIBRARY) $(LDFLAGS) $(OTHER_LIBS) \
$(PROG_LIBS) $(PROG_LIBS)
endif endif
@ -373,38 +349,9 @@ $(OBJDIR)/jscpucfg: $(OBJDIR)/jscpucfg.o
# Add to TARGETS for clobber rule # Add to TARGETS for clobber rule
TARGETS += $(OBJDIR)/jsautocfg.h $(OBJDIR)/jscpucfg \ TARGETS += $(OBJDIR)/jsautocfg.h $(OBJDIR)/jscpucfg \
$(OBJDIR)/jscpucfg.o $(OBJDIR)/jsmathtemp.o $(OBJDIR)/jscpucfg.o
endif endif
# special rule for jsmath.o since we want to incrementally link
# against fdlibm to pull in only what is needed
$(OBJDIR)/jsmath.o: jsmath.c jsmath.h jslibmath.h $(FDLIBM_LIBRARY)
ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
$(CC) -Fo$(JSMATH_PRELINK) -c $(CFLAGS) $<
else
$(CC) -o $(JSMATH_PRELINK) -c $(CFLAGS) $<
endif
ifeq ($(OS_ARCH),QNX)
ifneq ($(OS_TARGET),NTO)
@cp $(JSMATH_PRELINK) $@
else
$(LD) $(DASH_R) -o $@ $(JSMATH_PRELINK) $(FDLIBM_LIBRARY)
endif
else
ifdef USE_MSVC
@echo Warning: to use $(LIBRARY) must also link against $(FDLIBM_LIBRARY)
@cp $(JSMATH_PRELINK) $@
endif
$(LD) $(DASH_R) -o $@ $(JSMATH_PRELINK) $(FDLIBM_LIBRARY)
endif
# Note: generated headers must be built before descending
# into fdlibm directory
$(FDLIBM_LIBRARY) :
$(MAKE) -C fdlibm -f Makefile.ref $(@F)
# #
# Hardwire dependencies on jsopcode.tbl # Hardwire dependencies on jsopcode.tbl
# #

Просмотреть файл

@ -53,38 +53,15 @@
* Define on which platforms to use fdlibm. Not used by default under * Define on which platforms to use fdlibm. Not used by default under
* assumption that native math library works unless proved guilty. * assumption that native math library works unless proved guilty.
* Plus there can be problems with endian-ness and such in fdlibm itself. * Plus there can be problems with endian-ness and such in fdlibm itself.
*
* fdlibm compatibility notes:
* - fdlibm broken on OSF1/alpha
*/ */
#ifndef JS_USE_FDLIBM_MATH #ifndef JS_USE_FDLIBM_MATH
#if defined(_WIN32) && !defined(__MWERKS__)
#define JS_USE_FDLIBM_MATH 1
#elif defined(SUNOS4)
#define JS_USE_FDLIBM_MATH 1
#elif defined(IRIX)
#define JS_USE_FDLIBM_MATH 1
#elif defined(SOLARIS)
#define JS_USE_FDLIBM_MATH 1
#elif defined(HPUX)
#define JS_USE_FDLIBM_MATH 1
#elif defined(OSF1)
/* Want to use some fdlibm functions but fdlibm broken on OSF1/alpha. */
#define JS_USE_FDLIBM_MATH 0
#elif defined(AIX)
#define JS_USE_FDLIBM_MATH 1
#else
#define JS_USE_FDLIBM_MATH 0 #define JS_USE_FDLIBM_MATH 0
#endif #endif
#endif /* JS_USE_FDLIBM_MATH */
#if !JS_USE_FDLIBM_MATH #if !JS_USE_FDLIBM_MATH
/* /*
@ -96,7 +73,14 @@
#define fd_atan atan #define fd_atan atan
#define fd_atan2 atan2 #define fd_atan2 atan2
#define fd_ceil ceil #define fd_ceil ceil
// the right copysign function is not always named the same thing
#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
#define fd_copysign __builtin_copysign
#elif (defined _WIN32 && !defined WINCE)
#define fd_copysign _copysign
#else
#define fd_copysign copysign #define fd_copysign copysign
#endif
#define fd_cos cos #define fd_cos cos
#define fd_exp exp #define fd_exp exp
#define fd_fabs fabs #define fd_fabs fabs