Project

General

Profile

Actions

Feature #1073

closed

migrate kernel modules from ancient _depends_on to true ELF dependencies

Added by Rich Lowe almost 12 years ago. Updated over 11 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
kernel
Start date:
2011-05-28
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:
External Bug:

Description

We still have quite a few modules that still use the old _depends_on module dependency mechanism, rather than true ELF NEEDED entries. This confuses our tools (pkgdepend, at least), and makes it harder to inspect these dependencies.

Modules should be migrated.

An easy way to do this would be to search the source tree for '\<_depends_on\>', and for each occurance remove it from the module source and add the matching -dy -N <foo> enteries to LDFLAGS in the module Makefile for each platform.
(see intel/bge/Makefile for an example of using -N in LDFLAGS.)

Actions #1

Updated by Rich Lowe almost 12 years ago

  • Category set to kernel
  • Difficulty changed from Medium to Bite-size
  • Tags deleted (needs-triage)
Actions #2

Updated by Bayard Bell almost 12 years ago

  • % Done changed from 0 to 10

Output of 'find . -type f -name '*.c' -a ! -name kobj.c | xargs grep "\<_depends_on"' against usr/src/utc.

Actions #3

Updated by Bayard Bell almost 12 years ago

usr/src/uts/common/io/scsi/targets/sd.c has the following gem:

/*
  • Loadable module info.
    /
    #if (defined(_fibre))
    define SD_MODULE_NAME "SCSI SSA/FCAL Disk Driver"
    char _depends_on[] = "misc/scsi misc/cmlb drv/fcp";
    #else /
    !_fibre /
    #define SD_MODULE_NAME "SCSI Disk Driver"
    char depends_on[] = "misc/scsi misc/cmlb";
    #endif /
    !_fibre */

This maps back to usr/src/uts/sparc/ssd/Makefile setting -D__fibre via CFLAGS. The sd drivers on both SPARC and intel do not require this, therefore FCP had been defined as a dependency for ssd, while plain sd uses the shorter list.

Actions #4

Updated by Bayard Bell almost 12 years ago

usr/src/uts/common/io/scsi/targets/sd.c has the following gem:

/*
* Loadable module info.                                                                                                                                       
*/                                                                                                                                                            
#if (defined(__fibre))                                                                                                                                         
define SD_MODULE_NAME  "SCSI SSA/FCAL Disk Driver"                                                                                                            
char _depends_on[]      = "misc/scsi misc/cmlb drv/fcp";                                                                                                       
#else /* !__fibre */                                                                                                                                           
#define SD_MODULE_NAME  "SCSI Disk Driver"                                                                                                                     
char _depends_on[]      = "misc/scsi misc/cmlb";                                                                                                               
#endif /* !__fibre */   

This maps back to usr/src/uts/sparc/ssd/Makefile setting -D__fibre via CFLAGS. The sd drivers on both SPARC and intel do not require this, therefore FCP had been defined as a dependency for ssd, while plain sd uses the shorter list.

Actions #5

Updated by Bayard Bell almost 12 years ago

One other oddity is the following block in usr/src/uts/common/io/fibre_channel/fca/emlx/emlx_solaris.c:

/*                                                                                                                                                             
* This is needed when the module gets loaded by the kernel                                                                                                    
* so ddi library calls get resolved.                                                                                                                          
*/
#ifndef MODSYM_SUPPORT                                                                                                                                         
char   _depends_on[] = "misc/fctl";                                                                                                                            
#endif /* MODSYM_SUPPORT */

The dependencies for emlxs appear to have expressed already in emlxs/Makefile and emlxs_fw/Makefile, making this completely redundant.

Also: please do not infer anything about the quality of my code from my inability thus far to negotiate the bug-tracking system.

Actions #6

Updated by Bayard Bell almost 12 years ago

usr/src/uts/common/cpr/cpr_mod.c express a dependency on bootdev, with a comment that references i_devname_to_promname(), a function that is only used in SPARC-specific (

#if defined(__sparc)
) code in cpr_misc.c. The cpr code is slightly different than anything else encountered thus far, in that it is platform- rather than architecture-specific (cpr/Makefile exists in sun4u and i86pc rather than intel and sparc). Given that the code that pulls in bootdev only references one SPARC-specific function, it may be appropriate to reference bootdev only in sun4u/cpr/Makefile, even though bootdev module exists on both architectures. Will seek feedback on this point.

Actions #7

Updated by Bayard Bell almost 12 years ago

Trying to weed out references to _depends_on in comments while I'm at it, I've found a few bits of odd business in various bits of code under usr/src/uts/common/pcmcia. In particular, I see this in cis.c:

void
cisp_init()
{
#ifdef  XXX
        csregister_t csr;

        /*
         * Fill out the function for CISSetAddress
         */
        csr.cs_magic = PCCS_MAGIC;
        csr.cs_version = PCCS_VERSION;
        csr.cs_event = (f_t *)CISParser;

        /*
         * We have to call SS instead of CS to register because we
         *      can't do a _depends_on for CS
         */
        SocketServices(CISSetAddress, &csr);
#endif  /* XXX */
}

Best to ignore, or?

Actions #8

Updated by Bayard Bell almost 12 years ago

Further note: remove _depends_on from LGREP.2 in Makefile.uts once other changes are done.

Actions #9

Updated by Rich Lowe over 11 years ago

  • Status changed from New to Resolved
  • % Done changed from 10 to 100

Resolved in r13452 commit:6bec9720e054

Actions

Also available in: Atom PDF