MFH: r552764

devel/llvm10: fix hand-rolled AT_EXECPATH search for older FreeBSD

This was committed in base r360875 and upstream 21e5e1724, which was after
LLVM10 branched and has not been backported.

This failure would only have been noticed if AT_EXECPATH was missing, and
qemu-user-static does not currently provide AT_EXECPATH. As such, any
execution of llvm10 binaries under qemu-user-static immediately segfaulted.

Reported by:	Daniel Tihanyi <daniel.tihanyi@tetragir.com>, jbeich
Approved by:	brooks (maintainer)

Approved by:	ports-secteam (fluffy)
This commit is contained in:
Kyle Evans 2020-10-20 00:15:34 +00:00
parent 789ec24a7a
commit 4ba19d4dcd
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/branches/2020Q4/; revision=552779
2 changed files with 20 additions and 1 deletions

View File

@ -2,7 +2,7 @@
PORTNAME= llvm
DISTVERSION= 10.0.1
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= devel lang
MASTER_SITES= https://github.com/llvm/llvm-project/releases/download/llvmorg-${DISTVERSION:S/rc/-rc/}/ \
https://${PRE_}releases.llvm.org/${LLVM_RELEASE}/${RCDIR}

View File

@ -0,0 +1,19 @@
--- lib/Support/Unix/Path.inc.orig 2020-10-19 17:56:15 UTC
+++ lib/Support/Unix/Path.inc
@@ -208,14 +208,9 @@ std::string getMainExecutable(const char *argv0, void
while (*p++ != 0)
;
// Iterate through auxiliary vectors for AT_EXECPATH.
- for (;;) {
- switch (*(uintptr_t *)p++) {
- case AT_EXECPATH:
+ for (; (uintptr_t *)p != AT_NULL; p++) {
+ if (*(uintptr_t *)p++ == AT_EXECPATH);
return *p;
- case AT_NULL:
- break;
- }
- p++;
}
#endif
// Fall back to argv[0] if auxiliary vectors are not available.