Uh oh!
There was an error while loading. Please reload this page.
crossgen2: Add --imagebase option - #65567
Conversation
t-mustafin
commented
Feb 18, 2022
Uh oh!
There was an error while loading. Please reload this page.
--imagebase option set preferable ImageBase field to output PE-file
6e2a59d to
c0d0160CompareMichalStrehovsky
commented
Feb 22, 2022
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. |
t-mustafin
commented
Feb 22, 2022
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. |
MichalStrehovsky
commented
Feb 23, 2022
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:
|
jkotas
commented
Mar 1, 2022
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 |
trylek
commented
Apr 11, 2022
@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? |
gbalykov
commented
Apr 12, 2022
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. |
trylek
left a comment
There was a problem hiding this comment.
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