[all-commits] [llvm/llvm-project] af1287: [RISCV] Allow mismatched SmallDataLimit and use Mi...

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue Feb 7 17:13:34 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: af128791464810123bcd60a6d9d0902b5c550aef
      https://github.com/llvm/llvm-project/commit/af128791464810123bcd60a6d9d0902b5c550aef
  Author: Fangrui Song <i at maskray.me>
  Date:   2023-02-07 (Tue, 07 Feb 2023)

  Changed paths:
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/test/CodeGen/RISCV/riscv-sdata-module-flag.c
    M clang/test/CodeGen/RISCV/rvv-intrinsics-handcrafted/vlenb.c
    M llvm/test/CodeGen/RISCV/sdata-limit-0.ll
    M llvm/test/CodeGen/RISCV/sdata-limit-4.ll
    M llvm/test/CodeGen/RISCV/sdata-limit-8.ll
    M llvm/test/CodeGen/RISCV/sdata-local-sym.ll
    M llvm/test/Transforms/LoopVectorize/RISCV/riscv-interleaved.ll

  Log Message:
  -----------
  [RISCV] Allow mismatched SmallDataLimit and use Min for conflicting values

Fix an issue about module linking with LTO.

When compiling with PIE, the small data limitation needs to be consistent with that in PIC, otherwise there will be linking errors due to conflicting values.

bar.c
```
int bar() { return 1; }
```

foo.c
```
int foo() { return 1; }
```

```
clang --target=riscv64-unknown-linux-gnu -flto -c foo.c -o foo.o -fPIE
clang --target=riscv64-unknown-linux-gnu -flto -c bar.c -o bar.o -fPIC

clang --target=riscv64-unknown-linux-gnu -flto foo.o bar.o -flto -nostdlib -v -fuse-ld=lld
```

```
ld.lld: error: linking module flags 'SmallDataLimit': IDs have conflicting values in 'bar.o' and 'ld-temp.o'
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
```

Use Min instead of Error for conflicting SmallDataLimit.

Authored by: @joshua-arch1
Signed-off-by: xiaojing.zhang <xiaojing.zhang at xcalibyte.com>
Signed-off-by: jianxin.lai <jianxin.lai at xcalibyte.com>

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D131230




More information about the All-commits mailing list