⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reloc.5

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 5
字号:
.TH reloc 5 RISC.SH Namereloc \- relocation information for a MIPS object file.SH Syntax.B #include  <reloc.h>.SH DescriptionObject files have one relocation entry for each relocatablereference in the text or data.  If relocation information ispresent, it will be in the following format:.PP.EXstruct   reloc{   long      r_vaddr ;          /* (virtual) address of reference */   long      r_symndx ;         /* index into symbol table */   ushort    r_type ;           /* relocation type */   unsigned  r_symndx:24,       /* index into symbol table */             r_reserved:3,             r_type:4,          /* relocation type */             r_extern:1;        /* if 1 symndx is an index into the                                    external symbol table, else symndx                                    is a section # */} ;.EE.PP.EX/* Relocation types */#define  R_ABS       0#define  R_REFHALF   1#define  R_REFWORD   2#define  R_JMPADDR   3#define  R_REFHI     4#define  R_REFLO     5#define  R_GPREL     6#define  R_LITERAL   7.EE.PP.EX/* Section numbers */#define  R_SN_NULL   0#define  R_SN_TEXT   1#define  R_SN_RDATA  2#define  R_SN_DATA   3#define  R_SN_SDATA  4#define  R_SN_SBSS   5#define  R_SN_BSS    6#define  R_SN_INIT   7#define  R_SN_LIT8   8#define  R_SN_LIT4   9.EE.PPThe link editor reads each input section and performsrelocation.  The relocation entries direct how referencesfound within the input section are treated..PPIf .PN r_extern is zero, it is a local relocation entry andthen .PN r_symndex is a section number (R_SN_*).  For theseentries, the starting address for the section referenced bythe section number is used in place of an external symboltable entry's value.  The assembler and loader always uselocal relocation entries if the item to be relocated isdefined in the object file..PPFor every external relocation (except R_ABS) a signedconstant is added to the symbol's virtual address that therelocation entry refers to.  This constant is assembled atthe address being relocated..TP 15R_ABSThe reference is absolute and norelocation is necessary.  The entry willbe ignored..TP 15R_REFHALFA 16-bit reference to the symbol's virtualaddress..TP 15R_REFWORDA 32-bit reference to the symbol's virtualaddress..TP 15R_JMPADDRA 26-bit jump instruction reference to thesymbol's virtual address..TP 15R_REFHIA reference to the high 16 bits of thesymbol's virtual address.  The nextrelocation entry must be the correspondingR_REFLO entry, so the proper value of theconstant to be added to the symbol'svirtual address can be reconstructed..TP 15R_REFLOA reference to low 16 bits to the symbol'svirtual address..TP 15R_GPRELA 16-bit offset to the symbol's virtualaddress from the global pointer register..TP 15R_LITERALA 16-bit offset to the literal's virtualaddress from the global pointer register..PPRelocation entries are generated automatically by theassembler and automatically used by the link editor.  Linkeditor options exist for both preserving and removing therelocation entries from object files..PPThe number of relocation entries for a section is found inthe .PN s_nreloc field of the section header.  This field is aC language short and can overflow with large objects.  Ifthis field overflows, the section header .PN s_flags field hasthe S_NRELOC_OVFL bit set.  In this case, the true number ofrelocation entries is found in the .PN r_vaddr field of thefirst relocation entry for that section.  That relocationentry has a type of R_ABS, so it is ignored when therelocation takes place. .SH See Alsoas(1), ld(1), a.out(5), syms(5), scnhdr(5)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -