Fix build (take two).

Make sure __netdClientDispatch is defined in the same set of libraries that
refer to it (e.g.: with connect.cpp).

Change-Id: I86d7bf2df5bde09f75a35b204eac0e1361747e22
This commit is contained in:
Sreeram Ramachandran
2014-05-13 17:24:03 -07:00
parent 2ed09d44ec
commit 8205a61248
3 changed files with 34 additions and 19 deletions

View File

@@ -14,24 +14,14 @@
* limitations under the License.
*/
#ifdef LIBC_STATIC
#error NetdClient.cpp should NOT be included in static libc builds.
#endif
#include <private/NetdClient.h>
#include <private/libc_logging.h>
#include <pthread.h>
#ifdef __i386__
#define __socketcall __attribute__((__cdecl__))
#else
#define __socketcall
#endif
extern "C" __socketcall int __connect(int, const sockaddr*, socklen_t);
NetdClientDispatch __netdClientDispatch __attribute__((aligned(32))) = {
__connect
};
#ifndef LIBC_STATIC
#include <dlfcn.h>
template <typename FunctionType>
@@ -56,13 +46,9 @@ static void netdClientInitImpl() {
static pthread_once_t netdClientInitOnce = PTHREAD_ONCE_INIT;
#endif // LIBC_STATIC
extern "C" __LIBC_HIDDEN__ void netdClientInit() {
#ifndef LIBC_STATIC
if (pthread_once(&netdClientInitOnce, netdClientInitImpl)) {
__libc_format_log(ANDROID_LOG_ERROR, "netdClient",
"Unable to initialize netd_client component.");
}
#endif // LIBC_STATIC
}