Subject: Re: Postgresql-server compile failes on mac68k
To: None <port-mac68k@NetBSD.org, tech-pkg@NetBSD.org>
From: =?ISO-8859-1?Q?R=E9mi_Zara?= <remi_zara@mac.com>
List: tech-pkg
Date: 09/27/2003 18:09:23
Hi,

The problem was that with ELF, there are no more '_' before symbol=20
names.
So here is the patch to make postgresql-server compile on mac68k:

But this patch is a hack, since it should handle all different m68k=20
plateforms.

Regards,

R=E9mi ZARA


--- postgresql-7.3.4/src/backend/storage/lmgr/s_lock.c  Sat Sep 21=20
02:14:05 2002
+++ s_lock.c    Thu Sep 25 18:47:34 2003
@@ -97,15 +97,15 @@
  {
         __asm__         __volatile__(
                                                                        =20=

          "\
-.global                _tas                            \n\
-_tas:                                                  \n\
-                       movel   sp@(0x4),a0     \n\
-                       tas     a0@                     \n\
+.global                tas                             \n\
+tas:                                                   \n\
+                       movel   %sp@(0x4),%a0   \n\
+                       tas     %a0@                    \n\
                         beq     _success        \n\
-                       moveq   #-128,d0        \n\
+                       moveq   #-128,%d0       \n\
                         rts                                     \n\
  _success:                                              \n\
-                       moveq   #0,d0           \n\
+                       moveq   #0,%d0          \n\
                         rts                                     \n\
  ");
  }
Le mardi, 23 sep 2003, =E0 23:03 Europe/Paris, Allen Briggs a =E9crit :

> On Tue, Sep 23, 2003 at 09:05:11AM +0200, Hauke Fath wrote:
>>> But when it laters links the file, the following error occurs:
>>>
>>> access/SUBSYS.o: In function `XLogWrite':
>>> access/SUBSYS.o(.text+0x19dbc): undefined reference to `tas'
>>
>> ISTR there is a macro that properly exports global symbols from =
inline
>> assembler code. Perhaps if you look around in the netbsd (kernel)=20
>> sources,
>> or the mailing list archives?
>
> If tas is defined in a .S file, make sure it includes machine/asm.h
> and that tas is "ENTRY(tas)" or "ENTRY_NOPROFILE(tas)".  If it's
> inline in a .c file, you should be able to use the equivalent of the
> ENTRY() macro and say:
> 	.text; .even; .globl tas; .type tas,@function; tas:
>
> -allen
>
> --=20
>  Allen Briggs                     briggs@wasabisystems.com
>  Wasabi Systems, Inc.             http://www.wasabisystems.com/
>
>
--
R=E9mi Zara
web: http://www.remi-zara.net/