Skip to content

Commit

Permalink
[wasm] Fix order of include paths, to have the obj dir first (#50303)
Browse files Browse the repository at this point in the history
* [wasm] Fix order of include paths, to have the obj dir first

this regressed recently, and we started using `pinvoke-table.h`, and
`icall-table.h` from the runtime pack instead of from the obj dir.

* [wasm] Don't include pinvoke-table.h in the runtime pack.

`pinvoke-table.h` is generated when building the native files for wasm.
They are not required in the runtime pack, as any wasm app build needing
to do native relinking would be generating one of it's own.

* Fix the property name
  • Loading branch information
radical authored Apr 7, 2021
1 parent 2fecdcd commit 740121d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@
<PlatformManifestFileEntry Include="corebindings.c" IsNative="true" />
<PlatformManifestFileEntry Include="driver.c" IsNative="true" />
<PlatformManifestFileEntry Include="pinvoke.c" IsNative="true" />
<PlatformManifestFileEntry Include="pinvoke-table.h" IsNative="true" />
<PlatformManifestFileEntry Include="pinvoke.h" IsNative="true" />
<PlatformManifestFileEntry Include="emcc-flags.txt" IsNative="true" />
<PlatformManifestFileEntry Include="emcc-version.txt" IsNative="true" />
Expand Down
2 changes: 1 addition & 1 deletion src/mono/wasm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ icu-files: $(wildcard $(ICU_LIBDIR)/*.dat) $(ICU_LIBDIR)/libicuuc.a $(ICU_LIBDIR
source-files: runtime/driver.c runtime/pinvoke.c runtime/corebindings.c runtime/binding_support.js runtime/dotnet_support.js runtime/library_mono.js $(SYSTEM_NATIVE_LIBDIR)/pal_random.js | $(NATIVE_BIN_DIR)/src
cp $^ $(NATIVE_BIN_DIR)/src

header-files: runtime/pinvoke.h $(BUILDS_OBJ_DIR)/pinvoke-table.h | $(NATIVE_BIN_DIR)/include/wasm
header-files: runtime/pinvoke.h | $(NATIVE_BIN_DIR)/include/wasm
cp $^ $(NATIVE_BIN_DIR)/include/wasm

# Helper targets
Expand Down
18 changes: 7 additions & 11 deletions src/mono/wasm/build/WasmApp.targets
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,6 @@
<_WasmPInvokeModules Include="libSystem.IO.Compression.Native" />
<_WasmPInvokeModules Include="libSystem.Globalization.Native" />
</ItemGroup>
<!--This pinvoke-table.h will be used instead of the one in the runtime pack because of -I$(_WasmIntermediateOutputPath) -->
<PInvokeTableGenerator
Modules="@(_WasmPInvokeModules)"
Assemblies="@(_WasmAssembliesInternal)"
Expand Down Expand Up @@ -465,20 +464,17 @@
<Error Condition="'$(RunAOTCompilation)' == 'true' and @(_BitcodeFile->Count()) != @(_AOTAssemblies->Count())"
Text="Bug: Number of aot assemblies doesn't match the number of generated bitcode files. BitcodeFiles: @(_BitcodeFile->Count()) vs Assemblies: @(_AOTAssemblies->Count())" />

<ItemGroup>
<_EmccIncludePaths Include="$(_WasmIntermediateOutputPath.TrimEnd('\/'))" />
<_EmccIncludePaths Include="$(_WasmRuntimePackIncludeDir)mono-2.0" />
<_EmccIncludePaths Include="$(_WasmRuntimePackIncludeDir)wasm" />
</ItemGroup>

<PropertyGroup>
<EmccCFlags>$(EmccFlags) -DCORE_BINDINGS -DGEN_PINVOKE=1</EmccCFlags>
<EmccCFlags>$(EmccCFlags) @(_EmccIncludePaths -> '&quot;-I%(Identity)&quot;', ' ')</EmccCFlags>
<EmccCFlags Condition="'$(WasmNativeDebugSymbols)' == 'true'">$(EmccCFlags) -g</EmccCFlags>

<!--
For path c:\foo\bar\ quoting would make it "c:\foo\bar\"
.. which escapes the closing quote. So, instead make it
c:\foo\bar\ -> "c:\foo\bar\."
-->
<EmccCFlags Condition="$(_WasmIntermediateOutputPath.EndsWith('\')) ">$(EmccCFlags) "-I$(_WasmIntermediateOutputPath)."</EmccCFlags>
<EmccCFlags Condition="!$(_WasmIntermediateOutputPath.EndsWith('\'))">$(EmccCFlags) "-I$(_WasmIntermediateOutputPath)"</EmccCFlags>

<EmccCFlags>$(EmccCFlags) &quot;-I$(_WasmRuntimePackIncludeDir)mono-2.0&quot; &quot;-I$(_WasmRuntimePackIncludeDir)wasm&quot;</EmccCFlags>

<EmccLDFlags>$(EmccFlags) -s TOTAL_MEMORY=536870912</EmccLDFlags>
<_WasmOptCommand>$([MSBuild]::NormalizePath('$(EmSdkUpstreamBinPath)', 'wasm-opt$(_ExeExt)'))</_WasmOptCommand>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/mono/wasm/wasm.proj
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
Lines="$(ActualEmccVersion)"
Overwrite="true" />

<Copy SourceFiles="$(MonoObjDir)\pinvoke-table.h;runtime\pinvoke.h"
<Copy SourceFiles="runtime\pinvoke.h"
DestinationFolder="$(NativeBinDir)\include\wasm"
SkipUnchangedFiles="true" />

Expand Down

0 comments on commit 740121d

Please sign in to comment.