[PATCH] D75382: [lld] Initial commit for new Mach-O backend
Jez Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 2 06:52:45 PST 2020
int3 marked 4 inline comments as done.
int3 added a comment.
> I guess the answer is no because you need to support dynamic linking.
The answer is actually yes, though we cheat a bit :D I've updated the summary.
================
Comment at: lld/MachO/InputFiles.cpp:148
+ ArrayRef<const section_64>{(const section_64 *)(c + 1), c->nsects};
+ sections = parseSections(objSections);
+ }
----------------
MaskRay wrote:
> ```
> /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_vector.h:398:7: error: static_assert failed due to requirement 'is_same<llvm::MachO
> ::section_64, const llvm::MachO::section_64>::value' "std::vector must have a non-const, non-volatile value_type"
> static_assert(is_same<typename remove_cv<_Tp>::type, _Tp>::value,
> ```
ah I need to figure out how to build with gcc locally... but it looks like the error comes from the ArrayRef of `const`, so I've removed the `const`
================
Comment at: lld/MachO/Target.cpp:20
+
+struct X86_64 : TargetInfo {
+ X86_64();
----------------
MaskRay wrote:
> How many targets do Mach-O have? If it can be larger, like `ELF/Arch/X86_64.cpp`, we can create `MachO/Arch` accordingly.
we'll want to target ARM at some point. I'll create the subdir
================
Comment at: lld/MachO/Writer.cpp:249
+private:
+ StringRef path = "/usr/lib/dyld";
+};
----------------
MaskRay wrote:
> Is it a const?
>
> Who defines it as /usr/lib/dyld ?
ld64 defaults this value to /usr/lib/dyld but allows you to override it via the env var LD_DYLD_PATH. However recent versions of the kernel don't execute anything with a different dyld path so it's effectively a constant: https://github.com/apple/darwin-xnu/pull/8
I'll make this a const and add a comment.
================
Comment at: lld/tools/lld/CMakeLists.txt:15
lldELF
+ lldMachO2
lldMinGW
----------------
MaskRay wrote:
> I hope we can name it lldMacho.
I'm not sure if anyone is still depending on the old partial Mach-O implementation. If no one objects I'll take over its build/flavor names
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75382/new/
https://reviews.llvm.org/D75382
More information about the llvm-commits
mailing list