| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> | 
|---|---|
| To: | pgsql-hackers(at)postgresql(dot)org | 
| Subject: | Re: RTLD_LAZY considered harmful (Re: pltlc and pltlcu | 
| Date: | 2002-02-12 00:49:57 | 
| Message-ID: | 18523.1013474997@sss.pgh.pa.us | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers pgsql-sql | 
I wrote:
> I hate to sound like a broken record, but I want to re-open that
> discussion about RTLD_LAZY binding that trailed off a week or two
> ago.
> ... I therefore assert that the current coding is effectively untested
> on Linux, which is probably our most popular platform, and therefore
> it should *NOT* be accorded the respect normally due to the status
> quo.  Arguably, 7.2 has introduced breakage here.
After some further digging around on the net, I believe that coding in
the following style is safe and will work on all systems supporting
dlopen():
/*
 * In older systems, like SunOS 4.1.3, the RTLD_NOW flag isn't defined
 * and the mode argument to dlopen must always be 1.  The RTLD_GLOBAL
 * flag is wanted if available, but it doesn't exist everywhere.
 * If it doesn't exist, set it to 0 so it has no effect.
 */
#ifndef RTLD_NOW
#   define RTLD_NOW 1
#endif
#ifndef RTLD_GLOBAL
#   define RTLD_GLOBAL 0
#endif
#define pg_dlopen(f) dlopen((f), RTLD_NOW | RTLD_GLOBAL)
I also believe that this will produce more consistent cross-platform
behavior: so far as I could learn from googling, systems that do not
define RTLD_NOW/RTLD_LAZY all act as though the mode were RTLD_NOW,
ie, immediate binding.
Any objections to modifying all the port/dynloader files this way?
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | pgsql-bugs | 2002-02-12 01:26:37 | Bug #581: Sequence cannot be deleted | 
| Previous Message | Philip Warner | 2002-02-12 00:15:24 | Re: Idea for making COPY data Microsoft-proof | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2002-02-12 01:18:22 | Re: UNION and rows improperly unified: query optimization question | 
| Previous Message | David Stanaway | 2002-02-11 22:58:12 | Re: Support for bulk reads/writes ? |