Tizen toolchain team in Samsung company is planning to build Tizen
for new arm 64 bit architecture - Aarch64. But package
"org.tizen.data-provider-slave" cannot be built for this architecture
because of the following build error:
error: cast from pointer to integer of different size
The reason that there is cast from type (int*) to type (int) in the
current implementation of function util_get_current_module. This cast
is correct for 32-bit architectures, since on them both (int*) and
(int) have the same size - 32 bits. But on 64-bit architectures
(int*) has size 64 bit and (int) has size 32 bit, and cast from one
to another can provide incorrect results.
This problem can be fixed just by simple replacement of (int)
variables with (size_t) variables, since it does not change the logic
of code and provide additional compatibility with 64-bit
architectures. This fix does not affect other functions, since only
types of local variables are changed.
The patch has been checked for build compatibility under armv7l, i586
and aarch64 architectures and build results are available at
https://build.tizen.org/package/show?package=org.tizen.data-provider-slave&project=devel%3Aarm_toolchain%3AMobile%3AMain
Change-Id: I21c47349f7d41f5b10a33f3772775cc208a43f75
Signed-off-by: Ilya Palachev <i.palachev@samsung.com>
*/
HAPI char *util_get_current_module(char **symbol)
{
- int *stack;
+ size_t *stack;
Dl_info dinfo;
char *ret;
pthread_attr_t attr;
- unsigned int stack_boundary = 0;
- unsigned int stack_size = 0;
+ size_t stack_boundary = 0;
+ size_t stack_size = 0;
register int i;
if (!pthread_getattr_np(pthread_self(), &attr)) {
}
ret = NULL;
- for (i = 0, stack = (int *)&stack; (unsigned int)stack < stack_boundary ; stack++, i++) {
+ for (i = 0, stack = (size_t *)&stack; (size_t)stack < stack_boundary ; stack++, i++) {
if (!dladdr((void *)*stack, &dinfo)) {
continue;
}