[PATCH] D95126: [llvm-link] Fix for an assertion when linking global with appending linkage

Sergey Dmitriev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 22 01:24:47 PST 2021


sdmitriev updated this revision to Diff 318436.
sdmitriev marked an inline comment as done.
sdmitriev added a comment.

> Given the langref text I'm unsure what it means to link an append linkage variable to a non-append linkage one. I can see how extern is different but what would happen before & now if you remove the extern.

On current implementation llvm-link will die with an assertion no matter if extern is there or not. With this (updated) patch llvm-link will print an error message that both variables should have appending linkage (if extern is removed). I have added such test as well as few other negative tests.

> And what happens before/now if you have append on both @var? We should add those tests if possible.

That should be fine, arrays from both vars will be appended in the result as described in the langref. This behavior is already checked by the following tests  - Linker/AppendingLinkage.ll, Linker/AppendingLinkage2.ll.


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

https://reviews.llvm.org/D95126

Files:
  llvm/lib/Linker/IRMover.cpp
  llvm/lib/Linker/LinkModules.cpp
  llvm/test/Linker/Inputs/appending-global.ll
  llvm/test/Linker/appending-global-err1.ll
  llvm/test/Linker/appending-global-err2.ll
  llvm/test/Linker/appending-global-err3.ll
  llvm/test/Linker/appending-global-err4.ll
  llvm/test/Linker/appending-global-err5.ll
  llvm/test/Linker/appending-global-proto.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95126.318436.patch
Type: text/x-patch
Size: 8584 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210122/3884b0f3/attachment.bin>


More information about the llvm-commits mailing list