Coder Social home page Coder Social logo

Many tests fail with musl libc about mold HOT 25 CLOSED

rui314 avatar rui314 commented on July 18, 2024
Many tests fail with musl libc

from mold.

Comments (25)

rui314 avatar rui314 commented on July 18, 2024 1

@Logarithmus They failed because a stack frame was not properly aligned to a 16-byte boundary. The x86-64 psABI requires that when you make a function call (i.e. when you execute call instruction), %rsp must be aligned to a 16-byte boundary.

call instruction pushes a 8-byte return address to the stack. So, at the beginning of a function, %rsp is not aligned to a 16-byte boundary, so you need to adjust %rsp (e.g. pushing %rsp by 8 bytes) before making another call. I didn't do that.

If you do not do that, some instructions sensitive to alignment requirement may fail. glibc's printf is not sensitive to the alignment requirement unless you try to print out floating-point values (if you try to do that, it segfaults). It looks like musl's printf is always sensitive. So the tests failed.

from mold.

rui314 avatar rui314 commented on July 18, 2024

No, it's odd. Is there any way to download the object files from the CI or run the same thing on my local environment?

from mold.

Logarithmus avatar Logarithmus commented on July 18, 2024

@rui314 https://hub.docker.com/r/voidlinux/voidlinux-musl

from mold.

rui314 avatar rui314 commented on July 18, 2024

Thanks. I'll give it a try.

from mold.

rui314 avatar rui314 commented on July 18, 2024

A noob question, but the environment built by docker pull voidlinux/voidlinux-musl doesn't contain any developer tools. How can I install a compiler, make and so on into it? I'm not familiar with Void Linux's package manager.

from mold.

Logarithmus avatar Logarithmus commented on July 18, 2024

@rui314 #67 (comment)

from mold.

rui314 avatar rui314 commented on July 18, 2024

This test assumed that the default output is position-dependent, which actually depends on how your compiler was built. I made it explicit by adding -no-pie.

from mold.

Logarithmus avatar Logarithmus commented on July 18, 2024

@rui314 what about a new tag?

from mold.

rui314 avatar rui314 commented on July 18, 2024

Do you mean a new version of the linker, like 0.9.3?

from mold.

Logarithmus avatar Logarithmus commented on July 18, 2024

@rui314 yeah, you know I need a new release to use this fix in a package

from mold.

rui314 avatar rui314 commented on July 18, 2024

OK, let me create 0.9.3-pre1 so that you can test it.

from mold.

rui314 avatar rui314 commented on July 18, 2024

Please test with this tag. https://github.com/rui314/mold/tree/v0.9.3-rc1

from mold.

rui314 avatar rui314 commented on July 18, 2024

I created a new release candidate https://github.com/rui314/mold/tree/v0.9.3-rc2
It includes a fix of --sysroot flag handling.

from mold.

Logarithmus avatar Logarithmus commented on July 18, 2024

@rui314 see #89 (comment)

from mold.

rui314 avatar rui314 commented on July 18, 2024

I somehow thought that test/canonical-plt.sh is the only failing test. I'll take a look at other failures.

from mold.

Logarithmus avatar Logarithmus commented on July 18, 2024

@rui314 I think some of them can't run successfully due to musl lacking some features of glibc e. g ifunc. So it would be nice to detect system libc somewhere in test/Makefile and conditionally skip those tests. Though some tests can be fixed I guess.

from mold.

Logarithmus avatar Logarithmus commented on July 18, 2024

@rui314 this thread might be helpful: https://news.ycombinator.com/item?id=22680577

from mold.

rui314 avatar rui314 commented on July 18, 2024

@Logarithmus Is there any way to install i386 dev tools to musl Void Linux? Or is it 64-bit only?

from mold.

rui314 avatar rui314 commented on July 18, 2024

Except i386 tests, I believe I fixed all musl-related failures in the main branch. Since cherrypicking these changes will be more riskier than making a full release, 0.9.3 will be a full release instead of bug-fix-only release.

from mold.

rui314 avatar rui314 commented on July 18, 2024

I think mold at the head of the git main branch is now cleanly built and tested on Void Linux with musl.

from mold.

rui314 avatar rui314 commented on July 18, 2024

@Logarithmus I tagged v0.9.3-rc3 as a new release candidate.

from mold.

Logarithmus avatar Logarithmus commented on July 18, 2024

@Logarithmus Is there any way to install i386 dev tools to musl Void Linux? Or is it 64-bit only?

Unfortunately, musl doesn't support multilib (running 32-bit programs with 64-bit libc). Also Void Linux doesn't have i686-musl variant, only glibc one. I don't know why.

from mold.

Logarithmus avatar Logarithmus commented on July 18, 2024

@Logarithmus I tagged v0.9.3-rc3 as a new release candidate.

OK thanks, I'll check it out!

from mold.

Logarithmus avatar Logarithmus commented on July 18, 2024

@rui314 do you know why those pieces of assembly used to fail with musl?280892f#diff-5725ceb876566e601501d9b70812c960b4fd5efaf2e8919e73a41c436fc9c308
Maybe it has to do with @PLT stuff? What does call printf@PLT mean by the way?

from mold.

rui314 avatar rui314 commented on July 18, 2024

I'm closing this bug as the bug has been fixed.

from mold.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.