[PATCH] D108850: [LLD] Remove global state in lldCommon

Yaxun Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 7 21:21:59 PST 2022


yaxunl added a comment.

This patch caused regressions for HIP on Windows. Basically, any HIP programs using device variables will fail to link on Windows. The issue does not happen on Linux.

To reproduce,

  $ cat a-hip-amdgcn-amd-amdhsa-gfx1031.s
          .text
          .amdgcn_target "amdgcn-amd-amdhsa--gfx1031"
          .p2alignl 6, 3214868480
          .fill 48, 4, 3214868480
          .protected      xxx                     ; @xxx
          .type   xxx, at object
          .data
          .globl  xxx
          .p2align        2
  xxx:
          .long   123                             ; 0x7b
          .size   xxx, 4
  
          .ident  "clang version 14.0.0 (git at github.amd.com:Compute-Mirrors/llvm-project.git ce53ba9aaee8d053604883d5befaf07bad60ba84)"
          .section        ".note.GNU-stack"
          .addrsig
          .amdgpu_metadata
  ---
  amdhsa.kernels:  []
  amdhsa.target:   amdgcn-amd-amdhsa--gfx1031
  amdhsa.version:
    - 1
    - 1
  ...
  
          .end_amdgpu_metadata
  
  $  "C:\\hip\\bin\\clang++.exe" -cc1as -triple amdgcn-amd-amdhsa -filetype obj -target-cpu gfx1031 -mrelocation-model pic -mincremental-linker-compatible --mrelax-relocations -o a-hip-amdgcn-amd-amdhsa-gfx1031.o a-hip-amdgcn-amd-amdhsa-gfx1031.s
  
  $ "C:\\hip\\bin\\lld.exe" -flavor gnu -shared a-hip-amdgcn-amd-amdhsa-gfx1031.o
  lld: error: duplicate symbol: xxx
  >>> defined at a-hip-amdgcn-amd-amdhsa-gfx1031.o:(xxx)
  >>> defined at a-hip-amdgcn-amd-amdhsa-gfx1031.o:(.data+0x0)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108850/new/

https://reviews.llvm.org/D108850



More information about the llvm-commits mailing list