[PATCH] D119294: [lld-macho] -flat_namespace for dylibs should make all externs interposable

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 10 16:09:11 PST 2022


int3 added a comment.

Hmm, maybe that's why clang doesn't seem to set `dso_local` when compiling for macos?

  ~/tmp: cat test.c
  void f1(char a) {}
  ~/tmp: clang -target x86_64-unknown-linux-gnu -c -emit-llvm test.c -o - | llvm-dis
  ; ModuleID = '<stdin>'
  source_filename = "test.c"
  target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
  target triple = "x86_64-unknown-linux-gnu"
  
  ; Function Attrs: noinline nounwind optnone uwtable
  define dso_local void @f1(i8 signext %0) #0 {
    %2 = alloca i8, align 1
    store i8 %0, i8* %2, align 1
    ret void
  }
  
  attributes #0 = { noinline nounwind optnone uwtable "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" }
  
  !llvm.module.flags = !{!0}
  !llvm.ident = !{!1}
  
  !0 = !{i32 1, !"wchar_size", i32 4}
  !1 = !{!"Apple clang version 13.0.0 (clang-1300.0.29.30)"}
  ~/tmp: clang -target x86_64-apple-darwin -c -emit-llvm test.c -o - | llvm-dis
  ; ModuleID = '<stdin>'
  source_filename = "test.c"
  target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
  target triple = "x86_64-apple-macosx12.0.0"
  
  ; Function Attrs: noinline nounwind optnone ssp uwtable
  define void @f1(i8 signext %0) #0 {
    %2 = alloca i8, align 1
    store i8 %0, i8* %2, align 1
    ret void
  }
  
  attributes #0 = { noinline nounwind optnone ssp uwtable "darwin-stkchk-strong-link" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "probe-stack"="___chkstk_darwin" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+cx8,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "tune-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" }
  
  !llvm.module.flags = !{!0, !1, !2}
  !llvm.ident = !{!3}
  
  !0 = !{i32 2, !"SDK Version", [2 x i32] [i32 12, i32 1]}
  !1 = !{i32 1, !"wchar_size", i32 4}
  !2 = !{i32 7, !"PIC Level", i32 2}
  !3 = !{!"Apple clang version 13.0.0 (clang-1300.0.29.30)"}


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119294



More information about the llvm-commits mailing list