issue with getopt
wasm-ld-18: error: duplicate symbol: getopt
>>> defined in [...]/owi/_build/install/default/share/owi/c_files/libc.wasm
>>> defined in /tmp/test-1-11f16a.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
clang failed: run with --debug to get the full error message%
This is happening for instance on testcomp/sv-benchmarks/c/busybox-1.22.0/test-1.i
Probably related to the changes from #457
OK so, I investigated a bit.
The Test-Comp C files are actually doing something like this:
#define _GNU_SOURCE
#include <getopt.h>
// ...
We could either:
- mark our
getoptas weak (as I believe we've already been doing for other functions) - pass a flag to allow multiple definitions in the linker
- make sure the symbol referenced from getopt.h is not pulled in (but that should already be the case because of
--no-standard-libraries?!)
My preference goes for the first one.
Actually, the Clang doc is basically empty about these options but reading the GCC one, I found that we probably want more than --no-standard-libraries and add -nodefaultlibs, I'll try with this one and see what happens...
mark our
getoptas weak (as I believe we've already been doing for other functions)
Maybe we should mark every symbol in our standard library as weak? It would probably avoid similar issues in the future