I have a weird error, only when using self-hosted compiler on linux amd64. When using LLVM backend it works fine.
My question is, am I missing something obvious ? or is it a known compiler bug ? Else I will report it.
I'm calling grpc_channel_create_call, and setting the last argument (which is an unused void*) to null
I compile, linking libgrpc dynamically, then use gdb and add a breakpoint.
- When using the self-hosted, compiler, the only possible breakpoint matching this function is
grpc_channel_create_call$plt - When using LLVM, gdb proposes both
grpc_channel_create_call@pltandgrpc_channel_create_call
Then I run, reach the breakpoint, and step 2 or 3 times until I reach the first line of the non-plt function, and do info args
Self hosted:
(gdb) step
105 GRPC_CHECK(!reserved);
(gdb) info args
channel = 0x12350d0
parent_call = 0x0
propagation_mask = 0
completion_queue = 0x123d100
method = [...]
host = 0x7fffffffcef8
deadline = {tv_sec = 1763919272, tv_nsec = 490243184, clock_type = GPR_CLOCK_REALTIME}
reserved = 0x7fffffffd9b0
LLVM
(gdb) step
105 GRPC_CHECK(!reserved);
(gdb) info args
channel = 0x11ac0d0
parent_call = 0x0
propagation_mask = 0
completion_queue = 0x11b4100
method = [...]
host = 0x7fffffffcf58
deadline = {tv_sec = 1763919377, tv_nsec = 354568238, clock_type = GPR_CLOCK_REALTIME}
reserved = 0x0
As we can see reserved is 0 with LLVM, and not 0 with self hosted, and because the first line is assert(reserved == 0) it aborts immediatly
I don't usually link dynamically but in this case libgrpc.a is 2GB so it makes more sense to link the .so, but I'm maybe missing something, like I didn't have to specify -fPIC not -fPIE