8000 Clang 18 by yzhang71 · Pull Request #202 · Lind-Project/lind-wasm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Clang 18 #202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open

Clang 18 #202

wants to merge 32 commits into from

Conversation

yzhang71
Copy link
Contributor
@yzhang71 yzhang71 commented May 5, 2025

Description

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Test A - lind_project/tests/test_cases/test_a.c
  • Test B - lind_project/tests/test_cases/test_b.c

Checklist:

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been added to a pull request and/or merged in other modules (native-client, lind-glibc, safeposix-rust)

@rennergade
Copy link
Contributor

@yzhang71 there are several merge conflicts here

@ci-response-bot
Copy link

Commit 30ddd80: Build Failed

View Log

@ci-response-bot
Copy link

Commit e6cedbb: Build Failed

View Log

ansalma6
< 8000 div class="ml-md-2 mt-md-0 mt-2 flex-shrink-0"> View reviewed changes
$$CC $$CFLAGS $$WARNINGS $$EXTRA_FLAGS \
$$INCLUDE_PATHS $$SYS_INCLUDE $$DEFINES $$EXTRA_DEFINES \
-o $$GLIBC_BASE/build/lind_syscall.o \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The merge from main might have removed the lind_syscall compile here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I'm not sure if it's necessary, since lind_syscall.o is pre-shipped in the lind_syscall folder, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a problem. I believe we changed it to compile every time and not pre-ship since that was causing constant issues.

@ci-response-bot
Copy link

Commit 6e18b65: Build Success

@ci-response-bot
Copy link

m-hemmings
m-hemmings previously approved these changes May 19, 2025
Copy link
Contributor
@qianxichen233 qianxichen233 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test report is still not working. This is a quite important PR that might potentially break a lot of things if not handled carefully, so I would really want to see a normal test report generated for this PR under CI pipeline.

@rennergade
Copy link
Contributor

The test report is still not working. This is a quite important PR that might potentially break a lot of things if not handled carefully, so I would really want to see a normal test report generated for this PR under CI pipeline.

I'm wondering if this is related to Ansal's above lind_syscall.o comment

@qianxichen233
Copy link
Contributor
qianxichen233 commented May 19, 2025

The test report is still not working. This is a quite important PR that might potentially break a lot of things if not handled carefully, so I would really want to see a normal test report generated for this PR under CI pipeline.

I'm wondering if this is related to Ansal's above lind_syscall.o comment

Just looked into the reason of the test report failure and I believe it is related to gen_sysroot.sh. The error wasm-ld: error: unable to find library -lc indicates that wasm-ld couldn't locate libc.a under sysroot/lib/wasm32, which should be produced by gen_sysroot.sh. This likely means that something in gen_sysroot.sh failed during execution.

@m-hemmings could you take a look and see if you can fix the issue, so that test could run normally for all PRs?

@ci-response-bot
Copy link

Commit c18e83d: Build Success

@ansalma6
Copy link
Contributor

The gen_sysroot.sh was not working because it failed to find the lind_syscall.o while bundling. It can be fixed in two ways.
Compile lind_syscall while running build, or prepackage the lind_syscall.o and update its path in gen_sysroot.sh.

I made the change where we compile lind_syscall during bazel build. If that is to be changed to prepackage lind_syscall.o(like crt1.o), there should be a corresponding change in gen_sysroot.sh mentioning the path.

@rennergade
Copy link
Contributor

The gen_sysroot.sh was not working because it failed to find the lind_syscall.o while bundling. It can be fixed in two ways. Compile lind_syscall while running build, or prepackage the lind_syscall.o and update its path in gen_sysroot.sh.

I made the change where we compile lind_syscall during bazel build. If that is to be changed to prepackage lind_syscall.o(like crt1.o), there should be a corresponding change in gen_sysroot.sh mentioning the path.

Thank you @ansalma6! Can you (or @m-hemmings make sure this stuff is documented somewhere in the build docs)

@qianxichen233 does this clarify your concerns?

@ci-response-bot
Copy link

@qianxichen233
Copy link
Contributor

The test report looks much better now. @yzhang71 , could you also take a look at the test report here and compare the test results with those from the main branch? Just want to make sure no additional tests are failing in this PR.

@yzhang71
Copy link
Contributor Author

The test report looks much better now. @yzhang71 , could you also take a look at the test report here and compare the test results with those from the main branch? Just want to make sure no additional tests are failing in this PR.

No problem. I will work on that

@yzhang71
Copy link
Contributor Author

The test cases for Clang-16 and Clang-18 have been compared and verified to be the same.

