bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gnulib] mktime.c definition of __mktime_internal inhibits static li


From: Jim Meyering
Subject: [Bug-gnulib] mktime.c definition of __mktime_internal inhibits static linking
Date: Wed, 21 Jan 2004 21:52:18 +0100

Here's a proposed fix for mktime.c, without which one cannot
build a statically linked `ls' binary.  GNU ld fails when it finds
that the two copies (in libfetish.a and libc.a) of __mktime_internal
have different sizes.

Thanks to Paul Eggert for warning me that __mktime_internal was also
used by timegm.c.

[I've edited out the hunks below for Copyright year changes, for brevity]

2004-01-21  Jim Meyering  <address@hidden>

        * mktime.c (__mktime_internal) [!_LIBC]: Define to mktime_internal
        so as not to conflict with a different-sized __mktime_internal
        function in GNU libc.
        * timegm.c (__mktime_internal) [!_LIBC]: Likewise.
        Problem building statically-linked `ls' reported by Michael Brunnbauer.

Index: mktime.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/mktime.c,v
retrieving revision 1.41
diff -u -p -r1.41 mktime.c
--- mktime.c    9 Sep 2003 22:41:13 -0000       1.41
+++ mktime.c    21 Jan 2004 20:45:40 -0000
@@ -108,6 +108,7 @@ const unsigned short int __mon_yday[2][1
 # include "time_r.h"
 # undef __localtime_r
 # define __localtime_r localtime_r
+# define __mktime_internal mktime_internal
 #endif
 
 /* Return an integer value measuring (YEAR1-YDAY1 HOUR1:MIN1:SEC1) -
@@ -230,7 +231,8 @@ ranged_convert (struct tm *(*convert) (c
    the monotonic and mostly-unit-linear conversion function CONVERT.
    Use *OFFSET to keep track of a guess at the offset of the result,
    compared to what the result would be for UTC without leap seconds.
-   If *OFFSET's guess is correct, only one CONVERT call is needed.  */
+   If *OFFSET's guess is correct, only one CONVERT call is needed.
+   This function has global scope because it is used also by timegm.c.  */
 time_t
 __mktime_internal (struct tm *tp,
                   struct tm *(*convert) (const time_t *, struct tm *),
Index: timegm.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/timegm.c,v
retrieving revision 1.2
diff -u -p -r1.2 timegm.c
--- timegm.c    6 Sep 2003 21:34:07 -0000       1.2
+++ timegm.c    21 Jan 2004 20:45:40 -0000
@@ -28,6 +28,7 @@
 # include <time_r.h>
 # undef __gmtime_r
 # define __gmtime_r gmtime_r
+# define __mktime_internal mktime_internal
 time_t __mktime_internal (struct tm *,
                          struct tm * (*) (time_t const *, struct tm *),
                          time_t *);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]