[llvm-dev] LLD/Mach-O - how to work around this bug?

Andrew Kelley via llvm-dev llvm-dev at lists.llvm.org
Wed Mar 22 09:59:58 PDT 2017


I filed this bug today: https://bugs.llvm.org/show_bug.cgi?id=32376

I understand that the Mach-O linker is not under active development, but
there must be some way to work around this bug. Does anyone have a clue?

This trivial IR file gives "dyld: lazy symbol binding failed: bad lazy bind
info" at runtime when linked with:

 lld -flavor darwin -demangle -dynamic -arch x86_64 -macosx_version_min
10.10.0 -pie -o ./tmp_exe ./tmp_exe.o -lSystem

When linking with the system linker instead, with the same arguments, it
works fine. IR file:

target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-darwin-unknown"

@0 = internal unnamed_addr constant [9 x i8] c"0: %llu\0A\00", align 1

; Function Attrs: nounwind
define i32 @main(i32, i8** nocapture nonnull readnone) local_unnamed_addr
#0 {
Entry:
  %putchar = call i32 @putchar(i32 10)
  %2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9
x i8]* @0, i64 0, i64 0), i64 0)
  ret i32 0
}

; Function Attrs: nounwind
declare i32 @printf(i8* nocapture readonly, ...) #0

declare i32 @putchar(i32) #0

attributes #0 = { nounwind }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170322/98b6a63b/attachment.html>


More information about the llvm-dev mailing list