Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Wed, 2 Dec 2015 16:37:33 -0500
From: N Jain <jain61@...il.com>
To: Rich Felker <dalias@...c.org>
Cc: musl@...ts.openwall.com
Subject: Re: MUSL 1.1.10 Static linking issue

Hi Rich,

Thanks. I was trying to find the correct email id as my previous message
bounced.


> I assume you mean gcc 5.2.0 targeting musl?

Yes it is correct I am using musl 1.1.10 with gcc5.2.0.

 > 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.

> I can't tell from your email exactly what you're trying
to do, though.

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 ?

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 ?

Can you please give me some pointers as how to resolve this ?

Thanks,
NJ



On Tue, Dec 1, 2015 at 7:37 PM, Rich Felker <dalias@...c.org> wrote:

> I've CC'd the musl list which I think you intended to do; your
> original cc was to musl-admin rather than musl so it didn't make it to
> the list.
>
> On Tue, Dec 01, 2015 at 12:37:28PM -0500, N Jain wrote:
> > Hi,
> >
> >
> > I am using MUSL 5.2.0 latest compiler for compiling my ARM application
> but
>
> I assume you mean gcc 5.2.0 targeting musl?
>
> > when I try to run the application I am getting issue at __set_thread_area
> > API.
>
> Can you show the actual error you're getting?
>
> > I am not sure if the static linking is broken for MUSL 5.2.0 ? I am using
> > following command to compile the application and using "-static" option
> > while linking to ignore dynamic linking.
> >
> > Please let me know how to avoid dynamic linking and how to resolve this
> ? I
> > do want dynamic as well static linking capabilities so I am generating
> > compile with default configuration.
> >
> > arm-linux-musleabi-gcc -static-libgcc -static-libstdc++ -I. -MD -MP
> > -mcpu=cortex-a15  -O2 -g  -Wall -Werror  -std=gnu11  -D_POSIX_SOURCE -c
> > hello.c -o hello.o
> >
> > arm-linux-musleabi-ld -static -nostartfiles $(OBJS) libs.a -Tlink.ld -o
> > app.elf
>
> Using ld directly is not expected to work unless you reproduce all the
> options the compiler driver (gcc) would pass to it; the main place you
> _might_ want to invoke ld directly is when doing
> freestanding/bare-metal development, but musl is not going to be
> useful for this out of the box; you'd need to customize it to your
> environment. I can't tell from your email exactly what you're trying
> to do, though.
>
> Rich
>

Content of type "text/html" skipped

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.