TS-3823: * ASAN makes us forget to add -ldl on the LIBS * Fix tests for -lpthread, and undo some of TS-3308. This retains the support for ASAN in a cleaner way
(cherry picked from commit a0a74505e279b69a5ca5a6eb7fa7a3a97136fe90) (cherry picked from commit b4dea28aaed390f1def4248a79361099cbb0b717) (cherry picked from commit fe64607f236ca8bb4a0911eb8ad1d5c17ba90b81) Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/c9ac053a Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/c9ac053a Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/c9ac053a Branch: refs/heads/5.3.x Commit: c9ac053a052c1077f859bbac3f9287507358b131 Parents: 4185ea7 Author: Leif Hedstrom <[email protected]> Authored: Wed Aug 5 13:54:38 2015 -0600 Committer: Phil Sorber <[email protected]> Committed: Wed Sep 2 11:33:40 2015 -0600 ---------------------------------------------------------------------- cmd/traffic_crashlog/Makefile.am | 2 +- cmd/traffic_layout/Makefile.am | 2 +- cmd/traffic_manager/Makefile.am | 2 +- configure.ac | 11 +++++++---- proxy/Makefile.am | 6 ++---- 5 files changed, 12 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c9ac053a/cmd/traffic_crashlog/Makefile.am ---------------------------------------------------------------------- diff --git a/cmd/traffic_crashlog/Makefile.am b/cmd/traffic_crashlog/Makefile.am index 558b801..3621521 100644 --- a/cmd/traffic_crashlog/Makefile.am +++ b/cmd/traffic_crashlog/Makefile.am @@ -44,4 +44,4 @@ traffic_crashlog_LDADD = \ $(top_builddir)/proxy/shared/libUglyLogStubs.a \ $(top_builddir)/mgmt/api/libtsmgmt.la \ $(top_builddir)/lib/ts/libtsutil.la \ - @LIBTCL@ @HWLOC_LIBS@ @LIBPTHREAD@ + @LIBTCL@ @HWLOC_LIBS@ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c9ac053a/cmd/traffic_layout/Makefile.am ---------------------------------------------------------------------- diff --git a/cmd/traffic_layout/Makefile.am b/cmd/traffic_layout/Makefile.am index 571a42a..15a24a9 100644 --- a/cmd/traffic_layout/Makefile.am +++ b/cmd/traffic_layout/Makefile.am @@ -40,4 +40,4 @@ traffic_layout_LDADD = \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/proxy/shared/libUglyLogStubs.a \ $(top_builddir)/lib/ts/libtsutil.la \ - @LIBTCL@ @HWLOC_LIBS@ @LIBPTHREAD@ + @LIBTCL@ @HWLOC_LIBS@ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c9ac053a/cmd/traffic_manager/Makefile.am ---------------------------------------------------------------------- diff --git a/cmd/traffic_manager/Makefile.am b/cmd/traffic_manager/Makefile.am index 4f634e4..521c45f 100644 --- a/cmd/traffic_manager/Makefile.am +++ b/cmd/traffic_manager/Makefile.am @@ -60,7 +60,7 @@ traffic_manager_LDADD = \ $(top_builddir)/proxy/shared/liberror.a \ $(top_builddir)/proxy/shared/libdiagsconfig.a \ $(LIBUNWIND_LIBS) \ - @LIBRESOLV@ @LIBEXPAT@ @LIBPCRE@ @LIBTCL@ @LIBCAP@ @HWLOC_LIBS@ @LIBPTHREAD@ \ + @LIBRESOLV@ @LIBEXPAT@ @LIBPCRE@ @LIBTCL@ @LIBCAP@ @HWLOC_LIBS@ \ -lm # Must do it this way or the dependencies aren't detected. http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c9ac053a/configure.ac ---------------------------------------------------------------------- diff --git a/configure.ac b/configure.ac index e8d3ac9..fe2af20 100644 --- a/configure.ac +++ b/configure.ac @@ -1097,15 +1097,18 @@ fi AC_SEARCH_LIBS([exc_capture_context], [exc], [], []) AC_SEARCH_LIBS([MLD_demangle_string], [mld], [], []) -AC_SEARCH_LIBS([dlopen], [dl], [], []) AC_SEARCH_LIBS([socket], [socket], [], []) AC_SEARCH_LIBS([gethostbyname], [nsl], [], []) AC_SEARCH_LIBS([clock_gettime], [rt], [], []) AC_SEARCH_LIBS([clock_gettime], [posix4], [], []) -dnl Linux has pthread symbol stubss in both libc ad libpthread, so it's important to test -dnl specifically for pthread_create() here. -AC_SEARCH_LIBS([pthread_create], [pthread],[AC_SUBST([LIBPTHREAD],["-lpthread"])], []) +dnl We check for dlsym here instead of e.g. dlopen() because ASAN hijacks the latter. +AC_SEARCH_LIBS([dlsym], [dl], [], []) + +dnl Linux has pthread symbol stubss in both libc and libpthread, so it's important to test +dnl specifically for pthread_yield() here. In addition, ASAN hijacks pthread_create() so +dnl we can't use that anymore. +AC_SEARCH_LIBS([pthread_yield], [pthread], [], []) dnl XXX The following check incorrectly causes the build to succeed dnl on Darwin. We should be using AC_SEARCH_LIBS, but rest_init is http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c9ac053a/proxy/Makefile.am ---------------------------------------------------------------------- diff --git a/proxy/Makefile.am b/proxy/Makefile.am index ce5041f..505fc56 100644 --- a/proxy/Makefile.am +++ b/proxy/Makefile.am @@ -239,7 +239,6 @@ traffic_server_LDADD = \ @LIBPROFILER@ \ @SPDYLAY_LIBS@ \ @OPENSSL_LIBS@ \ - @LIBPTHREAD@ \ -lm if BUILD_LUAJIT @@ -261,7 +260,7 @@ traffic_logcat_LDADD = \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/lib/ts/libtsutil.la \ @LIBRESOLV@ @LIBPCRE@ @LIBTCL@ @HWLOC_LIBS@\ - @LIBEXPAT@ @LIBPROFILER@ @LIBPTHREAD@ -lm + @LIBEXPAT@ @LIBPROFILER@ -lm traffic_logstats_SOURCES = logstats.cc traffic_logstats_LDADD = \ @@ -274,7 +273,7 @@ traffic_logstats_LDADD = \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/lib/ts/libtsutil.la \ @LIBRESOLV@ @LIBPCRE@ @LIBTCL@ @HWLOC_LIBS@ \ - @LIBEXPAT@ @LIBPROFILER@ @LIBPTHREAD@ -lm + @LIBEXPAT@ @LIBPROFILER@ -lm traffic_sac_SOURCES = \ sac.cc \ @@ -339,7 +338,6 @@ traffic_sac_LDADD = \ @LIBPROFILER@ \ @SPDYLAY_LIBS@ \ @OPENSSL_LIBS@ \ - @LIBPTHREAD@ \ -lm if BUILD_TESTS
