Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 743349 - sys-libs/musl: usage of internal arch variable provides wrong ld name
Summary: sys-libs/musl: usage of internal arch variable provides wrong ld name
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: Normal normal
Assignee: Anthony Basile
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2020-09-18 14:28 UTC by Andrew Aladjev
Modified: 2021-11-10 03:41 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
clang musl i386 patch (clang-musl-i386.patch,500 bytes, patch)
2020-09-18 15:00 UTC, Andrew Aladjev
Details | Diff
relative patch for clang i386 (i386.patch,476 bytes, patch)
2020-09-18 20:23 UTC, Andrew Aladjev
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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 "ld-musl-i386.so.1" 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 "ld-musl-i386.so.1".
3. Compile one line c file using clang, it will be linked with "ld-musl-i686.so.1" and it won't work.
Comment 1 Andrew Aladjev 2020-09-18 14:36:36 UTC
Workaround: add "ld-musl-i686.so.1" -> "ld-musl-i386.so.1" 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