-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
crossgen2: Add --imagebase option #65567
Conversation
--imagebase option set preferable ImageBase field to output PE-file
6e2a59d
to
c0d0160
Compare
Looks reasonable to me but adding @dotnet/crossgen-contrib for actual signoff. I do wonder whether the change you actually need is to just respect the ImageBase in the source executable (and set an ImageBase when compiling the source assembly). If I'm reading this right, this will set the same ImageBase for all components of a composite build and they'll be all guaranteed to conflict. |
Actually we do not use composite mode, but use pipelene mode (--single-file-compilation --out-near-input). For pipeline mod I will prepare another patch. |
I assume the command line interface will get ugly for the pipeline mode. Is there anything preventing you from setting the ImageBase on each of the inputs before running crossgen? The ImageBase of an assembly can be controlled at the csproj level of each assembly at the time of source build by using the |
I think here are three arguments to do not determine BaseAddress into .csproj file:
|
You can build a separate tool that goes over the universe of all assemblies and assigns them a base address based on some policy. crossgen can then pick the base address from each assembly in the pipeline mode, no command line option needed. I understand that you are using fixed base addresses to save memory in Tizen specific builds via |
@t-mustafin - do you think that Jan's and Michal's suggestions are sufficient to address your needs or that there is still some value in making this change? |
This approach leads to few problems which seem to be unresolvable for us.
Basically, what we would like to add is same as For individual dll compilation this will be a base address to put in r2r image (just like in this PR and like it was for crossgen1): ./corerun ./crossgen2/crossgen2.dll -r:`pwd`/*.dll -o:$DLLPATH/$DLLNAME.ni.dll --imagebase $BASEADDR $DLLPATH/$DLLNAME.dll Resulting For the pipeline mode this will be an initial base address, on top of which base addresses for all compiled dlls will be calculated internally in crossgen2 (we'll add this changed later), i.e. also only one ./corerun ./crossgen2/crossgen2.dll -r:`pwd`/*.dll --out-near-input --single-file-compilation --imagebase $BASEADDR $DLLPATH1/$DLLNAME1.dll $DLLPATH2/$DLLNAME2.dll $DLLPATH3/$DLLNAME3.dll Resulting This way command line for both single-dll and pipeline modes will stay pretty simple. |
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.
As I believe that @gbalykov's explanation is reasonable and this change basically reintroduces functionality that was present in the legacy native Crossgen1, I believe it should be safe to take. I'll leave the PR open until tomorrow to see whether there's additional pushback from @jkotas or @MichalStrehovsky; in its absence I'll just merge it in tomorrow morning. Thanks!
--imagebase option set preferable ImageBase field to output PE-file