Skip to content

Commit

Permalink
Remove last case of manual WASMER_METADATA formatting and enable LLVM
Browse files Browse the repository at this point in the history
  • Loading branch information
fschutt committed Jan 4, 2023
1 parent 697936f commit bf37e63
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ jobs:
LLVM_DIR=$(pwd)/${{ env.LLVM_DIR }}
mkdir ${LLVM_DIR}
tar xf llvm.tar.xz --strip-components=1 -C ${LLVM_DIR}
echo "ENABLE_LLVM=1" >> $GITHUB_ENV
echo "${LLVM_DIR}/bin" >> $GITHUB_PATH
echo "LLVM_SYS_120_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV
env:
Expand Down Expand Up @@ -338,7 +339,6 @@ jobs:
TARGET: ${{ matrix.metadata.target }}
TARGET_DIR: target/${{ matrix.metadata.target }}/release
CARGO_TARGET: ${{ matrix.metadata.target }}
LLVM_SYS_120_PREFIX: ${{ env.LLVM_SYS_120_PREFIX }}
- name: Test C-API
shell: bash
if: ${{ matrix.build-what.key == 'capi' && !(matrix.metadata.build == 'linux-musl' || matrix.metadata.build == 'macos-arm' || matrix.metadata.build == 'windows-gnu') }}
Expand Down
11 changes: 7 additions & 4 deletions lib/compiler/src/engine/artifact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,8 @@ impl Artifact {
),
CompileError,
> {
use wasmer_types::{compilation::symbols::ModuleMetadataSymbolRegistry, SymbolRegistry};

fn to_compile_error(err: impl std::error::Error) -> CompileError {
CompileError::Codegen(format!("{}", err))
}
Expand Down Expand Up @@ -570,10 +572,11 @@ impl Artifact {
)?;
let mut obj = get_object_for_target(target_triple).map_err(to_compile_error)?;

let object_name = format!(
"WASMER_{}_METADATA",
metadata_prefix.unwrap_or_default().to_uppercase()
);
let object_name = ModuleMetadataSymbolRegistry {
prefix: metadata_prefix.unwrap_or_default().to_string(),
}
.symbol_to_name(wasmer_types::Symbol::Metadata);

emit_data(&mut obj, object_name.as_bytes(), &metadata_binary, 1)
.map_err(to_compile_error)?;

Expand Down
2 changes: 1 addition & 1 deletion lib/types/src/compilation/symbols.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl SymbolRegistry for ModuleMetadataSymbolRegistry {
fn symbol_to_name(&self, symbol: Symbol) -> String {
match symbol {
Symbol::Metadata => {
format!("WASMER_METADATA_{}", self.prefix)
format!("WASMER_METADATA_{}", self.prefix.to_uppercase())
}
Symbol::LocalFunction(index) => {
format!("wasmer_function_{}_{}", self.prefix, index.index())
Expand Down

0 comments on commit bf37e63

Please sign in to comment.