Page MenuHomeFreeBSD

Update mold to 2.4.0
AbandonedPublic

Authored by aokblast on Feb 3 2024, 7:31 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, May 3, 7:21 PM
Unknown Object (File)
Fri, May 3, 7:21 PM
Unknown Object (File)
Fri, May 3, 7:21 PM
Unknown Object (File)
Sat, Apr 27, 8:05 AM
Unknown Object (File)
Sat, Apr 27, 8:00 AM
Unknown Object (File)
Sat, Apr 27, 7:52 AM
Unknown Object (File)
Sat, Apr 27, 7:52 AM
Unknown Object (File)
Sat, Apr 27, 7:52 AM
Subscribers

Details

Summary

I build mold project with strip tool in the elftoolchain and the problem in #456 seems disappeared.

I have tested this patch by building the whole llvm project with mold and their is no problem on that.

BTW, mold replace the Makefile with CMake in the recent version. So I also modify the port to make it work.

Diff Detail

Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 55796
Build 52685: arc lint + arc unit

Event Timeline

aokblast created this revision.
aokblast added a reviewer: lwhsu.

A few other switches that needs to be looked at:
BUILD_TESTING:BOOL=ON
Can we enable unit tests? Should be disabled otherwise

Useful?
MOLD_LTO

Other switches
MOLD_USE_MIMALLOC
MOLD_USE_SYSTEM_MIMALLOC
MOLD_USE_SYSTEM_TBB

ZSTD? External, bundled, disabled?
BLAKE3? External, bundled, disabled?

devel/mold/Makefile
20–21

This is handled by CMAKE switches

20–21

It's a C-project (looking at the documentation) and we can use USES= localbase:ldflags

20–21

Likely unnecessary

diizzy requested changes to this revision.Feb 3 2024, 8:12 AM
This revision now requires changes to proceed.Feb 3 2024, 8:12 AM
This comment was removed by aokblast.
  • Update to latest version with PR#1186
aokblast marked 3 inline comments as done.EditedFeb 3 2024, 7:41 PM

All fixed but I don't find blake3 in FreeBSD port.

This patch is inspired by previous work.

I send a PR and is accepted by the author that can solve the strip problem in FreeBSD as previous work and github issue have mentioned.

Have you done any runtime testing and if so one what platform and OS version?

devel/mold/Makefile
2–5

Why are we switching to bleeding edge?

29

Are unit test broken otherwise have a look at USES= cmake:testing
Reference:
https://cgit.freebsd.org/ports/tree/Mk/Uses/cmake.mk

32
35

We always prefer using libraries from ports so this can be removed and moved to CMAKE_ON=

Reference:
https://docs.freebsd.org/en/books/porters-handbook/book/#bundled-libs-practices

42

Same as with TBB

47

Duplicated lines

51

Same as with the other ones, always use exernal library

devel/mold/Makefile
2–5

Because I originally think it works now. But after testing, the FreeBSD strip still has problem and I find the problem and send PR to the author. So the working version is the one I have commited hours ago. See[[ https://github.com/rui314/mold/pull/1187 | this ]].

29

Ok, I will try it.

You're right about blake3, sorry for the noise about that one.

Thanks for working on this port!

devel/mold/Makefile
2–5

Okay, in that case to not break versioning (unless it can be backported) you should use the example called "Example 18. Using USE_GITHUB to Access a Commit Between Two Versions" in Porters Handbook.

21

Does ninja fail or is it a part of a debugging process?

devel/mold/Makefile
2–5

I am a little bit confusing because the author doesn't give it a tag. I just use the commit hash and the commit date as value in the Makefile. Can't we just use this version?

devel/mold/Makefile
2–5
diizzy@miyuki:~ % git clone https://github.com/rui314/mold.git
Cloning into 'mold'...
remote: Enumerating objects: 41049, done.
remote: Counting objects: 100% (5497/5497), done.
remote: Compressing objects: 100% (948/948), done.
remote: Total 41049 (delta 4713), reused 4910 (delta 4545), pack-reused 35552
Receiving objects: 100% (41049/41049), 19.60 MiB | 8.91 MiB/s, done.
Resolving deltas: 100% (30141/30141), done.
diizzy@miyuki:~ % cd mold/
diizzy@miyuki:~/mold % git describe --tags c9651d9
v2.4.0-49-gc9651d9b

I can't to it directly but search for Example 18. Using USE_GITHUB to Access a Commit Between Two Versions and you'll see the example
https://docs.freebsd.org/en/books/porters-handbook/book/#makefile-master_sites-github

aokblast marked 8 inline comments as done.EditedFeb 4 2024, 4:46 PM

Sorry, I fix it.
BTW, some test like LTO (because we don't open it) and tlsdesc failed when I run make test thus I decide to turn it off. I have use it to compile several programs and nothing wrong happens.
However, it shows this warning when compiling because crt is stripped when shipping. I think it is the bug from strip.

  • Use style compilant version naming and use port package as default

Hi @aokblast, Thanks for fixing the patch. Your patch worked great here, although instead of packaging the git HEAD, I used 2.4.0 + your fix as below:

# See https://github.com/rui314/mold/pull/1187
PATCH_SITES=    https://github.com/rui314/mold/commit/
PATCHFILES=     8c99dd0f2c165e36efd4fad762158ec13004b86a.patch:-p1

I'll commit it shortly.

Thanks!

Hello, do you have any progress on this? If you found any issue, I can help on fixing it.

I have committed the changes as they worked well in my testing. Sorry for missing this.