forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit8a9a515
committed
jit: Use -mno-outline-atomics for bitcode on ARM.
If the executable's .o files were produced by a compiler (probably gcc)not using -moutline-atomics, and the corresponding .bc files wereproduced by clang using -moutline-atomics (probably by default), thenthe generated bitcode functions would have the target attribute"+outline-atomics", and could fail at runtime when inlined. If thetarget ISA at bitcode generation time was armv8-a (the most conservativeaarch64 target, no LSE), then LLVM IR atomic instructions would generatecalls to functions in libgcc.a or libclang_rt.*.a that switch betweenLL/SC and faster LSE instructions depending on a runtime AT_HWCAP check.Since the corresponding .o files didn't need those functions, theywouldn't have been included in the executable, and resolution wouldfail.At least Debian and Ubuntu are known to ship gcc and clang compilersthat target armv8-a but differ on the use of outline atomics by default.Fix, by suppressing the outline atomics attribute in bitcode explicitly.Inline LL/SC instructions will be generated for atomic operations inbitcode built for armv8-a. Only configure scripts are adjusted for now,because the meson build system doesn't generate bitcode yet.This doesn't seem to be a new phenomenon, so real cases of functionsusing atomics that are inlined by JIT must be rare in the wild given howlong it took for a bug report to arrive. The reported case could bereduced to:postgres=# set jit_inline_above_cost = 0;SETpostgres=# set jit_above_cost = 0;SETpostgres=# select pg_last_wal_receive_lsn();WARNING: failed to resolve name __aarch64_swp4_acq_relFATAL: fatal llvm error: Program used external function'__aarch64_swp4_acq_rel' which could not be resolved!The change doesn't affect non-ARM systems or later target ISAs.Back-patch to all supported releases.Reported-by: Alexander Kozhemyakin <a.kozhemyakin@postgrespro.ru>Discussion:https://postgr.es/m/18610-37bf303f904fede3%40postgresql.org1 parent2fb3919 commit8a9a515
2 files changed
+112
-0
lines changedLines changed: 105 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7379 | 7379 |
| |
7380 | 7380 |
| |
7381 | 7381 |
| |
| 7382 | + | |
| 7383 | + | |
| 7384 | + | |
| 7385 | + | |
| 7386 | + | |
| 7387 | + | |
| 7388 | + | |
| 7389 | + | |
| 7390 | + | |
| 7391 | + | |
| 7392 | + | |
| 7393 | + | |
| 7394 | + | |
| 7395 | + | |
| 7396 | + | |
| 7397 | + | |
| 7398 | + | |
| 7399 | + | |
| 7400 | + | |
| 7401 | + | |
| 7402 | + | |
| 7403 | + | |
| 7404 | + | |
| 7405 | + | |
| 7406 | + | |
| 7407 | + | |
| 7408 | + | |
| 7409 | + | |
| 7410 | + | |
| 7411 | + | |
| 7412 | + | |
| 7413 | + | |
| 7414 | + | |
| 7415 | + | |
| 7416 | + | |
| 7417 | + | |
| 7418 | + | |
| 7419 | + | |
| 7420 | + | |
| 7421 | + | |
| 7422 | + | |
| 7423 | + | |
| 7424 | + | |
| 7425 | + | |
| 7426 | + | |
| 7427 | + | |
| 7428 | + | |
| 7429 | + | |
| 7430 | + | |
| 7431 | + | |
| 7432 | + | |
| 7433 | + | |
| 7434 | + | |
| 7435 | + | |
| 7436 | + | |
| 7437 | + | |
| 7438 | + | |
| 7439 | + | |
| 7440 | + | |
| 7441 | + | |
| 7442 | + | |
| 7443 | + | |
| 7444 | + | |
| 7445 | + | |
| 7446 | + | |
| 7447 | + | |
| 7448 | + | |
| 7449 | + | |
| 7450 | + | |
| 7451 | + | |
| 7452 | + | |
| 7453 | + | |
| 7454 | + | |
| 7455 | + | |
| 7456 | + | |
| 7457 | + | |
| 7458 | + | |
| 7459 | + | |
| 7460 | + | |
| 7461 | + | |
| 7462 | + | |
| 7463 | + | |
| 7464 | + | |
| 7465 | + | |
| 7466 | + | |
| 7467 | + | |
| 7468 | + | |
| 7469 | + | |
| 7470 | + | |
| 7471 | + | |
| 7472 | + | |
| 7473 | + | |
| 7474 | + | |
| 7475 | + | |
| 7476 | + | |
| 7477 | + | |
| 7478 | + | |
| 7479 | + | |
| 7480 | + | |
| 7481 | + | |
| 7482 | + | |
| 7483 | + | |
| 7484 | + | |
| 7485 | + | |
| 7486 | + | |
7382 | 7487 |
| |
7383 | 7488 |
| |
7384 | 7489 |
| |
|
Lines changed: 7 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
637 | 637 |
| |
638 | 638 |
| |
639 | 639 |
| |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
640 | 647 |
| |
641 | 648 |
| |
642 | 649 |
| |
|
0 commit comments
Comments
(0)