On Tue, Dec 28, 2010 at 05:37:44PM -0600, Andrew Hastings wrote:
> libhugetlbfs redefines shmget() so that it can transparently optionally
> add the hugepage flag.  Unfortunately, it uses dlsym() to to find the
> next shmget() to call in the dynamic library call chain.  This does not
> work on statically-linked executables.
> 
> Work around this by making all references to libdl weak, and testing
> for its presence.  If libdl symbols are not not present, directly
> make the shmget syscall.
> 
> Making the dl* symbols weak does not affect dynamic executables as
> libdl.so is:
> * Automatically added to the library dependency list when liked with
>   -lhugetlbfs
> * Mapped into the programs address space when used with LD_PRELOAD.
> 
> Based on a patch originally authored by Dean Luick <lu...@cray.com>.
> 
> Signed-off-by: Andrew Hastings <a...@cray.com> on behalf of Cray Inc.

I'm mildly surprised there isn't rather more to fix to get
libhugetlbfs to work with static executables.  A dynamic executable
was pretty firmly assumed when it was created.

What components of the libary have you tested with a static executable
and this patch?

-- 
David Gibson                    | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
                                | _way_ _around_!
http://www.ozlabs.org/~dgibson

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to