[PATCH] D104352: [lld-macho] Handle multiple LC_LINKER_OPTIONs

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 16 18:03:54 PDT 2021


int3 added inline comments.


================
Comment at: lld/test/MachO/lc-linker-option.ll:71
+!1 = !{!"-lc++"}
+!llvm.linker.options = !{!0, !0, !1}
 
----------------
thakis wrote:
> int3 wrote:
> > > Out of interest, how do you end up with an obj file with several of these?
> > 
> > This line generates multiple LC_LINKER_OPTIONs. So the old test already had multiple, but since they were both `-lSystem` the issue wasn't noticed
> Well yes, but I mean how do you get clang (or some other compiler) to generate LLVM IR with this? Most people don't write LLVM IR by hand :)
ah gotcha :) The cases I've been seeing are coming from Swift. It seems like Swift generates them even for simple programs:
```
(base) ~/tmp: cat hello.swift
print("Hello, World!")

(base) ~/tmp: swiftc -c hello.swift
(base) ~/tmp: llvm-objdump --private-headers hello.o | grep LC_LINKER_OPTION
     cmd LC_LINKER_OPTION
     cmd LC_LINKER_OPTION
     cmd LC_LINKER_OPTION
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104352



More information about the llvm-commits mailing list