| Issue |
53063
|
| Summary |
[Clang] fatal error: error in backend: Function addresses with offsets are not supported
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
playXE
|
<details>
<summary>Full compiler output:</summary>
```c
clang-12 --target=wasm32-unknown --no-standard-libraries -Wl,--export-all -Wl file.c -O2 -v -std=c99
Ubuntu clang version 12.0.0-3ubuntu1~20.04.4
Target: wasm32-unknown
Thread model: posix
InstalledDir: /usr/bin
"/usr/lib/llvm-12/bin/clang" -cc1 -triple wasm32-unknown -emit-obj --mrelax-relocations -disable-free -disable-llvm-verifier -discard-value-names -main-file-name file.c -mrelocation-model static -mframe-pointer=none -fno-rounding-math -mconstructor-aliases -target-cpu generic -fvisibility hidden -debugger-tuning=gdb -v -resource-dir /usr/lib/llvm-12/lib/clang/12.0.0 -internal-isystem /usr/lib/llvm-12/lib/clang/12.0.0/include -internal-isystem /include -O2 -Wl -std=c99 -fdebug-compilation-dir /home/aprokurov/projects/v -ferror-limit 19 -fgnuc-version=4.2.1 -fcolor-diagnostics -vectorize-loops -vectorize-slp -o /tmp/file-42bf93.o -x c file.c
warning: unknown warning option '-Wl' [-Wunknown-warning-option]
clang -cc1 version 12.0.0 based upon LLVM 12.0.0 default target x86_64-pc-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/llvm-12/lib/clang/12.0.0/include
End of search list.
file.c:351:7: warning: incompatible redeclaration of library function 'memcpy' [-Wincompatible-library-redeclaration]
void *memcpy(void *dest, void *src, size_t n);
^
file.c:351:7: note: 'memcpy' is a builtin with type 'void *(void *, const void *, unsigned long)'
file.c:353:7: warning: incompatible redeclaration of library function 'memmove' [-Wincompatible-library-redeclaration]
void *memmove(void *dest, void *src, size_t n);
^
file.c:353:7: note: 'memmove' is a builtin with type 'void *(void *, const void *, unsigned long)'
file.c:452:74: warning: passing 'const uint8_t *' (aka 'const unsigned char *') to parameter of type 'void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
static inline uint64_t _wyr8(const uint8_t *p) { uint64_t v; memcpy(&v, p, 8); return __builtin_bswap64(v);}
^
file.c:351:32: note: passing argument to parameter 'src' here
void *memcpy(void *dest, void *src, size_t n);
^
file.c:453:74: warning: passing 'const uint8_t *' (aka 'const unsigned char *') to parameter of type 'void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
static inline uint64_t _wyr4(const uint8_t *p) { uint32_t v; memcpy(&v, p, 4); return __builtin_bswap32(v);}
^
file.c:351:32: note: passing argument to parameter 'src' here
void *memcpy(void *dest, void *src, size_t n);
^
file.c:1882:23: warning: incompatible redeclaration of library function 'strlen' [-Wincompatible-library-redeclaration]
VV_LOCAL_SYMBOL usize strlen(void* _s);
^
file.c:1882:23: note: 'strlen' is a builtin with type 'unsigned long (const char *)'
file.c:1889:21: warning: incompatible redeclaration of library function 'memcmp' [-Wincompatible-library-redeclaration]
VV_LOCAL_SYMBOL int memcmp(void* a, void* b, usize n);
^
file.c:1889:21: note: 'memcmp' is a builtin with type 'int (const void *, const void *, unsigned long)'
file.c:1892:21: warning: incompatible redeclaration of library function 'vsprintf' [-Wincompatible-library-redeclaration]
VV_LOCAL_SYMBOL int vsprintf(char* str, char* format, byte* ap);
^
file.c:1892:21: note: 'vsprintf' is a builtin with type 'int (char *, const char *, __builtin_va_list)'
file.c:1893:21: warning: incompatible redeclaration of library function 'vsnprintf' [-Wincompatible-library-redeclaration]
VV_LOCAL_SYMBOL int vsnprintf(char* str, usize size, char* format, byte* ap);
^
file.c:1893:21: note: 'vsnprintf' is a builtin with type 'int (char *, unsigned long, const char *, __builtin_va_list)'
file.c:2051:4: warning: _expression_ result unused [-Wunused-value]
(*(int*)_t1.data);
^~~~~~~~~~~~~~~
file.c:6152:69: warning: operator '>>' has lower precedence than '-'; '-' will be evaluated first [-Wshift-op-parentheses]
voidptr* c_ = &t->child[v_fixed_index(((k >> sizeof(usize) * 8 - 1) & 1), 2)];
~~ ~~~~~~~~~~~~~~~~~~^~~
file.c:6152:69: note: place parentheses around the '-' _expression_ to silence this warning
voidptr* c_ = &t->child[v_fixed_index(((k >> sizeof(usize) * 8 - 1) & 1), 2)];
^
( )
file.c:6332:46: warning: incompatible pointer to integer conversion passing 'voidptr' (aka 'void *') to parameter of type 'usize' (aka 'unsigned long') [-Wint-conversion]
usize offset = dlmalloc__align_offset_usize(dlmalloc__Chunk_to_mem(ptr));
^~~~~~~~~~~~~~~~~~~~~~~~~~~
file.c:5510:58: note: passing argument to parameter 'addr' here
VV_LOCAL_SYMBOL usize dlmalloc__align_offset_usize(usize addr) {
^
file.c:6559:41: warning: incompatible pointer to integer conversion passing 'voidptr' (aka 'void *') to parameter of type 'usize' (aka 'unsigned long') [-Wint-conversion]
offset = dlmalloc__align_offset_usize(dlmalloc__Chunk_to_mem((((dlmalloc__Chunk*)(rawsp)))));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
file.c:5510:58: note: passing argument to parameter 'addr' here
VV_LOCAL_SYMBOL usize dlmalloc__align_offset_usize(usize addr) {
^
file.c:6579:20: warning: ordered comparison between pointer and integer ('usize' (aka 'unsigned long') and 'voidptr' (aka 'void *'))
if (nextp->head < old_end) {
~~~~~~~~~~~ ^ ~~~~~~~
file.c:7634:15: warning: passing 'char [2]' to parameter of type 'byte *' (aka 'unsigned char *') converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
bare_eprint("\n", 1U);
^~~~
file.c:1896:40: note: passing argument to parameter 'buf' here
VV_LOCAL_SYMBOL void bare_eprint(byte* buf, u64 len);
^
file.c:7714:14: warning: passing 'char [2]' to parameter of type 'byte *' (aka 'unsigned char *') converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
bare_print("\n", 1U);
^~~~
file.c:1895:23: note: passing argument to parameter 'buf' here
void bare_print(byte* buf, u64 len);
^
file.c:12642:2: warning: function 'exit' declared 'noreturn' should not return [-Winvalid-noreturn]
return __exit(code);
^
file.c:12749:2: warning: implicit declaration of function 'signal' is invalid in C99 [-Wimplicit-function-declaration]
signal(11, v_segmentation_fault_handler);
^
fatal error: error in backend: Function addresses with offsets not supported
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Ubuntu clang version 12.0.0-3ubuntu1~20.04.4
Target: wasm32-unknown
Thread model: posix
InstalledDir: /usr/bin
clang: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/file-3c34ea.c
clang: note: diagnostic msg: /tmp/file-3c34ea.sh
clang: note: diagnostic msg:
********************
```
</details>
Gist with all the files: https://gist.github.com/playXE/4ed487ff302b049fc0c5b05721c28299.
P.S: I haven't run cvise because I haven't figured out how to run it there, if it is required to run it I would appreciate some help in this
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs