objdump 中可能的 scl 值是多少?

objdump 中可能的 scl 值是多少?

objdump 手册页给出以下示例输出objdump -t

输出的格式取决于转储文件的格式,但有两种主要类型。一个看起来像这样:

[  4](sec  3)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000000 .bss
[  6](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000 fred

其中方括号内的数字是符号表中的条目号,sec 号是节号,fl 值是符号的标志位,ty 号是符号的类型,scl 号是符号的存储空间class 和 nx 值是与符号关联的辅助条目的数量。最后两个字段是符号的值及其名称。

所以scl意味着storage class,但它从未解释什么scl 3scl 2实际意味着什么。

在哪里可以找到这些信息?

答案1

这些scl值定义在binutils-gdb/include/coff/internal.h:

/********************** STORAGE CLASSES **********************/

/* This used to be defined as -1, but now n_sclass is unsigned.  */
#define C_EFCN      0xff    /* physical end of function */
#define C_NULL      0
#define C_AUTO      1   /* automatic variable       */
#define C_EXT       2   /* external symbol      */
#define C_STAT      3   /* static           */
#define C_REG       4   /* register variable        */
#define C_EXTDEF    5   /* external definition      */
#define C_LABEL     6   /* label            */
#define C_ULABEL    7   /* undefined label      */
#define C_MOS       8   /* member of structure      */
#define C_ARG       9   /* function argument        */
#define C_STRTAG    10  /* structure tag        */
#define C_MOU       11  /* member of union      */
#define C_UNTAG     12  /* union tag            */
#define C_TPDEF     13  /* type definition      */
#define C_USTATIC   14  /* undefined static     */
#define C_ENTAG     15  /* enumeration tag      */
#define C_MOE       16  /* member of enumeration    */
#define C_REGPARM   17  /* register parameter       */
#define C_FIELD     18  /* bit field            */
#define C_AUTOARG   19  /* auto argument        */
#define C_LASTENT   20  /* dummy entry (end of block)   */
#define C_BLOCK     100 /* ".bb" or ".eb"       */
#define C_FCN       101 /* ".bf" or ".ef"       */
#define C_EOS       102 /* end of structure     */
#define C_FILE      103 /* file name            */
#define C_LINE      104 /* line # reformatted as symbol table entry */
#define C_ALIAS     105 /* duplicate tag        */
#define C_HIDDEN    106 /* ext symbol in dmert public lib */
#define C_WEAKEXT   127 /* weak symbol -- GNU extension.  */

/* New storage classes for TI COFF */
#define C_UEXT      19  /* Tentative external definition */
#define C_STATLAB   20  /* Static load time label */
#define C_EXTLAB    21  /* External load time label */
#define C_SYSTEM    23  /* System Wide variable */

/* New storage classes for WINDOWS_NT   */
#define C_SECTION       104     /* section name */
#define C_NT_WEAK   105 /* weak external */

 /* New storage classes for 80960 */

/* C_LEAFPROC is obsolete.  Use C_LEAFEXT or C_LEAFSTAT */
#define C_LEAFPROC  108 /* Leaf procedure, "call" via BAL */

#define C_SCALL     107 /* Procedure reachable via system call */
#define C_LEAFEXT       108 /* External leaf */
#define C_LEAFSTAT      113 /* Static leaf */
#define C_OPTVAR    109 /* Optimized variable       */
#define C_DEFINE    110 /* Preprocessor #define     */
#define C_PRAGMA    111 /* Advice to compiler or linker */
#define C_SEGMENT   112 /* 80960 segment name       */

 /* New storage classes for RS/6000 */
#define C_HIDEXT        107 /* Un-named external symbol */
#define C_BINCL         108 /* Marks beginning of include file */
#define C_EINCL         109 /* Marks ending of include file */
#define C_AIX_WEAKEXT   111 /* AIX definition of C_WEAKEXT.  */
#define C_DWARF         112 /* DWARF symbol  */

所以scl 3意味着该变量是静态的,并且scl 2意味着它是外部的。

相关内容