Skip to content
Snippets Groups Projects
Commit a1ac84cd authored by Adam Lesinski's avatar Adam Lesinski
Browse files

MingW doesn't handle __attribute__((weak)) for Windows PE

Windows PE format doesn't have the same support for weak symbols
as ELF does.

The symbol android_log_id_to_name was strangely omitted from the
resulting Windows executable and the callsite where it was supposed
to be called was relaced with a different symbol, which caused a crash
in AAPT on Windows.

This change works due to a careful set of #ifdefs that ensure only one
definition of android_log_id_to_name is defined, but there are other
uses of __attribute__((weak)) which should be inspected.

Change-Id: I3b58076e31d9b28c5143773a170e9ffda9fa3815
parent 1c77bf4c
No related branches found
No related tags found
No related merge requests found
...@@ -58,7 +58,6 @@ static pthread_mutex_t log_init_lock = PTHREAD_MUTEX_INITIALIZER; ...@@ -58,7 +58,6 @@ static pthread_mutex_t log_init_lock = PTHREAD_MUTEX_INITIALIZER;
#endif #endif
#if FAKE_LOG_DEVICE #if FAKE_LOG_DEVICE
#define WEAK __attribute__((weak))
static int log_fds[(int)LOG_ID_MAX] = { -1, -1, -1, -1, -1 }; static int log_fds[(int)LOG_ID_MAX] = { -1, -1, -1, -1, -1 };
#else #else
static int logd_fd = -1; static int logd_fd = -1;
...@@ -274,7 +273,7 @@ static const char *LOG_NAME[LOG_ID_MAX] = { ...@@ -274,7 +273,7 @@ static const char *LOG_NAME[LOG_ID_MAX] = {
[LOG_ID_CRASH] = "crash" [LOG_ID_CRASH] = "crash"
}; };
const WEAK char *android_log_id_to_name(log_id_t log_id) const char *android_log_id_to_name(log_id_t log_id)
{ {
if (log_id >= LOG_ID_MAX) { if (log_id >= LOG_ID_MAX) {
log_id = LOG_ID_MAIN; log_id = LOG_ID_MAIN;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment