Print this page
4519 ABI checking needs to adapt to modern times, run by default
Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Jens Elkner <jel+illumos@cs.uni-magdeburg.de>


  26 #
  27 
  28 #
  29 # This perl module implements the rules used to categorize ELF versions
  30 # for the core Solaris OS and related code repositories. Although this
  31 # code fits logically into the onbld_elfmod module, it is maintained as
  32 # a separate module in order to allow maintainers of other code to provide
  33 # an implementation appropriate to their local conventions.
  34 #
  35 # By isolating the codebase specific details of ELF version names in this
  36 # module and reporting the results via a fixed interface, we allow
  37 # interface_check and interface_cmp to be written in a way that isolates
  38 # them from the specific names that apply to a given body of code.
  39 # Those tools allow you to substitute your own module in place of this one
  40 # to customize their behavior.
  41 #
  42 # The types of versions understood by interface_check and interface_cmp
  43 # fall into the following categories:
  44 #
  45 #       NUMBERED:       A public version that follows the standard numbering
  46 #                       convention of a known prefix (e.g. SUNW_), followed
  47 #                       by 2 or 3 dot separated numeric values:
  48 #
  49 #                               <PREFIX>major.minor[.micro]
  50 #
  51 #       PLAIN:          A public version that may or may not contain
  52 #                       numeric characters, but for which numeric characters
  53 #                       are not treated as such.
  54 #
  55 #       SONAME:         Base version with the same name as the object SONAME
  56 #
  57 #       PRIVATE:        A private version that follows the same rules as PLAIN.
  58 #
  59 #       UNKNOWN:        A version string that does not fit any of the
  60 #                       above categories
  61 #
  62 # The above categories are generic, in the sense that they apply to any
  63 # code base. However, each code base will have different well known prefix
  64 # and name strings that map to these categories. The purpose of this module
  65 # is to map these special well known strings to the category they represent
  66 # for the code base in question.
  67 #


  84 #
  85 # exit:
  86 #       This routine returns an array to describe the type of version
  87 #       encountered. Element [0] is always a string token that gives one
  88 #       of the version categories described in the module header comment.
  89 #       For types other than NUMBERED, this is the only element in the
  90 #       return array.
  91 #
  92 #       NUMBERED versions receive a return array with additional values
  93 #       describing the version:
  94 #
  95 #               ( 'NUMBERED', cnt, prefix, major, minor[, micro])
  96 #
  97 #       If the version has 3 numberic values, cnt is 3, and micro
  98 #       is present. If there are 2 numeric values, cnt is 2, and micro
  99 #       is omitted.
 100 #
 101 sub Category {
 102         my ($Ver, $Soname) = @_;
 103 
 104         # For Solaris and related products, the SUNW_ prefix is
 105         # used for numbered public versions.
 106         if ($Ver =~ /^(SUNW_)(\d+)\.(\d+)(\.(\d+))?/) {
 107                 return ('NUMBERED', 3, $1, $2, $3, $5) if defined($5);
 108                 return ('NUMBERED', 2, $1, $2, $3);
 109         }
 110 
 111         # Well known plain versions. In Solaris, these names were used
 112         # to tag symbols that come from the SVR4 underpinnings to Solaris.
 113         # Later Sun-specific additions are all tagged SUNW_xxx.
 114         return ('PLAIN')
 115             if (($Ver =~ /^SYSVABI_1.[23]$/) || ($Ver =~ /^SISCD_2.3[ab]*$/));
 116 
 117         # The link-editor creates "base" versions using the SONAME of the
 118         # object to contain  linker generated symbols (_etext, _edata, etc.).
 119         return ('SONAME')
 120             if ($Ver eq $Soname) && ($Soname ne '');
 121 
 122         # The Solaris convention is to use SUNWprivate to indicate
 123         # private versions. SUNWprivate can have a numeric suffix, but
 124         # the number is not significant for ELF versioning other than
 125         # being part of a unique name.
 126         return ('PRIVATE')
 127             if ($Ver =~ /^SUNWprivate(_[0-9.]+)?$/);
 128 
 129         # Anything else is a version we don't recognize.
 130         return ('UNKNOWN');
 131 }
 132 
 133 
 134 # Perl modules pulled in via 'require' must return an exit status.
 135 1;


  26 #
  27 
  28 #
  29 # This perl module implements the rules used to categorize ELF versions
  30 # for the core Solaris OS and related code repositories. Although this
  31 # code fits logically into the onbld_elfmod module, it is maintained as
  32 # a separate module in order to allow maintainers of other code to provide
  33 # an implementation appropriate to their local conventions.
  34 #
  35 # By isolating the codebase specific details of ELF version names in this
  36 # module and reporting the results via a fixed interface, we allow
  37 # interface_check and interface_cmp to be written in a way that isolates
  38 # them from the specific names that apply to a given body of code.
  39 # Those tools allow you to substitute your own module in place of this one
  40 # to customize their behavior.
  41 #
  42 # The types of versions understood by interface_check and interface_cmp
  43 # fall into the following categories:
  44 #
  45 #       NUMBERED:       A public version that follows the standard numbering
  46 #                       convention of a known prefix (e.g. ILLUMOS_), 
  47 #                       followed by 2 or 3 dot separated numeric values:
  48 #
  49 #                               <PREFIX>major.minor[.micro]
  50 #
  51 #       PLAIN:          A public version that may or may not contain
  52 #                       numeric characters, but for which numeric characters
  53 #                       are not treated as such.
  54 #
  55 #       SONAME:         Base version with the same name as the object SONAME
  56 #
  57 #       PRIVATE:        A private version that follows the same rules as PLAIN.
  58 #
  59 #       UNKNOWN:        A version string that does not fit any of the
  60 #                       above categories
  61 #
  62 # The above categories are generic, in the sense that they apply to any
  63 # code base. However, each code base will have different well known prefix
  64 # and name strings that map to these categories. The purpose of this module
  65 # is to map these special well known strings to the category they represent
  66 # for the code base in question.
  67 #


  84 #
  85 # exit:
  86 #       This routine returns an array to describe the type of version
  87 #       encountered. Element [0] is always a string token that gives one
  88 #       of the version categories described in the module header comment.
  89 #       For types other than NUMBERED, this is the only element in the
  90 #       return array.
  91 #
  92 #       NUMBERED versions receive a return array with additional values
  93 #       describing the version:
  94 #
  95 #               ( 'NUMBERED', cnt, prefix, major, minor[, micro])
  96 #
  97 #       If the version has 3 numberic values, cnt is 3, and micro
  98 #       is present. If there are 2 numeric values, cnt is 2, and micro
  99 #       is omitted.
 100 #
 101 sub Category {
 102         my ($Ver, $Soname) = @_;
 103 
 104         # For illumos, the SUNW_ or ILLUMOS_ prefix is used for numbered
 105         # public versions.
 106         if ($Ver =~ /^((?:SUNW|ILLUMOS)_)(\d+)\.(\d+)(\.(\d+))?/) {
 107                 return ('NUMBERED', 3, $1, $2, $3, $5) if defined($5);
 108                 return ('NUMBERED', 2, $1, $2, $3);
 109         }
 110 
 111         # Well known plain versions. In Solaris, these names were used
 112         # to tag symbols that come from the SVR4 underpinnings to Solaris.
 113         # Later additions are all in the NUMBERED form.
 114         return ('PLAIN')
 115             if (($Ver =~ /^SYSVABI_1.[23]$/) || ($Ver =~ /^SISCD_2.3[ab]*$/));
 116 
 117         # The link-editor creates "base" versions using the SONAME of the
 118         # object to contain  linker generated symbols (_etext, _edata, etc.).
 119         return ('SONAME')
 120             if ($Ver eq $Soname) && ($Soname ne '');
 121 
 122         # The convention is to use SUNWprivate and ILLUMOSprivate to indicate
 123         # private versions. They may have a numeric suffix, but the
 124         # number is not significant for ELF versioning other than being part
 125         # of a unique name.
 126         return ('PRIVATE')
 127             if ($Ver =~ /^(SUNW|ILLUMOS)private(_[0-9.]+)?$/);
 128 
 129         # Anything else is a version we don't recognize.
 130         return ('UNKNOWN');
 131 }
 132 
 133 
 134 # Perl modules pulled in via 'require' must return an exit status.
 135 1;