Commit 66b40958 authored by Jan Sjodin's avatar Jan Sjodin
Browse files

llvm-link: Add support for archive files as inputs

This patch adds support for archive files as inputs to llvm-link. One
of the use-cases is for OpenMP, where device specific libraries need
to be extracted from libraries containing bundled object files. The
clang-offload-bundler will support extracting these archives, which
will be passed into llvm-link, see https://reviews.llvm.org/D80816.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D81109
parent 6014c46c
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"

define void @f() {
entry:
  ret void
}
+6 −0
Original line number Diff line number Diff line
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"

define void @g() {
entry:
  ret void
}
+6 −0
Original line number Diff line number Diff line
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"

define void @h() {
entry:
  ret void
}
+7 −0
Original line number Diff line number Diff line
# RUN: cp %S/Inputs/f.ll %t.fg.a
# RUN: not llvm-link %S/Inputs/h.ll %t.fg.a -o %t.linked.bc 2>&1 | FileCheck %s

# RUN: rm -f %t.fg.a
# RUN: rm -f %t.linked.bc

# CHECK: file too small to be an archive
+17 −0
Original line number Diff line number Diff line
# RUN: llvm-as %S/Inputs/f.ll -o %t.f.bc
# RUN: llvm-as %S/Inputs/g.ll -o %t.g.bc
# RUN: llvm-ar cr %t.fg.a %t.f.bc %t.g.bc
# RUN: llvm-ar cr %t.empty.a
# RUN: llvm-link %S/Inputs/h.ll %t.fg.a %t.empty.a -o %t.linked.bc

# RUN: llvm-nm %t.linked.bc | FileCheck %s

# RUN: rm -f %t.f.bc
# RUN: rm -f %t.g.bc
# RUN: rm -f %t.fg.a
# RUN: rm -f %t.empty.a
# RUN: rm -f %t.linked.bc

# CHECK: -------- T f
# CHECK: -------- T g
# CHECK: -------- T h
Loading