Re: [BUGS] Solaris cc compiler on amd: PostgreSQL does not have native - Mailing list pgsql-patches
From | Bruce Momjian |
---|---|
Subject | Re: [BUGS] Solaris cc compiler on amd: PostgreSQL does not have native |
Date | |
Msg-id | 200512172107.jBHL7qd19802@candle.pha.pa.us Whole thread Raw |
Responses |
Re: [BUGS] Solaris cc compiler on amd: PostgreSQL does not have native
|
List | pgsql-patches |
Pierre Girard wrote: > Tom Lane wrote: > > >You'd need to do something about adapting src/backend/port/tas/solaris_i386.s > > > >It's possible that the assembly code would work as-is on amd, in which > >case you'd just need a one-liner change in s_lock.h and maybe some > >adjustment of the template file. > > > > > It doesn't compile with the options to create amd code. > cc -Xa -xtarget=opteron -xarch=amd64 -c solaris_i386.s > Assembler: tas.s > "solaris_i386.s", line 12 : Illegal mnemonic > "solaris_i386.s", line 14 : Illegal mnemonic > "solaris_i386.s", line 15 : Syntax error > "solaris_i386.s", line 17 : Syntax error > "solaris_i386.s", line 26 : Illegal mnemonic > "solaris_i386.s", line 28 : Illegal mnemonic > cc: assembler failed for solaris_i386.s > > The same file compiles without those options: > cc -Xa -c solaris_i386.s Interesting. Seems you have a setup that uses its own assembly source file in port/tas/solaris_i386.s, rather than using inline C ASM. There are files for both Sparc and i386 there, and are both used only for the Sun compiler. Does the Sun compiler not support ASM inlining? Looking at the error line, it is: pushl %ebp /save prev base pointer and then: pushl %ebx /save prev bx Looks like it is all documented here: http://www.x86-64.org/documentation/assembly Specifically: Exceptions from this rule are instructions manipulating the stack (push, pop, call, ret, enter and leave) which are implicitly 64-bit and their 32-bit counterparts are not available anymore, yet their 16-bit counterparts are. So: pushl %eax # Illegal instruction pushq %rax # 1 byte instruction encoded as pushl %eax in 32 bits pushq %r10 # 2 byte instruction encoded as pushl preceeded by REX. Looking before that, the 64-bit registers are now prefixed with 'r' instead of 'e', so what I did was to convert all the long/l assembler instructions to quad/64-bit/q, and rename the registers to use 64-bit versions. I also modified the function alignment from 4 to 8, patch attached. Please give it a try and report back any error lines. Seems Sun might be interested in geting this working. We don't have an official Sun contact yet for this project. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 Index: src/backend/port/tas/solaris_i386.s =================================================================== RCS file: /cvsroot/pgsql/src/backend/port/tas/solaris_i386.s,v retrieving revision 1.2 diff -c -c -r1.2 solaris_i386.s *** src/backend/port/tas/solaris_i386.s 19 Jun 1998 02:55:09 -0000 1.2 --- src/backend/port/tas/solaris_i386.s 17 Dec 2005 20:57:07 -0000 *************** *** 9,33 **** .globl tas tas: ! pushl %ebp /save prev base pointer ! movl %esp,%ebp /new base pointer ! pushl %ebx /save prev bx ! movl 8(%ebp),%ebx /load bx with address of lock ! movl $255,%eax /put something in ax ! xchgb %al,(%ebx) /swap lock value with "0" cmpb $0,%al /did we get the lock? jne .Locked ! subl %eax,%eax /yes, we got it -- return 0 jmp .Finish ! .align 4 .Locked: ! movl $1,%eax /no, we didn't get it - return 1 .Finish: ! popl %ebx /restore prev bx ! movl %ebp,%esp /restore stack state ! popl %ebp ret /return ! .align 4 .type tas,@function .size tas,.-tas --- 9,33 ---- .globl tas tas: ! pushq %rbp /save prev base pointer ! movq %rsp,%rbp /new base pointer ! pushq %rbx /save prev bx ! movq 8(%rbp),%rbx /load bx with address of lock ! movq $255,%rax /put something in ax ! xchgb %al,(%rbx) /swap lock value with "0" cmpb $0,%al /did we get the lock? jne .Locked ! subq %rax,%rax /yes, we got it -- return 0 jmp .Finish ! .align 8 .Locked: ! movq $1,%rax /no, we didn't get it - return 1 .Finish: ! popq %rbx /restore prev bx ! movq %rbp,%rsp /restore stack state ! popq %rbp ret /return ! .align 8 .type tas,@function .size tas,.-tas
pgsql-patches by date: