Skip to content

Commit 53455b8

Browse files
committed
Add ifdef guards to wasm-sysroot headers
In typical C fashion headers should have if guards to stop them being included multiple times in an object file. Done in an attempt to fix the current WASM build failures e.g., rust-lld: error: duplicate symbol: WASM32_INT_SIZE >>> defined in /home/tobin/.cache/cargo/wasm32-unknown-unknown/release/deps/libsecp256k1_sys-26edc0990a3ac6e5.rlib(precomputed_ecmult_gen.o) >>> defined in /home/tobin/.cache/cargo/wasm32-unknown-unknown/release/deps/libsecp256k1_sys-26edc0990a3ac6e5.rlib(precomputed_ecmult.o) This seems valuable to have even if it does not fix the build issue.
1 parent e9427d2 commit 53455b8

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

secp256k1-sys/wasm-sysroot/stdio.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#ifndef WASM_SYSROOT_STDIO_H
2+
#define WASM_SYSROOT_STDIO_H
3+
14
#include <stddef.h>
25
#define alignof(type) offsetof (struct { char c; type member; }, member)
36

@@ -14,4 +17,6 @@ extern const unsigned char WASM32_UNSIGNED_CHAR_SIZE = sizeof(unsigned char);
1417
extern const unsigned char WASM32_UNSIGNED_CHAR_ALIGN = alignof(unsigned char);
1518

1619
extern const unsigned char WASM32_PTR_SIZE = sizeof(void*);
17-
extern const unsigned char WASM32_PTR_ALIGN = alignof(void*);
20+
extern const unsigned char WASM32_PTR_ALIGN = alignof(void*);
21+
22+
#endif /* WASM_SYSROOT_STDIO_H */

secp256k1-sys/wasm-sysroot/string.h

+5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1+
#ifndef WASM_SYSROOT_STRING_H
2+
#define WASM_SYSROOT_STRING_H
3+
14
#include <stddef.h>
25
void *memset(void *s, int c, size_t n);
36
void *memcpy(void *dest, const void *src, size_t n);
47
int memcmp(const void *s1, const void *s2, size_t n);
8+
9+
#endif /* WASM_SYSROOT_STRING_H */

0 commit comments

Comments
 (0)