Re: Segfault in jit tuple deforming on arm64 due to LLVM issue

From: Anthonin Bonnefoy <anthonin(dot)bonnefoy(at)datadoghq(dot)com>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Segfault in jit tuple deforming on arm64 due to LLVM issue
Date: 2024-08-30 14:34:03
Message-ID: CAO6_Xqr3j4LXohmnDjA4RR6YrDVw7WFqxTbwLv3iLMe=SJeZeg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I created a commitfest entry[1] to have the CI test the patch. There
was a failure in headerscheck and cpluspluscheck when the include of
SectionMemoryManager.h is checked[2]

In file included from /usr/include/llvm/ADT/SmallVector.h:18,
from /tmp/cirrus-ci-build/src/include/jit/SectionMemoryManager.h:23,
from /tmp/headerscheck.4b1i5C/test.c:2:
/usr/include/llvm/Support/type_traits.h:17:10: fatal error:
type_traits: No such file or directory
17 | #include <type_traits>

Since the SmallVector.h include type_traits, this file can't be
compiled with a C compiler so I've just excluded it from headerscheck.

Loosely related to headerscheck, running it locally was failing as it
couldn't find the <llvm-c/Core.h> file. This is because headerscheck
except llvm include files to be in /usr/include and don't rely on
llvm-config. I created a second patch to use the LLVM_CPPFLAGS as
extra flags when testing the src/include/jit/* files.

Lastly, I've used www.github.com instead of github.com link to stop
spamming the llvm-project's PR with reference to the commit every time
it is pushed somewhere (which seems to be the unofficial hack[3]).

[1] https://commitfest.postgresql.org/49/5220/
[2] https://cirrus-ci.com/task/4646639124611072?logs=headers_headerscheck#L42-L46
[3] https://github.com/orgs/community/discussions/23123#discussioncomment-3239240

Attachment Content-Type Size
v6-0002-Add-LLVM_CPPFLAGS-in-headerscheck-to-llvm-jit-fil.patch application/octet-stream 1.8 KB
v6-0001-Backport-of-LLVM-code-to-fix-ARM-relocation-bug.patch application/octet-stream 32.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Sami Imseih 2024-08-30 15:50:49 Re: Restart pg_usleep when interrupted
Previous Message Peter Geoghegan 2024-08-30 14:32:30 Re: bt Scankey in another contradictory case