From 4a67878a129b794c24ad82110fc465605144bbd3 Mon Sep 17 00:00:00 2001 From: serge-sans-paille Date: Tue, 6 Jul 2021 16:08:48 +0200 Subject: [PATCH] backport cba2552bfec1c9d8 Related: rhbz#1975673 --- ...lace-use-of-deprecated-gethostbyname.patch | 64 +++++++++++++++++++ llvm.spec | 6 +- 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 0001-llvm-jitlink-Replace-use-of-deprecated-gethostbyname.patch diff --git a/0001-llvm-jitlink-Replace-use-of-deprecated-gethostbyname.patch b/0001-llvm-jitlink-Replace-use-of-deprecated-gethostbyname.patch new file mode 100644 index 0000000..f2c512b --- /dev/null +++ b/0001-llvm-jitlink-Replace-use-of-deprecated-gethostbyname.patch @@ -0,0 +1,64 @@ +From 9df652778fc92db9eb371c78bc7d1691417f3a60 Mon Sep 17 00:00:00 2001 +From: Rafik Zurob +Date: Fri, 22 Jan 2021 06:51:19 -0600 +Subject: [PATCH] [llvm-jitlink] Replace use of deprecated gethostbyname by + getaddrinfo. + +This patch replaces use of deprecated gethostbyname by getaddrinfo. + +Author: Rafik Zurob + +Reviewed By: lhames + +Differential Revision: https://reviews.llvm.org/D95477 +--- + llvm/tools/llvm-jitlink/llvm-jitlink.cpp | 28 ++++++++++++++++++++++++---- + 1 file changed, 24 insertions(+), 4 deletions(-) + +diff --git a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp +index da4a164..108dd61 100644 +--- a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp ++++ b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp +@@ -690,15 +690,35 @@ LLVMJITLinkRemoteTargetProcessControl::ConnectToExecutor() { + " is not a valid integer", + inconvertibleErrorCode()); + ++ addrinfo *AI; ++ addrinfo Hints{}; ++ Hints.ai_family = AF_INET; ++ Hints.ai_socktype = SOCK_STREAM; ++ Hints.ai_protocol = PF_INET; ++ Hints.ai_flags = AI_NUMERICSERV; ++ if (getaddrinfo(HostName.c_str(), PortStr.str().c_str(), &Hints, &AI) != 0) ++ return make_error("Failed to resolve " + HostName + ":" + ++ Twine(Port), ++ inconvertibleErrorCode()); ++ + int SockFD = socket(PF_INET, SOCK_STREAM, 0); +- hostent *Server = gethostbyname(HostName.c_str()); + sockaddr_in ServAddr; + memset(&ServAddr, 0, sizeof(ServAddr)); + ServAddr.sin_family = PF_INET; +- memmove(&Server->h_addr, &ServAddr.sin_addr.s_addr, Server->h_length); + ServAddr.sin_port = htons(Port); +- if (connect(SockFD, reinterpret_cast(&ServAddr), +- sizeof(ServAddr)) < 0) ++ ++ // getaddrinfo returns a list of address structures. Go through the list ++ // to find one we can connect to. ++ int ConnectRC = -1; ++ for (addrinfo *Server = AI; Server; Server = Server->ai_next) { ++ memmove(&Server->ai_addr, &ServAddr.sin_addr.s_addr, Server->ai_addrlen); ++ ConnectRC = connect(SockFD, reinterpret_cast(&ServAddr), ++ sizeof(ServAddr)); ++ if (ConnectRC == 0) ++ break; ++ } ++ freeaddrinfo(AI); ++ if (ConnectRC == -1) + return make_error("Failed to connect to " + HostName + ":" + + Twine(Port), + inconvertibleErrorCode()); +-- +1.8.3.1 + diff --git a/llvm.spec b/llvm.spec index 256eb74..6266654 100644 --- a/llvm.spec +++ b/llvm.spec @@ -53,7 +53,7 @@ Name: %{pkg_name} Version: %{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:~rc%{rc_ver}} -Release: 4%{?dist} +Release: 5%{?dist} Summary: The Low Level Virtual Machine License: NCSA @@ -71,6 +71,7 @@ Source5: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{compat %endif Patch0: 0001-PATCH-llvm-Make-source-interleave-prefix-test-case-c.patch +Patch1: 0001-llvm-jitlink-Replace-use-of-deprecated-gethostbyname.patch # RHEL-specific patches Patch101: 0001-Deactivate-markdown-doc.patch @@ -596,6 +597,9 @@ fi %endif %changelog +* Tue Jul 06 2021 sguelton@redhat.com - 12.0.0-5 +- backport cba2552bfec1c9d8 + * Wed Jun 16 2021 Tom Stellard - 12.0.0-4 - Remove pandoc dependency