Ticket UUID: | 440891 | |||
Title: | Linux inlining defeats compat/*.c | |||
Type: | Bug | Version: | obsolete: 8.5a0 | |
Submitter: | dgp | Created on: | 2001-07-13 01:05:09 | |
Subsystem: | 53. Configuration and Build Tools | Assigned To: | dgp | |
Priority: | 5 Medium | Severity: | ||
Status: | Closed | Last Modified: | 2007-09-05 23:21:06 | |
Resolution: | Out of Date | Closed By: | dgp | |
Closed on: | 2007-09-05 16:21:06 | |||
Description: |
I wanted to test compat/strtod.c on Linux 6.2 on my Alpha XL-300: $ cd unix $ setenv LIBOBJS strtod.o $ ./configure $ make test but the resulting tclsh didn't use the strtod() from compat/strtod.c. The problem was that with optimization level "-O" the compiler egcs-2.91.66 and the header files from glibc-devel-2.1.3-21 automatically inlines the function strtod() so it can't be replaced. The attached patch fixes the problem. It detects the intent to link in routines from compat/* and in that case adds to EXTRA_CFLAGS the switch -fno-inline. | |||
User Comments: |
dgp added on 2007-09-05 23:21:06:
Logged In: YES user_id=80530 Originator: YES This bug was apparently only for the egcs-2.91.66 compiler, and the world has moved on. hobbs added on 2003-11-13 01:28:54: Logged In: YES user_id=72656 Feel free to recorrect, but only with checks for that old version. Newer compilers do not have the bug, and it does improve speed to allow inlining. dgp added on 2003-11-12 23:37:00: Logged In: YES user_id=80530 looks like the new commits went into HEAD only. On the HEAD, when I follow the steps in this report, I get in the Makefile: COMPAT_OBJS = strtod$U.o I have no idea what that $U is for, but it seems to be produced by the new autoconf-.2.57 generated configure script. Anyhow, it does seem to work, putting strtod.o on the list of compiled files that get put into libtcl. As expected, though, due to the inlining, the compat/strtod() routine is never called. This report is re-opened for Tcl 8.5a0. dgp added on 2003-11-12 11:49:09: Logged In: YES user_id=80530 Just curious how the commits of Nov. 11, 2003 will impact on this report? mdejong added on 2001-09-18 23:53:49: Logged In: YES user_id=90858 Doh! You are quite right. The -fno-builtin flag should work but it seems to be broken in this case. I will go ahead and use the -fno-inline flag. dgp added on 2001-09-18 23:23:37: Logged In: YES user_id=80530 I see exactly the same thing on my Linux system. However: $ make tclCmdMZ.o CFLAGS="-O -fno-builtin" $ nm tclCmdMZ.o | grep strtod U __strtod_internal So, what is the key to success? Is it adding -fno-builtin, or is it just removing -O ? mdejong added on 2001-09-08 12:40:22: Logged In: YES user_id=90858 I took a look at the .h files and it does seem like something funny is going on. Thing is, passing -fno-builtin does seem to work for me. % make tclCmdMZ.o CFLAGS="-O" % nm tclCmdMZ.o | grep strtod U __strtod_internal % make tclCmdMZ.o CFLAGS="" % nm tclCmdMZ.o | grep strtod U strtod % make tclCmdMZ.o CFLAGS="-fno-builtin" % nm tclCmdMZ.o | grep strtod U strtod Do you still get a ref to __strtod_internal when passing -fno-builtin? If not, what do you get? I am running on an x86 box with RH 6.2 in case that matters. dgp added on 2001-09-06 08:57:52: Logged In: YES user_id=80530 Tcl also adds -D__NO_STRING_INLINES and -D__NO_MATH_INLINES (they come from the shared tcl.m4 file) but that has no effect on the issue in this report. hobbs added on 2001-09-06 05:41:58: Logged In: YES user_id=72656 Tk adds -D__NO_STRING_INLINES and -D__NO_MATH_INLINES which may be the right fix. dgp added on 2001-07-17 03:20:58: Logged In: YES user_id=80530 No, -fno-builtin doesn't solve the problem. mdejong added on 2001-07-17 02:51:09: Logged In: YES user_id=90858 Does passing the -fno-builtin also work for your case? The docs seem to indicate that it will. I would rather use -fno-builtin instead of -fno-inline since it will only stop inlining of builtin functions. dgp added on 2001-07-13 08:11:02: Logged In: YES user_id=80530 assigning to maintainer for review. dgp added on 2001-07-13 08:05:10: File Added - 8370: inline.patch |
Attachments:
- inline.patch [download] added by dgp on 2001-07-13 08:05:10. [details]