#Self-hosted compiler not setting null to 0 when caliing into shared lib

1 messages · Page 1 of 1 (latest)

novel current
#

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@plt and grpc_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

#

C Signature, and my call :

grpc_call* grpc_channel_create_call(
    grpc_channel* channel, grpc_call* parent_call, uint32_t propagation_mask,
    grpc_completion_queue* completion_queue, grpc_slice method,
    const grpc_slice* host, gpr_timespec deadline, void* reserved);
  return c.grpc_channel_create_call(
   self.handle, null, 0,
   queue.handle, _method,
   &_host, gprTimespecFromTimestamp(deadline), null,
).?;
idle warren
#

Almost certainly a bug