Compile with Android NDK r13b using clang

This commit is contained in:
Tatsuhiro Tsujikawa 2017-01-23 00:32:51 +09:00
parent 0387525b77
commit ba9f2c3ae2
5 changed files with 22 additions and 19 deletions

View File

@ -39,8 +39,9 @@ PATH="$TOOLCHAIN"/bin:"$PATH"
--without-libxml2 \ --without-libxml2 \
--disable-python-bindings \ --disable-python-bindings \
--disable-examples \ --disable-examples \
CC="$TOOLCHAIN"/bin/arm-linux-androideabi-gcc \ --disable-threads \
CXX="$TOOLCHAIN"/bin/arm-linux-androideabi-g++ \ CC="$TOOLCHAIN"/bin/arm-linux-androideabi-clang \
CXX="$TOOLCHAIN"/bin/arm-linux-androideabi-clang++ \
CPPFLAGS="-fPIE -I$PREFIX/include" \ CPPFLAGS="-fPIE -I$PREFIX/include" \
PKG_CONFIG_LIBDIR="$PREFIX/lib/pkgconfig" \ PKG_CONFIG_LIBDIR="$PREFIX/lib/pkgconfig" \
LDFLAGS="-fPIE -pie -L$PREFIX/lib" LDFLAGS="-fPIE -pie -L$PREFIX/lib"

View File

@ -411,7 +411,7 @@ void exec_binary() {
LOG(ERROR) << "Unblocking all signals failed: " LOG(ERROR) << "Unblocking all signals failed: "
<< xsi_strerror(error, errbuf.data(), errbuf.size()); << xsi_strerror(error, errbuf.data(), errbuf.size());
_Exit(EXIT_FAILURE); nghttp2_Exit(EXIT_FAILURE);
} }
auto exec_path = auto exec_path =
@ -419,7 +419,7 @@ void exec_binary() {
if (!exec_path) { if (!exec_path) {
LOG(ERROR) << "Could not resolve the executable path"; LOG(ERROR) << "Could not resolve the executable path";
_Exit(EXIT_FAILURE); nghttp2_Exit(EXIT_FAILURE);
} }
auto argv = make_unique<char *[]>(suconfig.argc + 1); auto argv = make_unique<char *[]>(suconfig.argc + 1);
@ -492,7 +492,7 @@ void exec_binary() {
if (execve(argv[0], argv.get(), envp.get()) == -1) { if (execve(argv[0], argv.get(), envp.get()) == -1) {
auto error = errno; auto error = errno;
LOG(ERROR) << "execve failed: errno=" << error; LOG(ERROR) << "execve failed: errno=" << error;
_Exit(EXIT_FAILURE); nghttp2_Exit(EXIT_FAILURE);
} }
} }
} // namespace } // namespace
@ -1170,7 +1170,7 @@ pid_t fork_worker_process(int &main_ipc_fd,
LOG(FATAL) << "Unblocking all signals failed: " LOG(FATAL) << "Unblocking all signals failed: "
<< xsi_strerror(error, errbuf.data(), errbuf.size()); << xsi_strerror(error, errbuf.data(), errbuf.size());
_Exit(EXIT_FAILURE); nghttp2_Exit(EXIT_FAILURE);
} }
close(ipc_fd[1]); close(ipc_fd[1]);
@ -1179,13 +1179,13 @@ pid_t fork_worker_process(int &main_ipc_fd,
if (rv != 0) { if (rv != 0) {
LOG(FATAL) << "Worker process returned error"; LOG(FATAL) << "Worker process returned error";
_Exit(EXIT_FAILURE); nghttp2_Exit(EXIT_FAILURE);
} }
LOG(NOTICE) << "Worker process shutting down momentarily"; LOG(NOTICE) << "Worker process shutting down momentarily";
// call exit(...) instead of _Exit to get leak sanitizer report // call exit(...) instead of nghttp2_Exit to get leak sanitizer report
_Exit(EXIT_SUCCESS); nghttp2_Exit(EXIT_SUCCESS);
} }
// parent process // parent process

View File

@ -36,13 +36,15 @@
#include <cassert> #include <cassert>
#ifndef HAVE__EXIT
#define nghttp2_Exit(status) _exit(status)
#else // HAVE__EXIT
#define nghttp2_Exit(status) _Exit(status)
#endif // HAVE__EXIT
#include "shrpx_log.h" #include "shrpx_log.h"
#ifndef HAVE__EXIT #define DIE() nghttp2_Exit(EXIT_FAILURE)
#define _Exit(status) _exit(status)
#endif // !HAVE__EXIT
#define DIE() _Exit(EXIT_FAILURE)
#if defined(HAVE_DECL_INITGROUPS) && !HAVE_DECL_INITGROUPS #if defined(HAVE_DECL_INITGROUPS) && !HAVE_DECL_INITGROUPS
inline int initgroups(const char *user, gid_t group) { return 0; } inline int initgroups(const char *user, gid_t group) { return 0; }

View File

@ -83,7 +83,7 @@ int exec_read_command(Process &proc, char *const argv[]) {
auto error = errno; auto error = errno;
LOG(FATAL) << "Unblocking all signals failed: errno=" << error; LOG(FATAL) << "Unblocking all signals failed: errno=" << error;
_Exit(EXIT_FAILURE); nghttp2_Exit(EXIT_FAILURE);
} }
dup2(pfd[1], 1); dup2(pfd[1], 1);
@ -94,7 +94,7 @@ int exec_read_command(Process &proc, char *const argv[]) {
auto error = errno; auto error = errno;
LOG(ERROR) << "Could not execute command: " << argv[0] LOG(ERROR) << "Could not execute command: " << argv[0]
<< ", execve() faild, errno=" << error; << ", execve() faild, errno=" << error;
_Exit(EXIT_FAILURE); nghttp2_Exit(EXIT_FAILURE);
} }
// unreachable // unreachable
} }
@ -111,7 +111,7 @@ int exec_read_command(Process &proc, char *const argv[]) {
auto error = errno; auto error = errno;
LOG(FATAL) << "Restoring all signals failed: errno=" << error; LOG(FATAL) << "Restoring all signals failed: errno=" << error;
_Exit(EXIT_FAILURE); nghttp2_Exit(EXIT_FAILURE);
} }
if (pid == -1) { if (pid == -1) {

View File

@ -161,7 +161,7 @@ void ipc_readcb(struct ev_loop *loop, ev_io *w, int revents) {
if (nread == 0) { if (nread == 0) {
// IPC socket closed. Perform immediate shutdown. // IPC socket closed. Perform immediate shutdown.
LOG(FATAL) << "IPC socket is closed. Perform immediate shutdown."; LOG(FATAL) << "IPC socket is closed. Perform immediate shutdown.";
_Exit(EXIT_FAILURE); nghttp2_Exit(EXIT_FAILURE);
} }
for (ssize_t i = 0; i < nread; ++i) { for (ssize_t i = 0; i < nread; ++i) {
@ -384,7 +384,7 @@ void nb_child_cb(struct ev_loop *loop, ev_child *w, int revents) {
LOG(FATAL) << "neverbleed process exitted; aborting now"; LOG(FATAL) << "neverbleed process exitted; aborting now";
_Exit(EXIT_FAILURE); nghttp2_Exit(EXIT_FAILURE);
} }
} // namespace } // namespace
#endif // HAVE_NEVERBLEED #endif // HAVE_NEVERBLEED