From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@postgresql.org
Subject: Re: RTLD_LAZY considered harmful (Re: pltlc and pltlcu
Date: Mon, 11 Feb 2002 19:49:57 -0500
Message-ID: <18523.1013474997@sss.pgh.pa.us> (raw)
In-Reply-To: <25459.1013389242@sss.pgh.pa.us>
References: <Pine.LNX.4.30.0201211148030.687-100000@peter.localdomain>
<25459.1013389242@sss.pgh.pa.us>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, pgsql-hackers@postgresql.org
Subject: Re: RTLD_LAZY considered harmful (Re: pltlc and pltlcu
In-Reply-To: <18523.1013474997@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox