mailing list of musl libc
 help / color / mirror / code / Atom feed
* Segmentation fault on statically linked programs
@ 2019-03-01 12:08 James Larrowe
  2019-03-01 12:23 ` James Larrowe
  0 siblings, 1 reply; 4+ messages in thread
From: James Larrowe @ 2019-03-01 12:08 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 442 bytes --]

Any statically linked musl program gives a segmentation fault when run.

Output of GDB debugger:

Starting program: /home/chronos/user/Downloads/tarballs/busybox-1.30.1/test

Program received signal SIGSEGV, Segmentation fault.
0x0000000000401566 in __init_tls ()
(gdb) bt
#0  0x0000000000401566 in __init_tls ()
#1  0x0000000000000000 in ?? ()


Minimal example:

int main(void) { return 0; }


Please CC me, I'm not subscribed to the list.

[-- Attachment #2: Type: text/html, Size: 1194 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Segmentation fault on statically linked programs
  2019-03-01 12:08 Segmentation fault on statically linked programs James Larrowe
@ 2019-03-01 12:23 ` James Larrowe
  2019-03-01 12:23   ` James Larrowe
  0 siblings, 1 reply; 4+ messages in thread
From: James Larrowe @ 2019-03-01 12:23 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 672 bytes --]

This is the output of GDB when musl and the program itself are built with
-gdwarf-4 -g3 -fno-omit-frame-pointer:


On Fri, Mar 1, 2019 at 7:08 AM James Larrowe <larrowe.semaj11@gmail.com>
wrote:

> Any statically linked musl program gives a segmentation fault when run.
>
> Output of GDB debugger:
>
> Starting program: /home/chronos/user/Downloads/tarballs/busybox-1.30.1/test
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x0000000000401566 in __init_tls ()
> (gdb) bt
> #0  0x0000000000401566 in __init_tls ()
> #1  0x0000000000000000 in ?? ()
>
>
> Minimal example:
>
> int main(void) { return 0; }
>
>
> Please CC me, I'm not subscribed to the list.
>
>

[-- Attachment #2: Type: text/html, Size: 1768 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Segmentation fault on statically linked programs
  2019-03-01 12:23 ` James Larrowe
@ 2019-03-01 12:23   ` James Larrowe
  2019-03-01 14:21     ` Rich Felker
  0 siblings, 1 reply; 4+ messages in thread
From: James Larrowe @ 2019-03-01 12:23 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 979 bytes --]

Program received signal SIGSEGV, Segmentation fault.
0x00000000004018e6 in static_init_tls (aux=0x7fffffffdda0) at
src/env/__init_tls.c:90
90                      if (phdr->p_type == PT_PHDR)


On Fri, Mar 1, 2019 at 7:23 AM James Larrowe <larrowe.semaj11@gmail.com>
wrote:

> This is the output of GDB when musl and the program itself are built with
> -gdwarf-4 -g3 -fno-omit-frame-pointer:
>
>
> On Fri, Mar 1, 2019 at 7:08 AM James Larrowe <larrowe.semaj11@gmail.com>
> wrote:
>
>> Any statically linked musl program gives a segmentation fault when run.
>>
>> Output of GDB debugger:
>>
>> Starting program: /home/chronos/user/Downloads/tarballs/busybox-1.30.1/test
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> 0x0000000000401566 in __init_tls ()
>> (gdb) bt
>> #0  0x0000000000401566 in __init_tls ()
>> #1  0x0000000000000000 in ?? ()
>>
>>
>> Minimal example:
>>
>> int main(void) { return 0; }
>>
>>
>> Please CC me, I'm not subscribed to the list.
>>
>>

[-- Attachment #2: Type: text/html, Size: 2622 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Re: Segmentation fault on statically linked programs
  2019-03-01 12:23   ` James Larrowe
@ 2019-03-01 14:21     ` Rich Felker
  0 siblings, 0 replies; 4+ messages in thread
From: Rich Felker @ 2019-03-01 14:21 UTC (permalink / raw)
  To: musl

On Fri, Mar 01, 2019 at 07:23:50AM -0500, James Larrowe wrote:
> Program received signal SIGSEGV, Segmentation fault.
> 0x00000000004018e6 in static_init_tls (aux=0x7fffffffdda0) at
> src/env/__init_tls.c:90
> 90                      if (phdr->p_type == PT_PHDR)

You have a buggy version of binutils that produces invalid binaries
when static linking small programs. Either downgrade or apply the
patches from here:

https://git.alpinelinux.org/aports/tree/main/binutils?id=52c531d4b9b061dfced2844b15df5c5e3d2a1b43

Rich


> On Fri, Mar 1, 2019 at 7:23 AM James Larrowe <larrowe.semaj11@gmail.com>
> wrote:
> 
> > This is the output of GDB when musl and the program itself are built with
> > -gdwarf-4 -g3 -fno-omit-frame-pointer:
> >
> >
> > On Fri, Mar 1, 2019 at 7:08 AM James Larrowe <larrowe.semaj11@gmail.com>
> > wrote:
> >
> >> Any statically linked musl program gives a segmentation fault when run.
> >>
> >> Output of GDB debugger:
> >>
> >> Starting program: /home/chronos/user/Downloads/tarballs/busybox-1.30.1/test
> >>
> >> Program received signal SIGSEGV, Segmentation fault.
> >> 0x0000000000401566 in __init_tls ()
> >> (gdb) bt
> >> #0  0x0000000000401566 in __init_tls ()
> >> #1  0x0000000000000000 in ?? ()
> >>
> >>
> >> Minimal example:
> >>
> >> int main(void) { return 0; }
> >>
> >>
> >> Please CC me, I'm not subscribed to the list.
> >>
> >>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-03-01 14:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-01 12:08 Segmentation fault on statically linked programs James Larrowe
2019-03-01 12:23 ` James Larrowe
2019-03-01 12:23   ` James Larrowe
2019-03-01 14:21     ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).