[PATCH] D131628: [LangRef] Add description for nocallback attribute

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 15 13:41:22 PDT 2022


jdoerfert added a comment.

> The linker must always drop nocallback.

Yes, let's do that. We'll create a patch. Also for `inaccessiblememonly` and friends, see below.

@mysterymath Great example. `inaccessiblememonly` is broken in the same way :)

  ; main.ll
  define i32 @main() {
  entry:
    call void @foo()
    %r = call i32 @bar()
    ret i32 %r
  }
  declare void @foo() inaccessiblememonly
  declare i32 @bar()

  ; foo.ll
  @g = global i32 0
  
  define void @foo() {
  entry:
    store i32 42, i32* @g
    ret void
  }

  ; bar.ll
  @g = external global i32
  
  define i32 @bar() {
  entry:
    %r = load i32, i32* @g
    ret i32 %r
  }

`llvm-link main.ll bar.ll -o merged.ll`

  ; merged.ll
  @g = external global i32
  
  define i32 @main() {
  entry:
    call void @foo()
    %r = call i32 @bar()
    ret i32 %r
  }
  
  ; Function Attrs: inaccessiblememonly
  declare void @foo() #0
  
  define i32 @bar() {
  entry:
    %r = load i32, i32* @g
    ret i32 %r
  }
  
  attributes #0 = { inaccessiblememonly }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131628



More information about the llvm-commits mailing list