61 lines · plain
1# RUN: split-file %s %t2# RUN: llvm-mc -triple=wasm32-unknown-unknown -filetype=obj %t/ok.s | llvm-readobj --symbols - | FileCheck %s3# RUN: not llvm-mc -triple=wasm32-unknown-unknown -filetype=obj %t/conflict.s 2>&1 | FileCheck --check-prefix=ERR %s4 5# Regression test for a wasm backend abort on a repeated assembler symbol6# assignment ("X = Y" / ".set X, Y").7#8# MCContext::cloneSymbol() has no wasm case, so any redefinable reassignment of9# a symbol used to abort with:10# fatal error: .set redefinition is not supported11#12# This fires en masse when many glibc translation units are merged into one13# bitcode module with llvm-link: each TU carries the same module-level asm14# symbol assignment (e.g. "mempcpy = __mempcpy" from libc_hidden_def /15# weak_alias / __GI_ / <string.h> builtins), and the merged module's module-asm16# blocks are concatenated without dedup, so the identical "X = Y" appears twice.17#18# Match GNU-as, where "=" / ".set" is freely reassignable and an identical19# reassignment is a no-op: an identical redefinition is accepted (idempotent),20# but a redefinition to a *different* value is still rejected loudly.21 22#--- ok.s23# An identical "=" and an identical ".set" repetition are both accepted, and the24# alias resolves once to its target (no duplicate, no crash).25 .globl __mempcpy26__mempcpy:27 .functype __mempcpy () -> ()28 end_function29 30mempcpy = __mempcpy31mempcpy = __mempcpy32 33 .set stpcpy, __mempcpy34 .set stpcpy, __mempcpy35 36# CHECK: Symbols [37# CHECK: Name: __mempcpy38# CHECK-NEXT: Type: FUNCTION39# CHECK: Name: mempcpy40# CHECK-NEXT: Type: FUNCTION41# CHECK: Name: stpcpy42# CHECK-NEXT: Type: FUNCTION43# CHECK: ]44 45#--- conflict.s46# A redefinition to a different value is a genuine conflict: never-silent, it is47# rejected loudly rather than silently picking one target.48 .globl __mempcpy49__mempcpy:50 .functype __mempcpy () -> ()51 end_function52 .globl __other53__other:54 .functype __other () -> ()55 end_function56 57mempcpy = __mempcpy58mempcpy = __other59 60# ERR: error: conflicting redefinition of 'mempcpy'61