Re: Re: [ODBC] Re: [PATCHES] Fix for ODBC closeu - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Re: [ODBC] Re: [PATCHES] Fix for ODBC closeu
Date
Msg-id 200102101131.GAA12417@candle.pha.pa.us
Whole thread Raw
In response to Re: [ODBC] Re: [PATCHES] Fix for ODBC closeu  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
> > > Bruce Momjian writes:
> > >
> > > > I have applied the following patch to properly exit ODBC.  I also
> > > > patched the ODBC makefile so it links under BSD/OS.  The -Bsymbolic
> > > > under BSD/OS is very harsh under BSD/OS, requiring all symbols even in
> > > > libc and crt1.o to be resolved before creating the shared library.
> > >
> > > The -Bsymbolic switch is the same on all platforms that have it.  You can
> > > link without it, but then you won't actually be able to use the ODBC
> > > driver.  It seems like you need to link in a few other libraries to
> > > resolve all symbols.
> >
> > OK, if this is true on all platforms, why isn't -lc needed?
> >
>
> And if -lc is somehow done by default with ld -Bsymbolic, how do I deal
> with a link that accesses crt1.o startup symbols, like environ and
> __progname?
>

OK, the following fixes the link on BSDI, while allowing -Bsymbolic.  I
have to explicitly include -R crt1.o to be used to resolve symbols, but
not to be linked in.  Without -R, I get undefined 'main' which makes
sense.

I am still confused why other OS's work, unless -lc is assumed by ld,
and their libc's have no crt1.o references.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
Index: src/interfaces/odbc/GNUmakefile
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/odbc/GNUmakefile,v
retrieving revision 1.9
diff -c -r1.9 GNUmakefile
*** src/interfaces/odbc/GNUmakefile    2001/02/10 05:50:27    1.9
--- src/interfaces/odbc/GNUmakefile    2001/02/10 11:26:13
***************
*** 36,43 ****
  # BSD/OS fails with libc and crt1.o undefined symbols without this.
  # bjm 2001-02-09
  #
- ifneq ($(PORTNAME), bsdi)
  LINK.shared += $(shlib_symbolic)
  endif

  odbc_headers = isql.h isqlext.h iodbc.h
--- 36,44 ----
  # BSD/OS fails with libc and crt1.o undefined symbols without this.
  # bjm 2001-02-09
  #
  LINK.shared += $(shlib_symbolic)
+ ifeq ($(PORTNAME), bsdi)
+ SHLIB_LINK += -lc -R /usr/lib/crt1.o
  endif

  odbc_headers = isql.h isqlext.h iodbc.h

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [ODBC] Re: [PATCHES] Fix for ODBC closeu
Next
From: Peter Eisentraut
Date:
Subject: Re: [PATCHES] Fix for ODBC close