@rennergade rennergade removed the request for review from yashaswi2000 May 30, 2025 02:21
@rennergade
Copy link
Contributor

Thanks @yzhang71. I think this is ready for the merge process as you discussed in the meeting Wednesday.

@m-hemmings Can you give this another once over, and then I'll have another look.

@qianxichen233 can you make sure your requested change is resolved?

Copy link
Member
@m-hemmings m-hemmings left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see no additional changes that merit concern to me and the ones I brought up earlier have been resolved

USER root
RUN wget http://security.ubuntu.com/ubuntu/pool/universe/n/ncurses/libtinfo5_6.3-2ubuntu0.1_amd64.deb && \
apt install ./libtinfo5_6.3-2ubuntu0.1_amd64.deb
USER lind
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this related to the clang upgrade?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to move the install before line 32, where the other apt installs are? Then you don't have to change user back and forth.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this related to the clang upgrade?

Yes, we needs this library for using clang-18, otherwise it will give error during runtime.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to move the install before line 32, where the other apt installs are? Then you don't have to change user back and forth.

Good point! This part is handled by Matt, @m-hemmings Hi Matt, do you think this suggestion can be applied here?

-c ../sysdeps/unix/sysv/linux/x86/elision-unlock.c \
-MD -MP -MF $$GLIBC_BASE/build/nptl/elision-unlock.o.dt \
-MT $$GLIBC_BASE/build/nptl/elision-unlock.o

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these related to the clang upgrade?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so, the elision lock and unlock were causing errors, so we need to handle them differently.

Makefile Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file was removed in #214. Is the re-add intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@m-hemmings Hi Matt, I'm not sure about this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to confirm, it looks like Makefile was deleted in PR #214 on main, but that commit hasn’t been incorporated into this branch via merge or rebase yet. Is that correct?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the changes in this file related to the clang upgrade?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really. These changes are intended to make the test report more manageable. Previously, all test cases were displayed in an unordered manner, which made comparison difficult.

-name "list.o" -o \
-name "ldconfig.o" -o \
-name "sln.o" \
\))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the change related to the clang upgrade?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so. These changes were made to resolve function duplication, which occurred when we upgraded to Clang 18.


# Compiler options
COMMON_FLAGS := --target=wasm32-unkown-wasi -v -Wno-int-conversion -std=gnu11 -fgnu89-inline \
COMMON_FLAGS := --target=wasm32-unknown-wasi -v -Wno-int-conversion -std=gnu11 -fgnu89-inline \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this an unrelated bugfix? Was this a problem before?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was a typo : (

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but was this an issue? Did the typofix fix the build? Or is this Makefile not used for anything anyway?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this fix the typo. But I'm not sure if it previously causing any problem.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some discussion on PR #240's comments

CFLAGS-elision-lock.c +=
CFLAGS-elision-unlock.c +=
CFLAGS-elision-timed.c +=
CFLAGS-elision-trylock.c +=
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose of these empty appends?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we need to remove -mrtm because clang-18 no longer support that.

Copy link
Contributor
@rennergade rennergade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of how this PR is set up its a bit hard to tell whats added for clang 18 to work vs whats potentially being readded to the repo due to versioning mistakes. I don't have a great feel for that but agree with all of Lukas's comments.

@lukpueh
Copy link
Contributor
lukpueh commented Jun 5, 2025

Regarding my comments about unrelated changes:
Although it's good practice to not introduce unrelated changes in a given PR, I'm absolutely fine, if we do for the sake of practicality. I just need to know what these changes are about, if you expect me to leave a meaningful code review.

Let me know, if you need any help with resolving git history conflicts/issues.

@lukpueh
Copy link
Contributor
lukpueh commented Jul 10, 2025

After my huge sweep through the build scripts, it's probably best to start over with this PR (sorry!). The good news is, this should become substantially easier. In terms of replacing clang version strings, you should only need to do this once here:

ARG LLVM="llvmorg-16.0.4"
ARG CLANG="clang+llvm-16.0.4-x86_64-linux-gnu-ubuntu-22.04"

... plus any source code changes needed for the new clang version.

@m-hemmings
Copy link
Member

After my huge sweep through the build scripts, it's probably best to start over with this PR (sorry!). The good news is, this should become substantially easier. In terms of replacing clang version strings, you should only need to do this once here:

ARG LLVM="llvmorg-16.0.4"
ARG CLANG="clang+llvm-16.0.4-x86_64-linux-gnu-ubuntu-22.04"

... plus any source code changes needed for the new clang version.

@yzhang71 I think I can take this from here.
@lukpueh Thanks for all this. Are there any additional changes coming I should be aware of?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants
0