On Thu, Nov 15, 2007 at 09:07:15AM -0800, Garrett D'Amore wrote:
> I am thinking about using a mapfile to hide some symbols that would 
> otherwise be global in my kernel module.  (This is because I want to use 
> more than a single .c file in my module, so I need some global symbols 
> at compile time, but I don't want to expose them outside of my module.)
> 
> I notice that SPARC krtld does the same thing.  But I see a note there 
> about a gotcha relating to ctfmerge.  I'm hoping someone on this list 
> can help me here.  What exactly are the gotchas with this approach?  Am 
> I better off not using it, and either keeping all my implementation to a 
> single .c, or just hoping that my global names are sufficiently 
> qualified to avoid namespace pollution?  (And yes, I do expect other 
> modules to link against this one with -N.  Which is part of my reason 
> for wanting to suppress the visibility of certain symbols.)
> 
> Thanks in advance!
> 
>     -- Garrett

You need to enable fuzzy-matching for ctfmerge so that it matches
symbols regardless of a change in scope.  Basically in each of your
usr/src/uts/<arch>/Makefile you would have this:

LDFLAGS         += -B reduce -M $(UTSBASE)/common/my-module-name/mapfile
CTFMRGFLAGS     += -f

and then stick mapfile in usr/src/uts/common/my-module-name/mapfile

-Mike

-- 
Mike Shapiro, Solaris Kernel Development. blogs.sun.com/mws/
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to