Subject: Re: Strange segmentation fault trying to run postgresql on current
To: =?ISO-8859-1?Q?R=E9mi_Zara?= <remi.zara@free.fr>
From: Michael L. Hitch <mhitch@lightning.msu.montana.edu>
List: port-cobalt
Date: 04/30/2007 12:01:19
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--0-1234026555-1177956079=:19377
Content-Type: TEXT/PLAIN; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE

On Mon, 30 Apr 2007, R=E9mi Zara wrote:

> The app crashes before the call to save_ps_display_args, but after the ca=
ll=20
> to get_progname(argv[0]) which seems to be returning a correct value.
> startup_hacks(progname) gets optimized out (because it turns out empty) a=
t=20
> -O2
>
>> I run in to similar problem when code would run on linux but would produ=
ce=20
>> exception on nucleus and vxworks. Turned out that linux exception handle=
r=20
>> would recover from unaligned access by loading register and continuing=
=20
>> program. Maybe this is the case for this application as well. No one=20
>> checked this app on mips.
>>=20
>
> PostgreSQL builds and runs OK on debian 3.1 MIPS, but maybe it's due to t=
he=20
> unaligned trap handler

   What version of gcc and what version of binutils are being used on the=
=20
debian build?

   It looks to me like it might be  a binutils problem.  I just finished=20
building the pkgsrc version on a DEC 5000/150, and what I see is:

00888ef2 S pg_krb_caseins_users
00888ef3 S Unix_socket_permissions
00888ef7 S progname
00888efb S newNodeMacroHolder

   There are quite a few entries that are on an odd-word boundary=20
preceeding this, but the pg_krb_caseins_users item puts things on an=20
odd-byte as well.

   The .s files shows that pg_krb_caseins_users is a .comm with a length of=
=20
1 and an alignment of 1.   They .s files also show that both=20
Unix_socket_permissions and progname are .comm with a length of 4 and an=20
alignment of 4.  Either gas is not indicating the alignment requirements=20
for these, or ld is not doing the alignemnts properly.

   The pg_krb_caseins_users symbol comes from libpq/auth.o, and a readelf=
=20
-s on that file shows:

    Num:    Value  Size Type    Bind   Vis      Ndx Name
     14: 00000000     4 OBJECT  GLOBAL DEFAULT    4 pg_krb_server_hostname
     35: 00000004     4 OBJECT  GLOBAL DEFAULT  COM pg_krb_server_keyfile
     36: 00000004     4 OBJECT  GLOBAL DEFAULT  COM pg_krb_srvnam
     37: 00000001     1 OBJECT  GLOBAL DEFAULT  COM pg_krb_caseins_users

   If the Value field specifies the alignment requirement, then it looks=20
like gas is generating the proper alighment information, in which case the=
=20
problem would be with ld not aligning things properly.

--
Michael L. Hitch=09=09=09mhitch@montana.edu
Computer Consultant
Information Technology Center
Montana State University=09Bozeman, MT=09USA
--0-1234026555-1177956079=:19377--