[Home]

Summary:ASTERISK-19441: menuselect makes <use> tags shown and executes as "Depends on:"
Reporter:Kevin Scott Adams (nivek)Labels:
Date Opened:2012-02-28 11:13:47.000-0600Date Closed:2012-03-05 14:54:33.000-0600
Priority:MajorRegression?
Status:Closed/CompleteComponents:Applications/app_voicemail
Versions:1.8.9.2 Frequency of
Occurrence
Constant
Related
Issues:
Environment:CentOS 5.7Attachments:
Description:In app_voicemail the res_adsi and res_smdi are both marked as <use>.  When viewing in menuselect both are shown as "Depends on:".  I also looked at app_queue which has res_monitor marked as <use> but it is shown as "Depends on:".  This behavior does not exist in 1.8.5.
Comments:By: Kevin Scott Adams (nivek) 2012-02-28 13:55:30.504-0600

This piece of code is the ticket to it behaving differently between 1.8.5 and 1.8.9.2.  Now to figure out what the 'weak' thingy is.

       /* If weak linking is not supported, move module uses which are other modules to the dependency list */
#if !defined(HAVE_ATTRIBUTE_weak_import) && !defined(HAVE_ATTRIBUTE_weakref) && !defined(HAVE_ATTRIBUTE_weak)
       AST_LIST_TRAVERSE(&categories, cat, list) {
               AST_LIST_TRAVERSE(&cat->members, mem, list) {
                       if (mem->is_separator) {
                               continue;
                       }

                       AST_LIST_TRAVERSE_SAFE_BEGIN(&mem->uses, use, list) {
                               if (use->member) {
                                       AST_LIST_REMOVE_CURRENT(&mem->uses, list);
                                       AST_LIST_INSERT_TAIL(&mem->deps, use, list);
                               }
                       }
                       AST_LIST_TRAVERSE_SAFE_END;
               }
       }
#endif


By: Matt Jordan (mjordan) 2012-03-05 14:54:26.144-0600

The HAVE_ATTRIBUTE_weak refers to weak function attributes.  The weak attribute causes the symbol resulting from the function declaration to appear in the object file as a weak symbol, rather than a global one.  Normally, the linker disallows multiple definitions of global symbols with the same name; however, when one of those is marked as weak, the weak definition is ignored and the global symbol is used.

In the context of Asterisk's app_voicemail, this allows it to have weak symbols for the global symbols of res_adsi and and res_smdi.  If weak symbols are supported, then res_adsi and res_smdi do not actually have to be loaded into memory in order for app_voicemail to function; the weak symbol to the global symbols normally defined by those modules is essentially a NoOp.  However, if weak symbols is not supported, then the linker had to link directly to the global symbols defined by those module's object files and the modules must be loaded.

Hence why, if weak symbols are not supported by your compiler, it moves it from "Use" to "Depends on".

As such, this is not a bug.