home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Trees / V6 / usr / man / man3 / end.3 < prev    next >
Encoding:
Text File  |  1975-06-26  |  1.6 KB  |  76 lines

  1. .th END III 4/28/75
  2. .sh NAME
  3. end, etext, edata \*- last locations in program
  4. .sh SYNOPSIS
  5. .ft B
  6. .nf
  7. extern    end;
  8. extern    etext;
  9. extern    edata;
  10. .ft R
  11. .fi
  12. .sh DESCRIPTION
  13. These names refer neither to routines
  14. nor to locations with interesting contents.
  15. Instead, their addresses coincide with the first
  16. address above the program text region
  17. .it (etext),
  18. above the initialized data region
  19. .it (edata),
  20. or uninitialized data region
  21. .it (end).
  22. The last is the same as the program break.
  23. Values are given to these symbols
  24. by the link editor
  25. .it ld
  26. (I)
  27. when, and only when, they are referred to but not defined
  28. in the set of programs loaded.
  29. .s3
  30. The usage of these symbols is rather specialized, but one plausible
  31. possibility is
  32. .s3
  33. .nf
  34.     extern end;
  35.     ...
  36.     ... = brk(&end+...);
  37. .fi
  38. .s3
  39. (see
  40. .it break
  41. (II)).
  42. The problem with this is that it ignores any other
  43. subroutines which may want to extend core for their purposes;
  44. these include
  45. .it sbrk
  46. (see
  47. .it break
  48. (II)),
  49. .it alloc
  50. (III),
  51. and also secret subroutines invoked by the profile
  52. (\-p) option of 
  53. .it cc.
  54. Of course it was for the benefit of such systems
  55. that the symbols were invented,
  56. and user programs, unless they are in firm control
  57. of their environment,
  58. are wise not to refer to
  59. the absolute symbols directly.
  60. .s3
  61. One technique sometimes useful
  62. is to call
  63. .it sbrk(0),
  64. which returns the value of the current program break,
  65. instead of referring to
  66. .it &end,
  67. which yields the program break at the instant execution started.
  68. .s3
  69. These symbols are accessible from assembly
  70. language
  71. if it is remembered that they should be prefixed by
  72. `\*_'
  73. .sh "SEE ALSO"
  74. break (II), alloc (III)
  75. .sh BUGS
  76.