home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Compilers / digital marsC compier / dm / include / Scnhdr.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-03-16  |  2.6 KB  |  80 lines

  1. /* Copyright (C) 1986-2001 by Digital Mars. $Revision: 1.1.1.1 $ */
  2. #if __SC__ || __RCC__
  3. #pragma once
  4. #endif
  5.  
  6.  
  7. #ifndef __SCNHDR_H
  8. #define __SCNHDR_H 1
  9.  
  10. /* Used when dealing with COFF files. */
  11.  
  12. #if __cplusplus
  13. extern "C" {
  14. #endif
  15.  
  16. struct scnhdr
  17. {
  18.   char s_name[8];        /* Section name, (.text, .data, .bss). */
  19.   long s_paddr;            /* Physical address. */
  20.   long s_vaddr;            /* Virtual address. */
  21.   long s_size;            /* Section size. */
  22.   long s_scnptr;        /* File ptr to raw data for section. */
  23.   long s_relptr;        /* File ptr to relocation. */
  24.   long s_lnnoptr;        /* File ptr to line numbers. */
  25.   unsigned short s_nreloc;    /* Number of relocation entries. */
  26.   unsigned short s_nlnno;     /* Number of line number entries. */
  27.   long s_flags;          /* Type and content. */
  28. };
  29.  
  30. #define SCNHDR struct scnhdr
  31. #define    SCNHSZ sizeof(SCNHDR)
  32.  
  33. /*  Constants for names of special sections. */
  34. #define _BSS  ".bss"
  35. #define _DATA ".data"
  36. #define _FINI ".fini"
  37. #define _INIT ".init"
  38. #define _TEXT ".text"
  39. #define _TV  ".tv"
  40. #define _COMM ".comment"
  41.  
  42. /* Section numbers for main sections */
  43. #define COFF_TEXT       1
  44. #define COFF_DATA       2
  45. #define COFF_BSS        3
  46. #define COFF_COMMENT    4
  47. #define COFF_STIDATA    5       /* For static constructor function pointers */
  48. #define COFF_STDDATA    6       /* For static destructors function pointers */
  49. #define COFF_MAX_SCNS   6       /* Total number of possible sections */
  50.  
  51. /* s_flags -- The lower 2 bytes are the section type, upper 2 bytes are
  52. section handling. */
  53. #define STYP_REG 0x00        /* regular section: allocated, relocated, */
  54.                 /* loaded */
  55. #define STYP_DSECT 0x01        /* dummy section: not allocated, relocated, */
  56.                 /* not loaded */
  57. #define STYP_NOLOAD 0x02    /* noload section: allocated, relocated, */
  58.                 /* not loaded */
  59. #define STYP_GROUP 0x04        /* grouped section: formed of input sections */
  60. #define STYP_PAD 0x08        /* padding section: not allocated, not */
  61.                 /* relocated, loaded */
  62. #define STYP_COPY 0x10        /* copy section: for decision function used */
  63.                 /* by field update; not    allocated, not */
  64.                                 /* relocated, loaded; reloc & lineno entries */
  65.                                 /* processed normally */
  66. #define STYP_TEXT 0x20        /* text only */
  67. #define STYP_DATA 0x40        /* data only */
  68. #define STYP_BSS 0x80        /* bss only */
  69. #define STYP_INFO 0x200        /* comment section : not allocated not */
  70.                 /* relocated, not loaded */
  71. #define STYP_LIB 0x800        /* for .lib section : same as INFO */
  72. #define STYP_OVER 0x400        /* overlay section : relocated not allocated */
  73.                 /* or loaded */
  74.  
  75. #if __cplusplus
  76. }
  77. #endif
  78.  
  79. #endif
  80.