Skip to content

Commit

Permalink
llvm-5.0: fix the build on old systems with newer GCC, enable PPC (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
barracuda156 committed Aug 7, 2022
1 parent 8cf346a commit e6a4636
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 10 deletions.
26 changes: 16 additions & 10 deletions lang/llvm-5.0/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ set suffix mp-${llvm_version}
set sub_prefix ${prefix}/libexec/llvm-${llvm_version}
dist_subdir llvm
categories lang
platforms darwin
license NCSA
maintainers {jeremyhu @jeremyhu}

Expand Down Expand Up @@ -314,16 +313,17 @@ if {${os.platform} eq "darwin" && ${os.major} >= 11} {
configure.args-append -DPYTHON_EXECUTABLE=${pythonfullpath}

platform darwin {
# libcxx is untested on PPC
if {${build_arch} ni [list ppc ppc64]} {
configure.cxx_stdlib libc++
depends_lib-append port:libcxx

configure.cxx_stdlib libc++
depends_lib-append port:libcxx
supported_archs i386 x86_64

pre-fetch {
if {${os.major} < 11} {
if {![file exists /usr/lib/libc++.dylib]} {
ui_error "$name requires a C++11 runtime, which your configuration does not allow"
error "unsupported configuration"
pre-fetch {
if {${os.major} < 11} {
if {![file exists /usr/lib/libc++.dylib]} {
ui_error "$name requires a C++11 runtime, which your configuration does not allow"
error "unsupported configuration"
}
}
}
}
Expand Down Expand Up @@ -370,6 +370,12 @@ platform darwin {

# https://llvm.org/bugs/show_bug.cgi?id=25680
configure.cxxflags-append -U__STRICT_ANSI__

# Wrong type in OrcRemoteTargetClient.h
# error: could not convert 'Src->((llvm::orc::remote::OrcRemoteTargetClient<ChannelT>*)this)->callB<llvm::orc::remote::OrcRemoteTargetRPCAPI::ReadMem>(Size)'
# from 'Expected<vector<unsigned char,allocator<unsigned char>>>' to 'Expected<vector<char,allocator<char>>>'
# Patch borrows from llvm-7.1: https://github.com/iains/LLVM-7-branch/blob/7.1.1-Darwin-WIP/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h
patchfiles-append patch-include-orc.diff
}

# https://llvm.org/bugs/show_bug.cgi?id=25674
Expand Down
15 changes: 15 additions & 0 deletions lang/llvm-5.0/files/patch-include-orc.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Existing code fails to build on PPC:
# error: could not convert 'Src->((llvm::orc::remote::OrcRemoteTargetClient<ChannelT>*)this)->callB<llvm::orc::remote::OrcRemoteTargetRPCAPI::ReadMem>(Size)' from 'Expected<vector<unsigned char,allocator<unsigned char>>>' to 'Expected<vector<char,allocator<char>>>'
# Fix from: https://github.com/iains/LLVM-7-branch/blob/7.1.1-Darwin-WIP/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h

--- include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h.orig 2022-08-07 10:10:02.000000000 +0545
+++ include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h 2022-08-07 09:48:41.000000000 +0545
@@ -713,7 +713,7 @@

uint32_t getTrampolineSize() const { return RemoteTrampolineSize; }

- Expected<std::vector<char>> readMem(char *Dst, JITTargetAddress Src,
+ Expected<std::vector<uint8_t>> readMem(char *Dst, JITTargetAddress Src,
uint64_t Size) {
// Check for an 'out-of-band' error, e.g. from an MM destructor.
if (ExistingError)

0 comments on commit e6a4636

Please sign in to comment.