mold: `strip` complains that sh_link not set for section `.ARM.exidx'

I’m trying to integrate mold to a project I’m working on which targets a couple of platforms. When I target arm32, the resulting binaries can’t be stripped. I get:

arm-poky-linux-gnueabi-strip a.out
arm-poky-linux-gnueabi-strip: stXenxod: warning: sh_link not set for section `.ARM.exidx'
[1]    452210 segmentation fault (core dumped)   a.out

Unfortunately I can’t share much on that since it comes from a private repo, so this might be hard to debug. I tried to reproduce this with some public toolchain and a simple hello world and I get a segfault as well but without the .ARM.exidx message. Toolchain: arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-linux-gnueabihf.tar.xz Code:

#include <iostream>

int main(){
    std::cout << "Hello world" << std::endl;
    return 0;
}

Compiled with:

arm-none-linux-gnueabihf-g++ -B/usr/local/libexec/mold main.cpp -L../arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-linux-gnueabihf/arm-none-linux-gnueabihf/libc/

By the way that extra -L line is annoying. Is there a reason for it? Otherwise mold says it can’t find libc. So far this extra line + having to remove --no-map-whole-files have been the only changes I had to do to make mold a drop in replacement on my codebase.

  ^ library not found: /lib/libc.so.6

If I try to strip:

arm-none-linux-gnueabihf-strip a.out                                                                                                                           
[1]    458228 segmentation fault (core dumped)  arm-none-linux-gnueabihf-strip a.out

I’m using mold 1.6

readelf -p .comment a.out

String dump of section '.comment':
  [     0]  mold 1.6.0 (323ad30e25c2c81efdb07ab76601a119335a40c8; compatible with GNU ld)
  [    4e]  GCC: (Arm GNU Toolchain 11.3.Rel1) 11.3.1 20220712

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (15 by maintainers)

Most upvoted comments

I think that we might be able to do something on our side, I just didn’t have enough time to investigate.