Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. view content of .obj file generated by MSVC compiler ?
Forum Updated to NodeBB v4.3 + New Features

view content of .obj file generated by MSVC compiler ?

Scheduled Pinned Locked Moved Solved C++ Gurus
19 Posts 5 Posters 7.1k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Kent-DorfmanK Offline
    Kent-DorfmanK Offline
    Kent-Dorfman
    wrote on last edited by
    #10
    NM(1)                                                                                                      GNU Development Tools                                                                                                     NM(1)
    
    NAME
           nm - list symbols from object files
    
    SYNOPSIS
           nm [-A|-o|--print-file-name] [-a|--debug-syms]
              [-B|--format=bsd] [-C|--demangle[=style]]
              [-D|--dynamic] [-fformat|--format=format]
              [-g|--extern-only] [-h|--help]
              [-l|--line-numbers] [--inlines]
              [-n|-v|--numeric-sort]
              [-P|--portability] [-p|--no-sort]
              [-r|--reverse-sort] [-S|--print-size]
              [-s|--print-armap] [-t radix|--radix=radix]
              [-u|--undefined-only] [-V|--version]
              [-X 32_64] [--defined-only] [--no-demangle]
              [--plugin name]
              [--no-recurse-limit|--recurse-limit]]
              [--size-sort] [--special-syms]
              [--synthetic] [--with-symbol-versions] [--target=bfdname]
              [objfile...]
    
    DESCRIPTION
           GNU nm lists the symbols from object files objfile....  If no object files are listed as arguments, nm assumes the file a.out.
    
           For each symbol, nm shows:
    
           ·   The symbol value, in the radix selected by options (see below), or hexadecimal by default.
    
           ·   The symbol type.  At least the following types are used; others are, as well, depending on the object file format.  If lowercase, the symbol is usually local; if uppercase, the symbol is global (external).  There are
               however a few lowercase symbols that are shown for special global symbols ("u", "v" and "w").
    
               "A" The symbol's value is absolute, and will not be changed by further linking.
    
               "B"
               "b" The symbol is in the BSS data section.  This section typically contains zero-initialized or uninitialized data, although the exact behavior is system dependent.
    
               "C" The symbol is common.  Common symbols are uninitialized data.  When linking, multiple common symbols may appear with the same name.  If the symbol is defined anywhere, the common symbols are treated as undefined
                   references.
    
               "D"
               "d" The symbol is in the initialized data section.
    
               "G"
               "g" The symbol is in an initialized data section for small objects.  Some object file formats permit more efficient access to small data objects, such as a global int variable as opposed to a large global array.
    
               "i" For PE format files this indicates that the symbol is in a section specific to the implementation of DLLs.  For ELF format files this indicates that the symbol is an indirect function.  This is a GNU extension to the
                   standard set of ELF symbol types.  It indicates a symbol which if referenced by a relocation does not evaluate to its address, but instead must be invoked at runtime.  The runtime execution will then return the value to
                   be used in the relocation.
    
               "I" The symbol is an indirect reference to another symbol.
    
               "N" The symbol is a debugging symbol.
    
               "p" The symbols is in a stack unwind section.
    
               "R"
               "r" The symbol is in a read only data section.
    
               "S"
               "s" The symbol is in an uninitialized or zero-initialized data section for small objects.
    
    
    
    JonBJ V 2 Replies Last reply
    1
    • Kent-DorfmanK Kent-Dorfman
      NM(1)                                                                                                      GNU Development Tools                                                                                                     NM(1)
      
      NAME
             nm - list symbols from object files
      
      SYNOPSIS
             nm [-A|-o|--print-file-name] [-a|--debug-syms]
                [-B|--format=bsd] [-C|--demangle[=style]]
                [-D|--dynamic] [-fformat|--format=format]
                [-g|--extern-only] [-h|--help]
                [-l|--line-numbers] [--inlines]
                [-n|-v|--numeric-sort]
                [-P|--portability] [-p|--no-sort]
                [-r|--reverse-sort] [-S|--print-size]
                [-s|--print-armap] [-t radix|--radix=radix]
                [-u|--undefined-only] [-V|--version]
                [-X 32_64] [--defined-only] [--no-demangle]
                [--plugin name]
                [--no-recurse-limit|--recurse-limit]]
                [--size-sort] [--special-syms]
                [--synthetic] [--with-symbol-versions] [--target=bfdname]
                [objfile...]
      
      DESCRIPTION
             GNU nm lists the symbols from object files objfile....  If no object files are listed as arguments, nm assumes the file a.out.
      
             For each symbol, nm shows:
      
             ·   The symbol value, in the radix selected by options (see below), or hexadecimal by default.
      
             ·   The symbol type.  At least the following types are used; others are, as well, depending on the object file format.  If lowercase, the symbol is usually local; if uppercase, the symbol is global (external).  There are
                 however a few lowercase symbols that are shown for special global symbols ("u", "v" and "w").
      
                 "A" The symbol's value is absolute, and will not be changed by further linking.
      
                 "B"
                 "b" The symbol is in the BSS data section.  This section typically contains zero-initialized or uninitialized data, although the exact behavior is system dependent.
      
                 "C" The symbol is common.  Common symbols are uninitialized data.  When linking, multiple common symbols may appear with the same name.  If the symbol is defined anywhere, the common symbols are treated as undefined
                     references.
      
                 "D"
                 "d" The symbol is in the initialized data section.
      
                 "G"
                 "g" The symbol is in an initialized data section for small objects.  Some object file formats permit more efficient access to small data objects, such as a global int variable as opposed to a large global array.
      
                 "i" For PE format files this indicates that the symbol is in a section specific to the implementation of DLLs.  For ELF format files this indicates that the symbol is an indirect function.  This is a GNU extension to the
                     standard set of ELF symbol types.  It indicates a symbol which if referenced by a relocation does not evaluate to its address, but instead must be invoked at runtime.  The runtime execution will then return the value to
                     be used in the relocation.
      
                 "I" The symbol is an indirect reference to another symbol.
      
                 "N" The symbol is a debugging symbol.
      
                 "p" The symbols is in a stack unwind section.
      
                 "R"
                 "r" The symbol is in a read only data section.
      
                 "S"
                 "s" The symbol is in an uninitialized or zero-initialized data section for small objects.
      
      
      
      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #11

      @Kent-Dorfman
      The OP asks about .obj files from MSVC. You sure UNIX/GNU nm is available and works on these?

      Kent-DorfmanK 1 Reply Last reply
      0
      • JonBJ JonB

        @Kent-Dorfman
        The OP asks about .obj files from MSVC. You sure UNIX/GNU nm is available and works on these?

        Kent-DorfmanK Offline
        Kent-DorfmanK Offline
        Kent-Dorfman
        wrote on last edited by
        #12

        @JonB if the object formt is COFF then it will work, even if OP has to build the utility themself. online info suggests that .obj format in windows is in fact COFF.

        JonBJ 1 Reply Last reply
        0
        • Kent-DorfmanK Kent-Dorfman

          @JonB if the object formt is COFF then it will work, even if OP has to build the utility themself. online info suggests that .obj format in windows is in fact COFF.

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #13

          @Kent-Dorfman
          I see, if you say so. Still not sure that OP would have a GNU nm utility available. FWIW, What COFF (windows .obj object file) viewers are available? for example states

          I am only aware of 2:

          dumpbin which is included with Visual Studio

          PEView from http://wjradburn.com/software/

          JonBJ 1 Reply Last reply
          0
          • Kent-DorfmanK Offline
            Kent-DorfmanK Offline
            Kent-Dorfman
            wrote on last edited by Kent-Dorfman
            #14

            @JonB said in view content of .obj file generated by MSVC compiler ?:

            Still not sure that OP would have a GNU nm utility available.

            mingw provides the whole slew of gnu utilities as windows native executables. nm should be available, at which point the mingw exe can be used to process the windows native object file.

            With a caveat that most folks would probably overlook: OP wants to process C++ object files, in which case the symbol names will probably be name-mangled, unless they were declared as extern "C" {}

            JonBJ 1 Reply Last reply
            1
            • Kent-DorfmanK Kent-Dorfman

              @JonB said in view content of .obj file generated by MSVC compiler ?:

              Still not sure that OP would have a GNU nm utility available.

              mingw provides the whole slew of gnu utilities as windows native executables. nm should be available, at which point the mingw exe can be used to process the windows native object file.

              With a caveat that most folks would probably overlook: OP wants to process C++ object files, in which case the symbol names will probably be name-mangled, unless they were declared as extern "C" {}

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by JonB
              #15

              @Kent-Dorfman said in view content of .obj file generated by MSVC compiler ?:

              mingw provides the whole slew of gnu utilities as windows native executables. nm should be available,

              Ooohhh, sorry, right, that makes sense!

              Though I thought MinGW did .o not .obj files, I thought that meant MSVC. But what do I know?! :)

              1 Reply Last reply
              0
              • Chris KawaC Offline
                Chris KawaC Offline
                Chris Kawa
                Lifetime Qt Champion
                wrote on last edited by
                #16

                You don't need any unix or otherwise external tools. MSVC installation already comes with the dumpbin utility that lets you see various information about the structure and contents of COFF files. It also undecorates C++ function names, so no problem there either.

                V 1 Reply Last reply
                3
                • Chris KawaC Chris Kawa

                  You don't need any unix or otherwise external tools. MSVC installation already comes with the dumpbin utility that lets you see various information about the structure and contents of COFF files. It also undecorates C++ function names, so no problem there either.

                  V Offline
                  V Offline
                  Vinoth Rajendran4
                  wrote on last edited by
                  #17

                  @Chris-Kawa : Thanks for the utility tool suggestion.

                  1 Reply Last reply
                  0
                  • Kent-DorfmanK Kent-Dorfman
                    NM(1)                                                                                                      GNU Development Tools                                                                                                     NM(1)
                    
                    NAME
                           nm - list symbols from object files
                    
                    SYNOPSIS
                           nm [-A|-o|--print-file-name] [-a|--debug-syms]
                              [-B|--format=bsd] [-C|--demangle[=style]]
                              [-D|--dynamic] [-fformat|--format=format]
                              [-g|--extern-only] [-h|--help]
                              [-l|--line-numbers] [--inlines]
                              [-n|-v|--numeric-sort]
                              [-P|--portability] [-p|--no-sort]
                              [-r|--reverse-sort] [-S|--print-size]
                              [-s|--print-armap] [-t radix|--radix=radix]
                              [-u|--undefined-only] [-V|--version]
                              [-X 32_64] [--defined-only] [--no-demangle]
                              [--plugin name]
                              [--no-recurse-limit|--recurse-limit]]
                              [--size-sort] [--special-syms]
                              [--synthetic] [--with-symbol-versions] [--target=bfdname]
                              [objfile...]
                    
                    DESCRIPTION
                           GNU nm lists the symbols from object files objfile....  If no object files are listed as arguments, nm assumes the file a.out.
                    
                           For each symbol, nm shows:
                    
                           ·   The symbol value, in the radix selected by options (see below), or hexadecimal by default.
                    
                           ·   The symbol type.  At least the following types are used; others are, as well, depending on the object file format.  If lowercase, the symbol is usually local; if uppercase, the symbol is global (external).  There are
                               however a few lowercase symbols that are shown for special global symbols ("u", "v" and "w").
                    
                               "A" The symbol's value is absolute, and will not be changed by further linking.
                    
                               "B"
                               "b" The symbol is in the BSS data section.  This section typically contains zero-initialized or uninitialized data, although the exact behavior is system dependent.
                    
                               "C" The symbol is common.  Common symbols are uninitialized data.  When linking, multiple common symbols may appear with the same name.  If the symbol is defined anywhere, the common symbols are treated as undefined
                                   references.
                    
                               "D"
                               "d" The symbol is in the initialized data section.
                    
                               "G"
                               "g" The symbol is in an initialized data section for small objects.  Some object file formats permit more efficient access to small data objects, such as a global int variable as opposed to a large global array.
                    
                               "i" For PE format files this indicates that the symbol is in a section specific to the implementation of DLLs.  For ELF format files this indicates that the symbol is an indirect function.  This is a GNU extension to the
                                   standard set of ELF symbol types.  It indicates a symbol which if referenced by a relocation does not evaluate to its address, but instead must be invoked at runtime.  The runtime execution will then return the value to
                                   be used in the relocation.
                    
                               "I" The symbol is an indirect reference to another symbol.
                    
                               "N" The symbol is a debugging symbol.
                    
                               "p" The symbols is in a stack unwind section.
                    
                               "R"
                               "r" The symbol is in a read only data section.
                    
                               "S"
                               "s" The symbol is in an uninitialized or zero-initialized data section for small objects.
                    
                    
                    
                    V Offline
                    V Offline
                    Vinoth Rajendran4
                    wrote on last edited by
                    #18

                    @Kent-Dorfman : Thanks for suggesting nm utility.

                    1 Reply Last reply
                    0
                    • JonBJ JonB

                      @Kent-Dorfman
                      I see, if you say so. Still not sure that OP would have a GNU nm utility available. FWIW, What COFF (windows .obj object file) viewers are available? for example states

                      I am only aware of 2:

                      dumpbin which is included with Visual Studio

                      PEView from http://wjradburn.com/software/

                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote on last edited by JonB
                      #19

                      @JonB said in view content of .obj file generated by MSVC compiler ?:

                      (https://stackoverflow.com/questions/2262959/what-coff-windows-obj-object-file-viewers-are-available) for example states
                      I am only aware of 2:

                      dumpbin which is included with Visual Studio

                      PEView from http://wjradburn.com/software/

                      1 Reply Last reply
                      1

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved