Skip to content
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

Upgrade LLVM to version 12 #2542

Merged
merged 58 commits into from
Sep 1, 2021
Merged

Upgrade LLVM to version 12 #2542

merged 58 commits into from
Sep 1, 2021

Conversation

nomeata
Copy link
Collaborator

@nomeata nomeata commented May 27, 2021

No description provided.

@nomeata
Copy link
Collaborator Author

nomeata commented Jun 19, 2021

I guess we should upgrade nixpkgs then, and remove it here. The last try (#2589) failed with hydra timeoutting. Let’s see if #2606 goes through

@ggreif
Copy link
Contributor

ggreif commented Jun 19, 2021

@basvandijk increased the timeout, such that rustc can compile. But that change may be at a branch, still.

@osa1
Copy link
Contributor

osa1 commented Jun 19, 2021

I think increasing the timeout won't be necessary if we merge and deploy https://github.com/dfinity-lab/hydra-jobsets/pull/99

@osa1
Copy link
Contributor

osa1 commented Jun 22, 2021

I think increasing the timeout won't be necessary if we merge and deploy dfinity-lab/hydra-jobsets#99

Sorry, I was confused. That PR is not related, we will have to increase the timeout or somehow upload the nix artifacts to the cache manually (assuming that's possible).

mergify bot pushed a commit that referenced this pull request Aug 25, 2021
to include the patch we tried in #2542
@github-actions
Copy link

github-actions bot commented Aug 25, 2021

Comparing from e816419 to 82875d0:
In terms of gas, 1 tests regressed, 2 tests improved and the mean change is -1.6%.
In terms of size, 3 tests improved and the mean change is -0.0%.

@@ -599,7 +599,6 @@ let fill_table_base_import new_base : module_' -> module_' = fun m ->
(* Concatenation of modules *)

let join_modules (em1 : extended_module) (m2 : module_') (ns2 : name_section) : extended_module =
assert (m2.start = None);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I forgot if we discussed this. If m2 now has a (start) function, is it ok to ignore it?

Copy link
Contributor

Choose a reason for hiding this comment

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

So this is really hacky. I think as first thing we should clarify here (in comments/documentation) that this linker and join_modules in particular cannot link/join two arbitrary Wasm modules, we have various assumptions like the second module being generated by LLVM and first one by moc (and details related to LLVM- and moc- generated code).

In this case, module 2 is the RTS module and it has a start after updating to LLVM 12: (start $__wasm_apply_global_relocs). We add (call $__wasm_apply_global_relocs) to the final module after joining modules, so that's why we ignore start here.

So it's not OK to ignore start in general, we only handle the case specific to LLVM 12 here. If we want this function to link arbitrary Wasm modules then this is wrong.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

But sound it would be cleaner to not ignore the start here, bit rather make sure it is called from the linked start function? But that's what the other comment would yield, I think.

The linker does rely on internals of drun output but ideally not of LLVM internals (like function names in the debug section).

Copy link
Contributor

Choose a reason for hiding this comment

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

Second module's start is now prepended to the merged module's start, so marking this as resolved as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sigh.. GitHub UI does not show new inline comments without refreshing the page, so I missed your second comment above.

I guess we could join starts here, instead of ignoring it here and adding module 2's start after join_modules. Will update.

Copy link
Contributor

Choose a reason for hiding this comment

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

Done. Not sure if it's any better though..

src/linking/linkModule.ml Outdated Show resolved Hide resolved
@nomeata
Copy link
Collaborator Author

nomeata commented Aug 25, 2021

With nixpkgs upgraded, we can tackle this again?

@osa1
Copy link
Contributor

osa1 commented Aug 30, 2021

I feel a bit uneasy about rustc and clang using different versions of LLVM, but maybe that's OK.

Should we make this ready for review?

@nomeata nomeata marked this pull request as ready for review August 30, 2021 15:02
@osa1 osa1 requested a review from ggreif August 31, 2021 09:07
@nomeata
Copy link
Collaborator Author

nomeata commented Aug 31, 2021

Should we put the linker improvement into is own PR (can land first, I guess, at it's backwash m backwards compatible)? Or is that OCD on my part?

osa1 added a commit that referenced this pull request Sep 1, 2021
- Implement extended name section
  (https://github.com/WebAssembly/extended-name-section/blob/master/proposals/extended-name-section/Overview.md)

- Handle `start` functions in the RTS module in linker

These changes are needed to update to LLVM 12: #2542
@osa1
Copy link
Contributor

osa1 commented Sep 1, 2021

Should we put the linker improvement into is own PR (can land first, I guess, at it's backwash m backwards compatible)?

#2760

mergify bot pushed a commit that referenced this pull request Sep 1, 2021
- Implement extended name section
  (https://github.com/WebAssembly/extended-name-section/blob/master/proposals/extended-name-section/Overview.md)

- Handle `start` functions in the RTS module in linker

These changes are needed to update to LLVM 12: #2542
@osa1 osa1 added the automerge-squash When ready, merge (using squash) label Sep 1, 2021
@mergify mergify bot merged commit a0ad45b into master Sep 1, 2021
@mergify mergify bot deleted the joachim/llvm-12 branch September 1, 2021 11:17
@mergify mergify bot removed the automerge-squash When ready, merge (using squash) label Sep 1, 2021
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.

4 participants