Help on -nodefaultlibs

Geoff Keating geoffk@geoffk.org
Mon Aug 26 21:27:00 GMT 2002


Yong Jiang <yjiang@cisco.com> writes:

> Hi,
> 
> We are planning to write some drivers that are independent from both OS and
> hardware platforms, since these drivers will be written by many people and will
> be shared by multiple platforms in source level, it is good that if some kind
> of 'generic' code checking can be done at the time these drivers are put in
> place. Specificly, one of the things i would like to check is that these
> drivers can only use data types and functions that are defined in the driver
> code, no OS or platform specific data or functions can be used. I would like to
> run the gcc in SunUnix environment in a way that no library is provided and
> it will complain if not every function is fully defined in the source. So it
> looks like the -nodefaultlibs link option serves what I need, but it gave me
> lots of errors when I tried it. Can any one give me a help on this? Thanks.

You can't have programs on most Unix-like systems without providing the functions in the C library.

What I'd suggest is that instead of doing this, you use nm or objdump
to see what symbols are undefined in the driver, and match those
against the list of 'allowed' symbols.

-- 
- Geoffrey Keating <geoffk@geoffk.org> <geoffk@redhat.com>



More information about the Gcc-bugs mailing list