Weak attribute functions are not correctly detected by clangd

Hi, I started using clangd with coc-nvim (not relevant, but to give some context, also tried it with clangd extension in vscode) and I found out that functions tagged with attribute((weak)) are not correctly detected. For example having the following files:

main.c:

int __attribute__((weak)) test(int a) {
    return a + 1;
}
int main() {
   printf("Test %d\n", test(10));
}

module.c:

int test(int a) {
   return a + 3;
}

Compiling this with clang and running it will give the answer 13 which is correct. But when searching for function test in main.c it will send me to the weak implementation instead of the real linked one.

In order to generate the compile_commands.json file I’ve used bear. But that’s simple enough so I will paste it here:

[
  {
    "arguments": [
      "/usr/bin/clang",
      "-c",
      "-o",
      "main.o",
      "main.c"
    ],
    "directory": "/home/john/projects/c",
    "file": "/home/john/projects/c/main.c",
    "output": "/home/john/projects/c/main.o"
  },
  {
    "arguments": [
      "/usr/bin/clang",
      "-c",
      "-o",
      "module.o",
      "module.c"
    ],
    "directory": "/home/john/projects/c",
    "file": "/home/john/projects/c/module.c",
    "output": "/home/john/projects/c/module.o"
  }
]

Is there a way to make this behave correctly? (I need this in a larger project)