Skip to content

Commit de23d4b

Browse files
committed
FreeBSD: PIC cdecl_official_run.swift Client.o
Swift defaults to PIC everywhere. The Swift toolchain clang emits PIC relocatable objects by default without passing `-fPIC` on Linux, so the emitted Client.o is relocatable. This is not the case on FreeBSD, where clang uses the static relocation model by default resulting in a link failure due to mixing relocations with non-relocatable objects. ``` ld.lld: error: relocation R_X86_64_64 cannot be used against local symbol; recompile with -fPIC ``` Passing `-fPIC` where needed.
1 parent 2926018 commit de23d4b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test/Interpreter/cdecl_official_run.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
/// Build and run a binary from Swift and C code.
1111
// RUN: %clang-no-modules -c %t/Client.c -o %t/Client.o -target %target-triple \
12-
// RUN: -I %t -I %clang-include-dir -Werror -isysroot %sdk
12+
// RUN: %target-pic-opt -I %t -I %clang-include-dir -Werror -isysroot %sdk
1313
// RUN: %target-build-swift %t/Lib.swift %t/Client.o -O -o %t/a.out \
1414
// RUN: -enable-experimental-feature CDecl -parse-as-library
1515
// RUN: %target-codesign %t/a.out

0 commit comments

Comments
 (0)