NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.32k stars 13.56k forks source link

s390x statically linked binaries terminate with segmentation fault #306473

Open saschagrunert opened 4 months ago

saschagrunert commented 4 months ago

Describe the bug

Statically linked binaries using glibc.static exit with terminated by signal SIGSEGV (Address boundary error).

Steps To Reproduce

Steps to reproduce the behavior using the demo project in https://github.com/saschagrunert/s390x-nix:

git clone https://github.com/saschagrunert/s390x-nix
cd s390x-nix 
# …
qemu-s390x result/bin/demo
# Segmentation fault (core dumped)

When removing the CFLAGS ?= -static in the Makefile, then it runs successfully:

nix-build nix
# …
qemu-s390x result/bin/demo
echo $?
# 0

It also works when using s390x-unknown-linux-musl.

Expected behavior

That the statically linked binaries don't segfault.

Screenshots

None

Additional context

None

Notify maintainers

@Ma27 @ConnorBaker @edolstra

Add a :+1: reaction to issues you find important.

Ma27 commented 4 months ago

Can you perhaps compile everything with debug symbols and get a backtrace? May help to identify the cause.

That being said, I'm pretty sure that s390 isn't a supported architecture here. Would you mind trying to reproduce the issue with a different glibc package? A quick google search shows that there seem to be Fedora RPMs: https://rpmfind.net/linux/rpm2html/search.php?query=glibc(s390-64) Because I'd prefer in this case to have it checked that we don't have an upstream bug, but something related to our packaging.