Thread
-
Fix for ODBC close
Bruce Momjian <pgman@candle.pha.pa.us> — 2001-02-10T05:46:26Z
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. My 'ld' manual says: -Bsymbolic When creating a shared library, bind references to global symbols to the definition within the shared library, if any. Normally, it is possible for a program linked against a shared library to override the definition within the shared library. This op- tion is only meaningful on ELF platforms which sup- port shared libraries. -- 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 -
Re: [PATCHES] Fix for ODBC close
Peter Eisentraut <peter_e@gmx.net> — 2001-02-10T09:38:39Z
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. -- Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
-
Re: [PATCHES] Fix for ODBC close
Bruce Momjian <pgman@candle.pha.pa.us> — 2001-02-10T10:54:58Z
> 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? -- 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
-
Re: [ODBC] Re: [PATCHES] Fix for ODBC closeu
Bruce Momjian <pgman@candle.pha.pa.us> — 2001-02-10T10:57:56Z
> > 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? -- 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
-
Re: Re: [ODBC] Re: [PATCHES] Fix for ODBC closeu
Bruce Momjian <pgman@candle.pha.pa.us> — 2001-02-10T11:31:12Z
> > > 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
-
Re: [PATCHES] Fix for ODBC close
Peter Eisentraut <peter_e@gmx.net> — 2001-02-10T11:53:44Z
Bruce Momjian writes: > > 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? Theory 1: Many other platforms use the compiler driver ([g]cc) to link shared libraries. That makes all the right things happen. Most likely this should happen on a lot more platforms that currently use ld directly. Theory 2: Not many people have tried to build the ODBC driver on non-mainstream platforms. -- Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
-
Re: Re: [PATCHES] Fix for ODBC close
Bruce Momjian <pgman@candle.pha.pa.us> — 2001-02-10T11:55:58Z
> Bruce Momjian writes: > > > > 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? > > Theory 1: Many other platforms use the compiler driver ([g]cc) to link > shared libraries. That makes all the right things happen. Most likely > this should happen on a lot more platforms that currently use ld directly. > > Theory 2: Not many people have tried to build the ODBC driver on > non-mainstream platforms. I just tried gcc and got: #$ gcc -shared -soname libpsqlodbc.so.0 -Bsymbolic info.o bind.o columninfo.o connection.o convert.o drvconn.o environ.o execute.o lobj.o misc.o options.o pgtypes.o psqlodbc.o qresult.o results.o socket.o parse.o statement.o gpps.o tuple.o tuplelist.o dlg_specific.o -L/usr/local/lib -L/usr/contrib/lib -lm -o libpsqlodbc.so.0.26 gcc: unrecognized option `-soname' gcc: file path prefix `symbolic' never used -- 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
-
Re: Re: [PATCHES] Fix for ODBC close
Peter Eisentraut <peter_e@gmx.net> — 2001-02-10T12:25:10Z
Bruce Momjian writes: > I just tried gcc and got: > > #$ gcc -shared -soname libpsqlodbc.so.0 -Bsymbolic info.o bind.o > columninfo.o connection.o convert.o drvconn.o environ.o execute.o lobj.o > misc.o options.o pgtypes.o psqlodbc.o qresult.o results.o socket.o > parse.o statement.o gpps.o tuple.o tuplelist.o dlg_specific.o > -L/usr/local/lib -L/usr/contrib/lib -lm -o libpsqlodbc.so.0.26 > gcc: unrecognized option `-soname' > gcc: file path prefix `symbolic' never used Try gcc -shared -Wl,-soname,libpsqlodbc.so.0 -Wl,-Bsymbolic ... -- Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
-
Re: Re: [PATCHES] Fix for ODBC close
Bruce Momjian <pgman@candle.pha.pa.us> — 2001-02-10T15:58:19Z
> Bruce Momjian writes: > > > I just tried gcc and got: > > > > #$ gcc -shared -soname libpsqlodbc.so.0 -Bsymbolic info.o bind.o > > columninfo.o connection.o convert.o drvconn.o environ.o execute.o lobj.o > > misc.o options.o pgtypes.o psqlodbc.o qresult.o results.o socket.o > > parse.o statement.o gpps.o tuple.o tuplelist.o dlg_specific.o > > -L/usr/local/lib -L/usr/contrib/lib -lm -o libpsqlodbc.so.0.26 > > gcc: unrecognized option `-soname' > > gcc: file path prefix `symbolic' never used > > Try gcc -shared -Wl,-soname,libpsqlodbc.so.0 -Wl,-Bsymbolic ... OK, this works: gcc -shared -Wl,-Bsymbolic,-soname,libpsqlodbc.so.0 info.o bind.o columninfo.o connection.o convert.o drvconn.o environ.o execute.o lobj.o misc.o options.o pgtypes.o psqlodbc.o qresult.o results.o socket.o parse.o statement.o gpps.o tuple.o tuplelist.o dlg_specific.o -L/usr/local/lib -L/usr/contrib/lib -lm -lc -o libpsqlodbc.so.0.26 I replaced the 'ld' with 'gcc -Wl', and that prevents the need for the crt1.o. It still requires -lc: ifneq ($(PORTNAME), bsdi) LINK.shared += $(shlib_symbolic) else LINK.shared = gcc -shared -Wl,-Bsymbolic,-soname,$(soname) SHLIB_LINK += -lc endif It seems the -Bsymbolic needs the gcc, while other links are OK with ld. We may find this is true on many platforms. -- 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
-
Re: Re: [PATCHES] Fix for ODBC close
Bruce Momjian <pgman@candle.pha.pa.us> — 2001-02-10T17:01:23Z
> You can't hardcode "gcc" like that. I've committed some fixes that should > work for you. Please try them out. Also try to build libpq++. > > > It seems the -Bsymbolic needs the gcc, while other links are OK with ld. > > We may find this is true on many platforms. > > -Bsymbolic requires all symbols in the library to be resolvable at link > time. If you use 'ld' then you will need to provide all the appropriate > files yourself. The compiler driver normally does that automatically. > Great. I see you modified Makefile.bsdi to properly know it is being used with gcc, and modified Makefile.shlib. Perfect. Should other platforms have this fix too? We didn't need it before -Bsymbolic, but it seems it would be safe to do for FreeBSD and a few others. -- 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
-
Re: Re: [PATCHES] Fix for ODBC close
Peter Eisentraut <peter_e@gmx.net> — 2001-02-10T17:03:34Z
Bruce Momjian writes: > I replaced the 'ld' with 'gcc -Wl', and that prevents the need for the > crt1.o. > > It still requires -lc: > > ifneq ($(PORTNAME), bsdi) > LINK.shared += $(shlib_symbolic) > else > LINK.shared = gcc -shared -Wl,-Bsymbolic,-soname,$(soname) > SHLIB_LINK += -lc > endif You can't hardcode "gcc" like that. I've committed some fixes that should work for you. Please try them out. Also try to build libpq++. > It seems the -Bsymbolic needs the gcc, while other links are OK with ld. > We may find this is true on many platforms. -Bsymbolic requires all symbols in the library to be resolvable at link time. If you use 'ld' then you will need to provide all the appropriate files yourself. The compiler driver normally does that automatically. -- Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
-
Re: Re: [PATCHES] Fix for ODBC close
Bruce Momjian <pgman@candle.pha.pa.us> — 2001-02-10T17:17:13Z
> > -Bsymbolic requires all symbols in the library to be resolvable at link > > time. If you use 'ld' then you will need to provide all the appropriate > > files yourself. The compiler driver normally does that automatically. > > > > Great. I see you modified Makefile.bsdi to properly know it is being > used with gcc, and modified Makefile.shlib. Perfect. > > Should other platforms have this fix too? We didn't need it before > -Bsymbolic, but it seems it would be safe to do for FreeBSD and a few > others. I have applied the following patch for OpenBSD and FreeBSD. They have the same -Bsymbolic handling and same use of LD for linking. I made the duplicate changes Peter made for BSDI. Can anyone commend on the use of 'ld -x' to delete all local symbols? FreeBSD and OpenBSD have it, while BSD/OS does not. I added it to BSDi, and it seems to work fine. Actually, it seems NetBSD already had all these fixes. -- 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
-
Re: Re: [PATCHES] Fix for ODBC close
Peter Eisentraut <peter_e@gmx.net> — 2001-02-10T18:09:23Z
Bruce Momjian writes: > I have applied the following patch for OpenBSD and FreeBSD. They have > the same -Bsymbolic handling and same use of LD for linking. I made the > duplicate changes Peter made for BSDI. Hmm, at least on OpenBSD the recommended way to build shared libraries is using 'ld' directly. But using gcc should work as well. > Can anyone commend on the use of 'ld -x' to delete all local symbols? > FreeBSD and OpenBSD have it, while BSD/OS does not. I added it to BSDi, > and it seems to work fine. I don't think it should be used. > Actually, it seems NetBSD already had all these fixes. On NetBSD, there are about 4 different ways of build shared libraries, depending on version and platform. Nothing I wanna mess with. -- Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
-
Re: [PATCHES] Fix for ODBC close
Nick Gorham <nick@lurcher.org> — 2001-02-10T18:25:27Z
pgman@candle.pha.pa.us wrote: > 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. > > My 'ld' manual says: > > -Bsymbolic > When creating a shared library, bind references to > global symbols to the definition within the shared > library, if any. Normally, it is possible for a > program linked against a shared library to override > the definition within the shared library. This op- > tion is only meaningful on ELF platforms which sup- > port shared libraries. Hmm, removing that may break it when running under a driver manager though... I will check of FreeBSD, it certainly will on Linux ELF. -- Nick Gorham When I die, I want to go like my grandfather did, gently while sleeping, and not like his passangers, screaming in a panic, looking for the inflatable raft. -- Seen on ./
-
Re: Re: [PATCHES] Fix for ODBC close
Bruce Momjian <pgman@candle.pha.pa.us> — 2001-02-10T18:42:31Z
> Bruce Momjian writes: > > > I have applied the following patch for OpenBSD and FreeBSD. They have > > the same -Bsymbolic handling and same use of LD for linking. I made the > > duplicate changes Peter made for BSDI. > > Hmm, at least on OpenBSD the recommended way to build shared libraries is > using 'ld' directly. But using gcc should work as well. > > Can anyone commend on the use of 'ld -x' to delete all local symbols? > > FreeBSD and OpenBSD have it, while BSD/OS does not. I added it to BSDi, > > and it seems to work fine. > > I don't think it should be used. Can someone comment on why people would have added that? > > > Actually, it seems NetBSD already had all these fixes. > > On NetBSD, there are about 4 different ways of build shared libraries, > depending on version and platform. Nothing I wanna mess with. Yes, BSDI has even more, but I think we are now doing the same thing on all the bsd's. Interesting that NetBSD was the only "right" one. -- 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