This is an archive of the discontinued LLVM Phabricator instance.

[MachO][NFC] Extract all CPU_(SUB_)TYPE logic to libObject
ClosedPublic

Authored by thegameg on Feb 18 2020, 4:59 PM.

Details

Summary

This moves all the logic of converting LLVM Triples to MachO::CPU_(SUB_)TYPE from the specific target (Target)AsmBackend to more convenient functions in libObject.

This also gets rid of the separate two X86AsmBackend classes.

Diff Detail

Event Timeline

thegameg created this revision.Feb 18 2020, 4:59 PM
steven_wu accepted this revision.Feb 19 2020, 9:40 AM
This revision is now accepted and ready to land.Feb 19 2020, 9:40 AM
mtrent accepted this revision.Feb 19 2020, 1:44 PM
This revision was automatically updated to reflect the committed changes.

Hi @thegameg, this commit is breaking the shared libs builds. Could you please make sure you code works when configuring with -DBUILD_SHARED_LIBS=On?

Thank you!

clang: error: linker command failed with exit code 1 (use -v to see invocation)
[14/93] Linking CXX shared library lib/libLLVMAnalysis.so.11git
ninja: build stopped: subcommand failed.
1874dee5662603c9251228c71b66de72cec0c979 is the first bad commit
commit 1874dee5662603c9251228c71b66de72cec0c979
Author: Francis Visoiu Mistrih <francisvm@yahoo.com>
Date:   Tue Feb 18 16:39:05 2020 -0800

    [macho][NFC] Extract all CPU_(SUB_)TYPE logic to BinaryFormat

    This moves all the logic of converting LLVM Triples to
    MachO::CPU_(SUB_)TYPE from the specific target (Target)AsmBackend to
    more convenient functions in lib/BinaryFormat.

    This also gets rid of the separate two X86AsmBackend classes.

    The previous attempt was to add it to libObject, but that adds an
    unnecessary dependency to libObject from all the targets.

    Differential Revision: https://reviews.llvm.org/D74808

:040000 040000 a02bd9834ed78adda514673d37fede6d5f0308a7 81560f612058cf731629ee17d8e638f99051da21 M	llvm
bisect run success

Hi @thegameg, this commit is breaking the shared libs builds. Could you please make sure you code works when configuring with -DBUILD_SHARED_LIBS=On?

Thank you!

clang: error: linker command failed with exit code 1 (use -v to see invocation)
[14/93] Linking CXX shared library lib/libLLVMAnalysis.so.11git
ninja: build stopped: subcommand failed.
1874dee5662603c9251228c71b66de72cec0c979 is the first bad commit
commit 1874dee5662603c9251228c71b66de72cec0c979
Author: Francis Visoiu Mistrih <francisvm@yahoo.com>
Date:   Tue Feb 18 16:39:05 2020 -0800

    [macho][NFC] Extract all CPU_(SUB_)TYPE logic to BinaryFormat

    This moves all the logic of converting LLVM Triples to
    MachO::CPU_(SUB_)TYPE from the specific target (Target)AsmBackend to
    more convenient functions in lib/BinaryFormat.

    This also gets rid of the separate two X86AsmBackend classes.

    The previous attempt was to add it to libObject, but that adds an
    unnecessary dependency to libObject from all the targets.

    Differential Revision: https://reviews.llvm.org/D74808

:040000 040000 a02bd9834ed78adda514673d37fede6d5f0308a7 81560f612058cf731629ee17d8e638f99051da21 M	llvm
bisect run success

Fixed by fad1c750f16c5f7a7ef8ec7d78ae1df4bc473c4a.

The dependency has been changed from Object to BinaryFormat by 1874dee5662603c9251228c71b66de72cec0c979

Thanks @fpetrogalli and @MaskRay. I did one more cleanup: a32d539798e4 [Target] Remove libObject dependency in lib/Target.