-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[mono] Fix libcoreclr.so build incompatibilities on Linux #59988
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
Conversation
src/mono/CMakeLists.txt
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we make this consistent with Android:
| add_link_options(-Wl,-z,relro,-z,now) | |
| add_compile_options(-Wl,-z,now) | |
| add_compile_options(-Wl,-z,relro) |
... and what about noexecstack?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah I just saw #59987 (comment) and you tried that already. it's interesting why this doesn't work on Linux, can you please still split it into different lines and leave a comment about why add_link_options is used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "add_compile_options" didn't actually work for me - it is not being applied at the final link step, which is actually the only step where it really matters.
As to noexecstack, the library is already marked as noexecstack to me. That's to be expected as the compilers already mark objects files they generate accordingly. The only reason for a manual override is when you link in a full assembler file (.s), which I don't believe happens in the Mono build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, didn't see the latest comment. I'm actually a bit surprised that add_compile_options works for Android, I would have expected the same problem (I can't really test that here). If you prefer two lines, I can certainly change that, I just used what was in eng/native/configurecompiler.cmake ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added comment and split back into two lines. Let me know if there's anything else you'd like me to do. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good now. We can probably change Android to use add_link_options too, I suppose add_compile_options works because we use clang there.
|
@uweigand looks like there's an issue in the AOT cross compiler build on Windows: |
Ah, right. Looks like this needs to check |
|
The Browser_wasm_Windows failure looks related: So I think this is yet another case, where we're cross-building a version of the runtime hosted on Wasm, right? We don't get a version.c because in this case Also, it's not clear that using an embedded sccsid string would even work for a wasm/emscripten binary ... Should we just keep not doing any version string in the |
* Link with -z relro -z now to enable full RELRO mode Fixes #59904 * Generate and link in version.c to provide version string Fixes dotnet/source-build#2484
Disabled this for now, can be changes again later once it's clear what to do. |
Sounds good to me, thanks! |
|
Thanks @akoeplinger ! Can still this get included into .NET 6 at this point? This would help the RHEL builds. |
|
/backport to release/6.0 |
|
Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/1313127365 |
Backport of #59988 * Link with -z relro -z now to enable full RELRO mode Fixes #59904 * Generate and link in version.c to provide version string Fixes dotnet/source-build#2484 Co-authored-by: Ulrich Weigand <[email protected]>
Link with -z relro -z now to enable full RELRO mode
Fixes [s390x] Missing full RELRO (-z,now) support in a mono-based libcoreclr.so #59904
Generate and link in version.c to provide version string
Fixes [s390x] Missing commit identifier in libcoreclr.so source-build#2484
This makes the Mono build of libcoreclr.so on Linux look like the CoreCLR build w.r.t. these two issues.