Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3da9c06

Browse files
committed
Fix s_lock.h PPC assembly code to be compatible with native AIX assembler.
On recent AIX it's necessary to configure gcc to use the native assembler(because the GNU assembler hasn't been updated to handle AIX 6+). Thiscaused PG builds to fail with assembler syntax errors, because we'd tryto compile s_lock.h's gcc asm fragment for PPC, and that assembly coderelied on GNU-style local labels. We can't substitute normal labelsbecause it would fail in any file containing more than one inlined use oftas(). Fortunately, that code is stable enough, and the PPC ISA is simpleenough, that it doesn't seem like too much of a maintenance burden to justhand-code the branch offsets, removing the need for any labels.Note that the AIX assembler only accepts "$" for the location counterpseudo-symbol. The usual GNU convention is "."; but it appears that allversions of gas for PPC also accept "$", so in theory this patch will notbreak any other PPC platforms.This has been reported by a few people, but Steve Underwood gets the creditfor being the first to pursue the problem far enough to understand why itwas failing. Thanks also to Noah Misch for additional testing.
1 parentbef4584 commit3da9c06

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

‎src/include/storage/s_lock.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,12 @@ typedef unsigned int slock_t;
483483
* NOTE: per the Enhanced PowerPC Architecture manual, v1.0 dated 7-May-2002,
484484
* an isync is a sufficient synchronization barrier after a lwarx/stwcx loop.
485485
* On newer machines, we can use lwsync instead for better performance.
486+
*
487+
* Ordinarily, we'd code the branches here using GNU-style local symbols, that
488+
* is "1f" referencing "1:" and so on. But some people run gcc on AIX with
489+
* IBM's assembler as backend, and IBM's assembler doesn't do local symbols.
490+
* So hand-code the branch offsets; fortunately, all PPC instructions are
491+
* exactly 4 bytes each, so it's not too hard to count.
486492
*/
487493
static __inline__int
488494
tas(volatileslock_t*lock)
@@ -497,20 +503,18 @@ tas(volatile slock_t *lock)
497503
"lwarx %0,0,%3\n"
498504
#endif
499505
"cmpwi %0,0\n"
500-
"bne1f\n"
506+
"bne$+16\n"/* branch to li %1,1 */
501507
"addi %0,%0,1\n"
502508
"stwcx. %0,0,%3\n"
503-
"beq 2f \n"
504-
"1:li %1,1\n"
505-
"b3f\n"
506-
"2:\n"
509+
"beq $+12\n"/* branch to lwsync/isync */
510+
"li %1,1\n"
511+
"b $+12\n"/* branch to end of asm sequence */
507512
#ifdefUSE_PPC_LWSYNC
508513
"lwsync\n"
509514
#else
510515
"isync\n"
511516
#endif
512517
"li %1,0\n"
513-
"3:\n"
514518

515519
:"=&r"(_t),"=r"(_res),"+m"(*lock)
516520
:"r"(lock)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp