Skip to contentSkip to conversation

New: musl gcc has ifunc enabled when musl doesn't support it

Buildroot bugzilla at busybox.net 1 participant 5 messages Dec 13, 2017 – Sep 7, 2019

lore
Share & tools
lore
#0 lore raw

https://bugs.busybox.net/show_bug.cgi?id=10586

Bug ID: 10586
Summary: musl gcc has ifunc enabled when musl doesn't support
it
Product: buildroot
Version: unspecified
Hardware: All
OS: Linux
Status: NEW
Severity: normal
Priority: P5
Component: Other
Assignee: unassigned at buildroot.uclibc.org
Reporter: nathan.renniewaldock at gmail.com
CC: buildroot at uclibc.org
Target Milestone: ---

musl doesn't support ifunc[1], so needs to be specifically disabled as it defaults to enabled.

Test case[2]:

$ cat >a.c <<EOD
int main(){ return 0; }
EOD
$ gcc -o a a.c -latomic
$ ./a
Error relocating /lib/libatomic.so.1: __atomic_store_8: symbol not found
Error relocating /lib/libatomic.so.1: __atomic_exchange_8: symbol not found
Error relocating /lib/libatomic.so.1: __atomic_load_8: symbol not found
Error relocating /lib/libatomic.so.1: __atomic_compare_exchange_8: symbol not
found

[1] http://www.openwall.com/lists/musl/2014/11/11/2
[2] http://www.openwall.com/lists/musl/2015/11/17/9

(tested buildroot 2017.11)

Signature · 2 lines
You are receiving this mail because:
You are on the CC list for the bug.
#1 lore raw

[Buildroot] [Bug 10586] musl gcc has ifunc enabled when musl doesn't support it

https://bugs.busybox.net/show_bug.cgi?id=10586

Carlos Santos <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

           Assignee|unassigned at buildroot.uclibc |unixmania at gmail.com
                   |.org                        |
             Status|NEW                         |ASSIGNED

--- Comment #1 from Carlos Santos <[email protected]> --- Sorry for the late answer. I'm taking this bug.

I can't reproduce this on a system buit with the following defconfig:

BR2_x86_64=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y BR2_TOOLCHAIN_EXTERNAL_URL="https://toolchains.bootlin.com/downloads/releases/toolchains/x86-64-core-i7/tarballs/x86-64-core-i7--musl--bleeding-edge-2018.11-1.tar.bz2" BR2_TOOLCHAIN_EXTERNAL_GCC_8=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_14=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_MUSL=y
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY=y
BR2_SYSTEM_DHCP="eth0"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.19.16"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/x86_64/linux.config"
BR2_TARGET_ROOTFS_EXT2=y
# BR2_TARGET_ROOTFS_TAR is not set

$ echo 'int main(){ return 0; }' > /tmp/a.c
$ host/bin/x86_64-linux-gcc -o target/root/a /tmp/a.c -latomic
$ host/bin/x86_64-linux-readelf -d target/root/a

Dynamic section at offset 0x2eb0 contains 16 entries:
Tag Type Name/Value

 0x0000000000000001 (NEEDED)             Shared library: [libatomic.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so]
 0x000000000000000c (INIT)               0x401000
 0x000000000000000d (FINI)               0x401175
 0x0000000000000004 (HASH)               0x400290
 0x000000006ffffef5 (GNU_HASH)           0x4002b8
 0x0000000000000005 (STRTAB)             0x400340
 0x0000000000000006 (SYMTAB)             0x4002e0
 0x000000000000000a (STRSZ)              54 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000015 (DEBUG)              0x0
 0x0000000000000003 (PLTGOT)             0x404000
 0x0000000000000002 (PLTRELSZ)           24 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x400378
 0x0000000000000000 (NULL)               0x0
$ make
$ qemu-kvm -M pc -m 1024 -kernel "images/bzImage" \
  -drive file=images/rootfs.ext2,if=virtio,format=raw \
  -append "root=/dev/vda console=ttyS0,115200n8 net.ifnames=0" \
  -net nic,model=virtio -net "user${hostfwd}" -nographic -enable-kvm \
  -rtc base=utc -device virtio-rng-pci -watchdog i6300esb
[...]
Welcome to Buildroot
buildroot login: root
# ./a
# 

Can you still see the error?

Could you please post a defconfig on which the problem happens?

Signature · 2 lines
You are receiving this mail because:
You are on the CC list for the bug.
#4 lore raw

[Buildroot] [Bug 10586] musl gcc has ifunc enabled when musl doesn't support it

In reply to bugzilla at busybox.net

https://bugs.busybox.net/show_bug.cgi?id=10586

Carlos Santos <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |NEEDINFO

--- Comment #4 from Carlos Santos <[email protected]> --- Closing, since it could not be reproduced and the submitter did not provide additional information. Feel free to reopen if newer evidences raise.

Signature · 2 lines
You are receiving this mail because:
You are on the CC list for the bug.