[llvm] [LoongArch] Allow delayed decision for ADD/SUB relocations (PR #72960)

Nathan Chancellor via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 21 11:49:51 PST 2023


nathanchance wrote:

This patch causes an error while building the Linux kernel's vDSO:

```
$ echo CONFIG_MODULES=n >arch/loongarch/configs/nomod.config

$ make -skj"$(nproc)" ARCH=loongarch LLVM=1 mrproper defconfig nomod.config arch/loongarch/vdso/vgettimeofday.o
error: .uleb128 expression is not absolute
error: .uleb128 expression is not absolute
...
```

A trivial reproducer from `cvise`:

```c
struct vdso_timestamp {
  long sec;
};
struct {
  long cycle_last;
  struct vdso_timestamp basetime[];
} do_hres_vd;
int vdso_calc_delta_mult, do_hres_clk;
long do_hres_sec;
long vdso_calc_delta() { return vdso_calc_delta_mult; }
int do_hres() {
  struct vdso_timestamp vdso_ts = do_hres_vd.basetime[do_hres_clk];
  do_hres_sec = vdso_ts.sec;
  return 0;
}
```

With GCC 13.2.0:

```
$ loongarch64-linux-gcc -g -O2 -c -o /dev/null vgettimeofday.i
```

At the parent of this change:

```
$ clang --target=loongarch64 -g -c -o /dev/null vgettimeofday.i

$ clang --target=loongarch64 -g -O2 -c -o /dev/null vgettimeofday.i
```

At this change:

```
$ clang --target=loongarch64 -g -c -o /dev/null vgettimeofday.i

$ clang --target=loongarch64 -g -O2 -c -o /dev/null vgettimeofday.i
error: .uleb128 expression is not absolute
error: .uleb128 expression is not absolute
2 errors generated.
```

https://github.com/llvm/llvm-project/pull/72960


More information about the llvm-commits mailing list