I am sponsoring the following self-reviewed case for myself.

I belive it qualifies for self review: The changes have limited
scope, are similar to existing features, and preserve backward
compatibility. I will promote it to a fastrack if an objection
is raised.

Release Binding:                        Patch/Micro
-T elfdump option:                      Committed
Behavior of (-I, -N, -T) when used
   without another selection option:    Committed

---------------------------------------------------------------------------

This case extends the command interface to the elfdump utility in
two ways:

        1) Adds the -T option, to allow for the selection of section
           and program headers by type. elfdump already has the -I
           option for selecting by index, and -N for selecting by name.
           -T will be accepted in any context where -I and -N are allowed.
           These three options (-I, -N, and -T) will be collectively
           referred to as the "match options".

        2) In the case where a match option (-I, -N, -T) is used,
           and no other option specifying the information to be
           displayed is provided, elfdump will examine the object
           for matching sections, and will display them.

The combination of these changes is expected to yield the following
benefits:

        - Simplifies elfdump use in the common case where
          the user wants to display a single section.

        - Makes it possible to add support in elfdump for displaying
          new section types without necessarily requiring the addition
          of a new command line option to select it.

        - Completeness / Convenience

I have placed an updated elfdump(1) manpage, documenting these
features, in the case materials directory.


Simplification
--------------

    Consider the common case where the user wishes to display the
contents of the dynamic symbol table without showing any other
symbol tables. Prior to this change, the syntax for that would be:

        % elfdump -s -N .dynsym file

This is redundant. The user is required to specify that
symbol tables are being dumped, something that elfdump
can easily determine given the name. Furthermore, elfdump
has to independently determine this anyway, so no work is saved.
After this change, it suffices to simply say

        % elfdump -N .dynsym file

It should be noted that the '-s' option is still useful in the case
where the user wants to dump all symbol tables. Also, this change
only takes effect in a case that was previously a usage error, so
backward compatibility is preserved.

Slowing Down Command Line Option Growth
---------------------------------------

    Prior to this change, every time we added the ability to display
a new section type, we also added a new command line option for
selecting it. In the early days, this made intuitive sense, and
the option letters were reasonable (-s for symbol tables, etc).
However, as elfdump has grown, we have ended up with a large number
of options, some of which have little or no mnemonic value
(e.g. -y for SHT_SUNW_syminfo). Furthermore, some of these options
are rarely used, and provide little incremental value to elfdump.

The change proposed by this case makes it possible to add support
for new sections without adding an elfdump command line option, while
allowing the user to specify that only those sections should be
displayed. For example, we have an outstanding request to add
dumping of ELF signature sections to elfdump:

        6608612 elfdump should display .SUNW_signature section

We are not planning to add a command line option for this.
Instead, the user will be able to display signature sections
using one of the following:

        % elfdump -N .SUNW_signature file
        % elfdump -T SHT_SUNW_SIGNATURE file

The -T option does case insensitive matching, and allows the omission
of the SHT_ prefix, so the second version might also be written as

        % elfdump -T sunw_signature file


Convenience / Completeness
--------------------------
Given the ability to match by index and by name, the ability
to match by type is an obvious missing feature. These are the
three ways in which sections and program headers are commonly
specified. They are equivalent ways of specifying the same thing,
but one of them will often be notably more convenient for the user
than the others, depending on the particular query being made.

It is usually true that well known section types have "standard"
names. For instance, sections of type SHT_DYNSYM are usually named
".dynsym". However, this name is simply a convention, and not a
formal requirement. The -T option allows the caller to specify the
desired section more precisely.

Beyond that, the ability to match based on type can be useful
in the situation where sections of different type have the same
name. An example of this occurs with our versioning sections.
Solaris ELF objects give both version definition and version
needed sections the same name (.SUNW_version):

        % elfdump -c -N .SUNW_version /bin/elfedit

        Section Header[8]:  sh_name: .SUNW_version
            sh_addr:      0x80532cc       sh_flags:   [ SHF_ALLOC ]
            sh_size:      0x90            sh_type:    [ SHT_SUNW_verneed ]
            sh_offset:    0x32cc          sh_entsize: 0x1 (144 entries)
            sh_link:      7               sh_info:    4
            sh_addralign: 0x4

        Section Header[9]:  sh_name: .SUNW_version
            sh_addr:      0x805335c       sh_flags:   [ SHF_ALLOC ]
            sh_size:      0x1c            sh_type:    [ SHT_SUNW_verdef ]
            sh_offset:    0x335c          sh_entsize: 0x1 (28 entries)
            sh_link:      7               sh_info:    1
            sh_addralign: 0x4

The -T option allows either one of these sections to be matched
unambiguously.




Reply via email to