[Git][NTPsec/ntpsec][master] Address GitLab issue #127: git head fails to link on osx.
Eric S. Raymond
gitlab at mg.gitlab.com
Sun Oct 23 16:24:37 UTC 2016
Eric S. Raymond pushed to branch master at NTPsec / ntpsec
Commits:
085e0282 by Eric S. Raymond at 2016-10-23T12:22:24-04:00
Address GitLab issue #127: git head fails to link on osx.
Workaround for a Mac OS X linker deficiency.
- - - - -
12 changed files:
- include/ntp_stdlib.h
- libntp/lib_strbuf.c
- libntp/ssl_init.c
- ntpd/ntpd.c
- ntpdig/main.c
- ntpkeygen/ntpkeygen.c
- ntpq/ntpq.c
- ntpq/pyntpq
- tests/common/tests_main.c
- tests/libntp/refidsmear.c
- tests/libntp/timespecops.c
- util/sht.c
Changes:
=====================================
include/ntp_stdlib.h
=====================================
--- a/include/ntp_stdlib.h
+++ b/include/ntp_stdlib.h
@@ -76,6 +76,7 @@ extern uint32_t caldaystart (uint32_t ntptime, const time_t *pivot);
extern const char *clockname (int);
extern int clocktime (int, int, int, int, int, uint32_t, uint32_t *, uint32_t *);
extern void init_auth (void);
+extern void init_lib (void);
extern void init_network (void);
extern struct savekey *auth_findkey (keyid_t);
extern void auth_moremem (int);
=====================================
libntp/lib_strbuf.c
=====================================
--- a/libntp/lib_strbuf.c
+++ b/libntp/lib_strbuf.c
@@ -17,3 +17,14 @@ int debug;
libbufstr lib_stringbuf[LIB_NUMBUF];
int lib_nextbuf;
+
+/*
+ * This stub is required to pacify the Mac OS X linker, which will
+ * refuse to consider a module a candidate to be linked unless it
+ * has an executable entry point called from somewhere else that
+ * is linked.
+ */
+void
+init_lib(void)
+{
+}
=====================================
libntp/ssl_init.c
=====================================
--- a/libntp/ssl_init.c
+++ b/libntp/ssl_init.c
@@ -24,6 +24,8 @@ bool ssl_init_done;
void
ssl_init(void)
{
+ init_lib();
+
if (ssl_init_done)
return;
=====================================
ntpd/ntpd.c
=====================================
--- a/ntpd/ntpd.c
+++ b/ntpd/ntpd.c
@@ -608,6 +608,7 @@ ntpdmain(
}
# endif /* HAVE_WORKING_FORK */
+ init_lib();
init_network();
/*
* Detach us from the terminal. May need an #ifndef GIZMO.
=====================================
ntpdig/main.c
=====================================
--- a/ntpdig/main.c
+++ b/ntpdig/main.c
@@ -214,6 +214,7 @@ ntpdig_main (
if (!libevent_version_ok())
exit(2);
+ init_lib();
init_auth();
init_network();
=====================================
ntpkeygen/ntpkeygen.c
=====================================
--- a/ntpkeygen/ntpkeygen.c
+++ b/ntpkeygen/ntpkeygen.c
@@ -89,6 +89,8 @@ main(
progname = argv[0];
+ init_lib();
+
#ifdef HAVE_OPENSSL
ssl_check_version();
#endif /* HAVE_OPENSSL */
=====================================
ntpq/ntpq.c
=====================================
--- a/ntpq/ntpq.c
+++ b/ntpq/ntpq.c
@@ -473,6 +473,7 @@ ntpqmain(
delay_time.l_ui = 0;
delay_time.l_uf = DEFDELAY;
+ init_lib(); /* sets up ipv4_works, ipv6_works */
init_auth();
init_network();
=====================================
ntpq/pyntpq
=====================================
--- a/ntpq/pyntpq
+++ b/ntpq/pyntpq
@@ -1412,6 +1412,8 @@ USAGE: ntpq [-46dphinOV] [-c str] [-D lvl] [ host ...]
if __name__ == '__main__':
#delay_time.l_ui = 0
#delay_time.l_uf = DEFDELAY
+
+ #init_lib() # sets up ipv4_works, ipv6_works
#init_auth()
try:
=====================================
tests/common/tests_main.c
=====================================
--- a/tests/common/tests_main.c
+++ b/tests/common/tests_main.c
@@ -76,6 +76,7 @@ static void RunAllTests(void)
int main(int argc, const char * argv[]) {
+ init_lib();
init_auth();
init_network();
=====================================
tests/libntp/refidsmear.c
=====================================
--- a/tests/libntp/refidsmear.c
+++ b/tests/libntp/refidsmear.c
@@ -11,7 +11,7 @@
TEST_GROUP(refidsmear);
-TEST_SETUP(refidsmear) {}
+TEST_SETUP(refidsmear) {init_lib();}
TEST_TEAR_DOWN(refidsmear) {}
=====================================
tests/libntp/timespecops.c
=====================================
--- a/tests/libntp/timespecops.c
+++ b/tests/libntp/timespecops.c
@@ -34,7 +34,7 @@ struct lfpfracdata {
TEST_GROUP(timespecops);
-TEST_SETUP(timespecops) {}
+TEST_SETUP(timespecops) {init_lib();}
TEST_TEAR_DOWN(timespecops) {}
=====================================
util/sht.c
=====================================
--- a/util/sht.c
+++ b/util/sht.c
@@ -73,6 +73,8 @@ main (
progname = argv[0];
+ init_lib();
+
if (argc<=1) {
usage:
printf ("usage: %s [uu:]{r[c][l]|w|snnn}\n",argv[0]);
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/085e02827553bf86377206c1ef9ad4cca6d67338
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161023/e9339d58/attachment.html>
More information about the vc
mailing list