Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 743349

Summary: sys-libs/musl: usage of internal arch variable provides wrong ld name
Product: Gentoo Linux Reporter: Andrew Aladjev <aladjev.andrew>
Component: Current packagesAssignee: Anthony Basile <blueness>
Status: UNCONFIRMED ---    
Severity: normal CC: aladjev.andrew, jstein, lu_zero, musl, toolchain
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: x86   
OS: Linux   
Package list:
Runtime testing required: ---
Attachments: clang musl i386 patch
relative patch for clang i386

Description Andrew Aladjev 2020-09-18 14:28:27 UTC
Musl library uses the following mechanism to detect arch:

case "$target" in
i?86*) ARCH=i386

Musl uses same code across *86 targets, developers want just to call source code folders as "i386". "ARCH" from musl "config.mak" is not target architecture, this is just special name for internal usage. This variable was not designed to be used as architecture name.

# Fish out of config:
#   ARCH = ...
#   SUBARCH = ...
# and print $(ARCH)$(SUBARCH).
  local arch=$(awk '{ k[$1] = $3 } END { printf("%s%s", k["ARCH"], k["SUBARCH"]); }' config.mak)
  [[ -e "${D}"/lib/ld-musl-${arch}.so.1 ]] || die

It means that all *86 targets will have "" wrong ld name.

Reproducible: Always

Steps to Reproduce:
1. Use i686-gentoo-linux-musl image and emerge gcc + clang.
2. Compile one line c file using gcc, it will be linked with "".
3. Compile one line c file using clang, it will be linked with "" and it won't work.
Comment 1 Andrew Aladjev 2020-09-18 14:36:36 UTC
Workaround: add "" -> "" symlink after musl re-installation.
Comment 2 Andrew Aladjev 2020-09-18 15:00:05 UTC
Created attachment 661167 [details, diff]
clang musl i386 patch
Comment 3 Andrew Aladjev 2020-09-18 15:01:11 UTC
Personally I don't like symlink workarounds, than I am going to use patched clang for i686-gentoo-linux-musl image.
Comment 4 Andrew Aladjev 2020-09-18 20:23:46 UTC
Created attachment 661263 [details, diff]
relative patch for clang i386

quick fix: relative path to clang folder