[PATCH] D139199: [lld/mac] Fix --start-lib/--end-lib with split thinlto inputs

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 2 21:38:49 PST 2022


MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.
Herald added a subscriber: StephenFan.

`__ZTI1S` is a LazyObject referring to `vtable.o` but appears in `vtable.o` twice.
When vtable.o is parsed as a lazy bitcode file due to `__ZN1SC1Ev`, the first `__ZTI1S` (undefined) causes  vtable.o to be extracted again and makes an `assert` fail.



================
Comment at: lld/test/MachO/thinlto-split-unit-start-lib.ll:9
+;; _ZTI1S below) is present once as undefined and once as defined, it gets
+;; added. When something then references a different symbol in the bitcode
+;; file, causing it to be loaded, would go through all the symbols in the
----------------
I find the sentences since "When something then ..." are somewhat difficult to understand...


================
Comment at: lld/test/MachO/thinlto-split-unit-start-lib.ll:23
+
+; RUN: %lld -lc++ --start-lib %t/vtable.o --end-lib %t/vtable_use.o -o /dev/null
+
----------------
`-lc++` isn't necessary. I suggest a relocatable file with

```
.section __DATA,__data
.globl __ZTVN10__cxxabiv117__class_type_infoE
__ZTVN10__cxxabiv117__class_type_infoE:
```


================
Comment at: lld/test/MachO/thinlto-split-unit-start-lib.ll:80
+
+attributes #0 = { mustprogress nofree norecurse nosync nounwind ssp willreturn memory(argmem: write) uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "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" }
+attributes #1 = { mustprogress nofree norecurse nosync nounwind ssp willreturn memory(none) uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "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" }
----------------
These `#*` and `!*` can all be removed to denoise the test file.


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

https://reviews.llvm.org/D139199



More information about the llvm-commits mailing list