llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.29k stars 12.11k forks source link

[LTO, MachO] Tests fail when `-objc_relative_method_lists` #101419

Open DataCorrupted opened 3 months ago

DataCorrupted commented 3 months ago

The following tests fail when -objc_relative_method_lists are added. (commit bb4aeb66ab4f399)

MachO/objc-category-conflicts.s
MachO/objc-category-merging-complete-test.s
MachO/objc-category-merging-erase-objc-name-test.s
MachO/objc-category-merging-minimal.s

All cases involve an invalid pointer cast at certain point. For example, in objc-category-conflicts.s gets the following error:

RUN: at line 15: /home/peterrong/llvm-project/build/bin/llvm-mc -filetype=obj -triple=x86_64-apple-macos11.0 -I /home/peterrong/llvm-project/build/tools/lld/test/MachO/Output/objc-category-conflicts.s.tmp /home/peterrong/llvm-project/build/tools/lld/test/MachO/Output/objc-category-conflicts.s.tmp/klass-with-no-rodata.s -o /home/peterrong/llvm-project/build/tools/lld/test/MachO/Output/objc-category-conflicts.s.tmp/klass-with-no-rodata.o
+ /home/peterrong/llvm-project/build/bin/llvm-mc -filetype=obj -triple=x86_64-apple-macos11.0 -I /home/peterrong/llvm-project/build/tools/lld/test/MachO/Output/objc-category-conflicts.s.tmp /home/peterrong/llvm-project/build/tools/lld/test/MachO/Output/objc-category-conflicts.s.tmp/klass-with-no-rodata.s -o /home/peterrong/llvm-project/build/tools/lld/test/MachO/Output/objc-category-conflicts.s.tmp/klass-with-no-rodata.o
RUN: at line 16: ld64.lld -arch x86_64 -platform_version macos 11.0 11.0 -syslibroot /home/peterrong/llvm-project/lld/test/MachO/Inputs/MacOSX.sdk -lSystem -fatal_warnings -dylib -lobjc /home/peterrong/llvm-project/build/tools/lld/test/MachO/Output/objc-category-conflicts.s.tmp/klass.o -o /home/peterrong/llvm-project/build/tools/lld/test/MachO/Output/objc-category-conflicts.s.tmp/libklass.dylib
+ ld64.lld -arch x86_64 -platform_version macos 11.0 11.0 -syslibroot /home/peterrong/llvm-project/lld/test/MachO/Inputs/MacOSX.sdk -lSystem -fatal_warnings -dylib -lobjc /home/peterrong/llvm-project/build/tools/lld/test/MachO/Output/objc-category-conflicts.s.tmp/klass.o -o /home/peterrong/llvm-project/build/tools/lld/test/MachO/Output/objc-category-conflicts.s.tmp/libklass.dylib
ld64.lld: /home/peterrong/llvm-project/llvm/include/llvm/ADT/PointerUnion.h:156: T llvm::PointerUnion<PTs>::get() const [with T = lld::macho::Symbol*; PTs = {lld::macho::Symbol*, lld::macho::InputSection*}]: Assertion `isa<T>(*this) && "Invalid accessor called"' failed.
/home/peterrong/llvm-project/build/tools/lld/test/MachO/Output/objc-category-conflicts.s.script: line 19: 378103 Aborted
llvmbot commented 3 months ago

@llvm/issue-subscribers-lld-macho

Author: Peter Rong (DataCorrupted)

The following tests fail when `-objc_relative_method_lists` are added. (commit bb4aeb66ab4f399) ``` MachO/objc-category-conflicts.s MachO/objc-category-merging-complete-test.s MachO/objc-category-merging-erase-objc-name-test.s MachO/objc-category-merging-minimal.s ``` All cases involve an invalid pointer cast at certain point. For example, in `objc-category-conflicts.s` gets the following error: ``` RUN: at line 15: /home/peterrong/llvm-project/build/bin/llvm-mc -filetype=obj -triple=x86_64-apple-macos11.0 -I /home/peterrong/llvm-project/build/tools/lld/test/MachO/Output/objc-category-conflicts.s.tmp /home/peterrong/llvm-project/build/tools/lld/test/MachO/Output/objc-category-conflicts.s.tmp/klass-with-no-rodata.s -o /home/peterrong/llvm-project/build/tools/lld/test/MachO/Output/objc-category-conflicts.s.tmp/klass-with-no-rodata.o + /home/peterrong/llvm-project/build/bin/llvm-mc -filetype=obj -triple=x86_64-apple-macos11.0 -I /home/peterrong/llvm-project/build/tools/lld/test/MachO/Output/objc-category-conflicts.s.tmp /home/peterrong/llvm-project/build/tools/lld/test/MachO/Output/objc-category-conflicts.s.tmp/klass-with-no-rodata.s -o /home/peterrong/llvm-project/build/tools/lld/test/MachO/Output/objc-category-conflicts.s.tmp/klass-with-no-rodata.o RUN: at line 16: ld64.lld -arch x86_64 -platform_version macos 11.0 11.0 -syslibroot /home/peterrong/llvm-project/lld/test/MachO/Inputs/MacOSX.sdk -lSystem -fatal_warnings -dylib -lobjc /home/peterrong/llvm-project/build/tools/lld/test/MachO/Output/objc-category-conflicts.s.tmp/klass.o -o /home/peterrong/llvm-project/build/tools/lld/test/MachO/Output/objc-category-conflicts.s.tmp/libklass.dylib + ld64.lld -arch x86_64 -platform_version macos 11.0 11.0 -syslibroot /home/peterrong/llvm-project/lld/test/MachO/Inputs/MacOSX.sdk -lSystem -fatal_warnings -dylib -lobjc /home/peterrong/llvm-project/build/tools/lld/test/MachO/Output/objc-category-conflicts.s.tmp/klass.o -o /home/peterrong/llvm-project/build/tools/lld/test/MachO/Output/objc-category-conflicts.s.tmp/libklass.dylib ld64.lld: /home/peterrong/llvm-project/llvm/include/llvm/ADT/PointerUnion.h:156: T llvm::PointerUnion<PTs>::get() const [with T = lld::macho::Symbol*; PTs = {lld::macho::Symbol*, lld::macho::InputSection*}]: Assertion `isa<T>(*this) && "Invalid accessor called"' failed. /home/peterrong/llvm-project/build/tools/lld/test/MachO/Output/objc-category-conflicts.s.script: line 19: 378103 Aborted ```
alx32 commented 3 months ago

https://github.com/llvm/llvm-project/pull/104081#pullrequestreview-2239286954 fixes part of this, but there is a separate issue with MachO/objc-category-merging-complete-test.s