subsegs.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* subsegs.h -> subsegs.c
  2. Copyright (C) 1987 Free Software Foundation, Inc.
  3. This file is part of GAS, the GNU Assembler.
  4. GAS is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 1, or (at your option)
  7. any later version.
  8. GAS is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GAS; see the file COPYING. If not, write to
  14. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
  15. /*
  16. * For every sub-segment the user mentions in the ASsembler program,
  17. * we make one struct frchain. Each sub-segment has exactly one struct frchain
  18. * and vice versa.
  19. *
  20. * Struct frchain's are forward chained (in ascending order of sub-segment
  21. * code number). The chain runs through frch_next of each subsegment.
  22. * This makes it hard to find a subsegment's frags
  23. * if programmer uses a lot of them. Most programs only use text0 and
  24. * data0, so they don't suffer. At least this way:
  25. * (1) There are no "arbitrary" restrictions on how many subsegments
  26. * can be programmed;
  27. * (2) Subsegments' frchain-s are (later) chained together in the order in
  28. * which they are emitted for object file viz text then data.
  29. *
  30. * From each struct frchain dangles a chain of struct frags. The frags
  31. * represent code fragments, for that sub-segment, forward chained.
  32. */
  33. struct frchain /* control building of a frag chain */
  34. { /* FRCH = FRagment CHain control */
  35. struct frag * frch_root; /* 1st struct frag in chain, or NULL */
  36. struct frag * frch_last; /* last struct frag in chain, or NULL */
  37. struct frchain * frch_next; /* next in chain of struct frchain-s */
  38. segT frch_seg; /* SEG_TEXT or SEG_DATA. */
  39. subsegT frch_subseg; /* subsegment number of this chain */
  40. };
  41. typedef struct frchain frchainS;
  42. extern frchainS * frchain_root; /* NULL means no frchains yet. */
  43. /* all subsegments' chains hang off here */
  44. extern frchainS * frchain_now;
  45. /* Frchain we are assembling into now */
  46. /* That is, the current segment's frag */
  47. /* chain, even if it contains no (complete) */
  48. /* frags. */
  49. extern frchainS * data0_frchainP;
  50. /* Sentinel for frchain crawling. */
  51. /* Points to the 1st data-segment frchain. */
  52. /* (Which is pointed to by the last text- */
  53. /* segment frchain.) */
  54. /* end: subsegs.h */