Merge "Add test for pthread types alignment check."
diff --git a/libc/bionic/pthread_create.cpp b/libc/bionic/pthread_create.cpp
index a4bd054..5389f14 100644
--- a/libc/bionic/pthread_create.cpp
+++ b/libc/bionic/pthread_create.cpp
@@ -162,15 +162,16 @@
}
// Mapped space(or user allocated stack) is used for:
- // thread_internal_t
+ // pthread_internal_t
// thread stack (including guard page)
- stack_top -= sizeof(pthread_internal_t);
+
+ // To safely access the pthread_internal_t and thread stack, we need to find a 16-byte aligned boundary.
+ stack_top = reinterpret_cast<uint8_t*>(
+ (reinterpret_cast<uintptr_t>(stack_top) - sizeof(pthread_internal_t)) & ~0xf);
+
pthread_internal_t* thread = reinterpret_cast<pthread_internal_t*>(stack_top);
attr->stack_size = stack_top - reinterpret_cast<uint8_t*>(attr->stack_base);
- // No need to check stack_top alignment. The size of pthread_internal_t is 16-bytes aligned,
- // and user allocated stack is guaranteed by pthread_attr_setstack.
-
thread->mmap_size = mmap_size;
thread->attr = *attr;
__init_tls(thread);
diff --git a/libc/bionic/pthread_internal.h b/libc/bionic/pthread_internal.h
index 538e0da..13964c2 100644
--- a/libc/bionic/pthread_internal.h
+++ b/libc/bionic/pthread_internal.h
@@ -103,7 +103,7 @@
*/
#define __BIONIC_DLERROR_BUFFER_SIZE 512
char dlerror_buffer[__BIONIC_DLERROR_BUFFER_SIZE];
-} __attribute__((aligned(16))); // Align it as thread stack top below it should be aligned.
+};
__LIBC_HIDDEN__ int __init_thread(pthread_internal_t* thread, bool add_to_thread_list);
__LIBC_HIDDEN__ void __init_tls(pthread_internal_t* thread);
diff --git a/linker/linker.h b/linker/linker.h
index 04acda4..05735f6 100644
--- a/linker/linker.h
+++ b/linker/linker.h
@@ -149,13 +149,13 @@
ElfW(Addr) base;
size_t size;
-#ifndef __LP64__
+#if defined(__arm__)
uint32_t unused1; // DO NOT USE, maintained for compatibility.
#endif
ElfW(Dyn)* dynamic;
-#ifndef __LP64__
+#if defined(__arm__)
uint32_t unused2; // DO NOT USE, maintained for compatibility
uint32_t unused3; // DO NOT USE, maintained for compatibility
#endif
diff --git a/tools/bionicbb/gmail_listener.py b/tools/bionicbb/gmail_listener.py
index 0cd31c9..770f0c4 100644
--- a/tools/bionicbb/gmail_listener.py
+++ b/tools/bionicbb/gmail_listener.py
@@ -190,8 +190,10 @@
if lunch_target is not None:
params['LUNCH_TARGET'] = lunch_target
if not dry_run:
- job = jenkins[build].invoke(build_params=params)
- url = job.get_build().baseurl
+ _ = jenkins[build].invoke(build_params=params)
+ # https://issues.jenkins-ci.org/browse/JENKINS-27256
+ # url = job.get_build().baseurl
+ url = 'URL UNAVAILABLE'
else:
url = 'DRY_RUN_URL'
print '{}({}): {} => {} {} {}'.format(