[llvm] [llvm-link] Add the `--ignore-if-conflict` option (PR #75696)

via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 17 02:03:44 PST 2023


DianQK wrote:

> I'm confused by the motivation. The description says it is about overriding compiler builtins, but the source changes don't do anything specific regarding builtins. The source changes just say ignore any already defined symbols in the given input files. Normally one would give symbols that can be overridden weak linkage.

I just used `...` in the description to ignore the diff code. The rust doesn't seem to be set to weak by default, I'm not sure of the historical reasons here.

But I found a new issue, even adding this new argument does not solve the issue. For example,

`user.ll`:
```llvm
target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
target triple = "thumbv6m-none-unknown-eabi"

module asm ".global __aeabi_uidivmod"
module asm ".type __aeabi_uidivmod, %function"
module asm "__aeabi_uidivmod:"
module asm "str    r0, [r2, #0x060]" ; It's just an example.
module asm "str    r1, [r2, #0x064]"
```

`builtin.ll`:
```llvm
target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
target triple = "thumbv6m-none-unknown-eabi"

; Function Attrs: naked nocf_check noinline nounwind
define weak hidden void @__aeabi_uidivmod() unnamed_addr {
  tail call void asm sideeffect alignstack "push {lr}\0Asub sp, sp, #4\0Amov r2, sp\0Abl __udivmodsi4\0Aldr r1, [sp]\0Aadd sp, sp, #4\0Apop {pc}", "~{cc},~{memory}"()
  unreachable
}
```

I guess I should add the naked function to `user.ll` to solve it.

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


More information about the llvm-commits mailing list