Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Thu, 3 Dec 2015 00:33:57 +0100
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Cc: Rich Felker <dalias@...c.org>
Subject: Re: Re: MUSL 1.1.10 Static linking issue

* N Jain <jain61@...il.com> [2015-12-02 16:37:33 -0500]:
>  > Can you show the actual error you're getting?
> 
> I am getting run time failure and the issue is in __set_thread_area.c file
> 
> int __set_thread_area(void *p)
> {
> #if !__ARM_ARCH_7A__ && !__ARM_ARCH_7R__ && __ARM_ARCH < 7
> if (__hwcap & HWCAP_TLS) {
>                 .....
> }
> } else {
> *int ver = *(int *)0xffff0ffc;*
> * SET(gettp, kuser);*
> * SET(cas, kuser);*
> * SET(barrier, kuser);*
> * if (ver < 2) a_crash();*
> * if (ver < 3) SET(barrier, oldkuser);*
> }
> #endif
> return __syscall(0xf0005, p);
> }
> 
> I used debugger to root cause and found that while generating toolchain
> __ARM_ARCH_7A option is not getting configured correctly.
> I am reaching to "else" part and getting abort at 0xffff0ffc.
> 

you compiled musl for < armv7-a
(musl keeps compatibility so the binary should work
on >=armv7-a too).

the kernel did not report tls support in hwcap,
nor it had the kernel helper pages.
sounds like a broken kernel to me.

dumping the auxv and /proc/cpuinfo could be useful,
(but dont know how to display the auxv easily).

> I am trying to compile an ARM OS user application using generated toolchain
> (I am following link -
> https://github.com/GregorR/musl-cross).
> 
> I can generate the toolchain successfully though not sure what
> configuration options I am missing during toolchain generation as passing
>  " -mcpu=cortex-a15"  to compiler is not configuring __ARM_ARCH_7A__ macro ?
> 

in musl-cross you need something like

TRIPLE=arm-linux-musleabihf
GCC_BOOTSTRAP_CONFFLAGS="--with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16"
GCC_CONFFLAGS="--with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16"

for more gcc options see
http://gcc.gnu.org/install/configure.html

you can test the toolchain by

 gcc -v

and

 gcc -E -dM - </dev/null |grep ARM

shows the predefined arm macros

http://infocenter.arm.com/help/topic/com.arm.doc.ihi0053c/index.html

> I am using scripts config.sh but only configuring "ARCH=arm". I need
> toolchain for cortex-a15 but there is no option to do so ?
> 

pass the -m* options in CFLAGS when configuring musl
if you want further control over code generation.

http://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.