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

Linux R2R mixed dll can't be saved. #533

Open
FickoDeLux opened this issue Dec 4, 2023 · 2 comments
Open

Linux R2R mixed dll can't be saved. #533

FickoDeLux opened this issue Dec 4, 2023 · 2 comments

Comments

@FickoDeLux
Copy link

If you try to save a R2R linux mixed module dnlib run on an exception.
dnlib.DotNet.Writer.ModuleWriterException: Invalid section RVA

The module is published with:
dotnet publish -c Release -r linux-x64 -p:PublishReadyToRun=true
R2R.ZIP

@wtfsck
Copy link
Contributor

wtfsck commented Dec 5, 2023

R2R was never supported. Can you just save it as a normal .NET assembly without any native code (I assume the metadata and original IL code is still in the file).

foreach (var section in origSections) {
if (section.Chunk.RVA != section.PESection.VirtualAddress)
throw new ModuleWriterException("Invalid section RVA");
}

@FickoDeLux
Copy link
Author

Maybe with this little test dll would work, but I tryed more complex module and it stoped running on linux.
Only way I was able to make it work if I did the following:

1.) Use "crossgen2.exe --compile-no-methods --targetos:windows" to strip native code and convert it to windows PE.
2.) Save module (because it is a windows PE still mixed assembly)
3.) Use "crossgen2.exe --compile-no-methods --targetos:linux" to convert it back to linux PE

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

No branches or pull requests

2 participants