2
0

nppcld.pas 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl
  4. Generate ppc assembler for nodes that handle loads and assignments
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. unit nppcld;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. node,ncgld;
  23. type
  24. tppcloadnode = class(tcgloadnode)
  25. procedure generate_picvaraccess;override;
  26. end;
  27. implementation
  28. uses
  29. verbose,
  30. systems,
  31. cpubase,
  32. cgutils,cgobj,
  33. aasmbase,aasmtai,
  34. symconst,symsym,
  35. procinfo,
  36. nld;
  37. procedure tppcloadnode.generate_picvaraccess;
  38. var
  39. l : tasmsymbol;
  40. ref : treference;
  41. begin
  42. case target_info.system of
  43. system_powerpc_darwin:
  44. begin
  45. if (tvarsym(symtableentry).owner.unitid<>0) or (vo_is_dll_var in tvarsym(symtableentry).varoptions) then
  46. begin
  47. l:=objectlibrary.getasmsymbol('L'+tvarsym(symtableentry).mangledname+'$non_lazy_ptr');
  48. if not(assigned(l)) then
  49. begin
  50. l:=objectlibrary.newasmsymbol('L'+tvarsym(symtableentry).mangledname+'$non_lazy_ptr',AB_COMMON,AT_DATA);
  51. picdata.concat(tai_symbol.create(l,0));
  52. picdata.concat(tai_const.create_indirect_sym(objectlibrary.newasmsymbol(tvarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA)));
  53. picdata.concat(tai_const.create_32bit(0));
  54. end;
  55. reference_reset_symbol(ref,l,0);
  56. { ref.base:=current_procinfo.got;
  57. ref.relsymbol:=current_procinfo.gotlabel;}
  58. reference_reset_base(location.reference,cg.getaddressregister(exprasmlist),0);
  59. cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,ref,location.reference.base);
  60. end
  61. else
  62. internalerror(200403021);
  63. end
  64. else
  65. internalerror(200402291);
  66. end;
  67. end;
  68. begin
  69. cloadnode:=tppcloadnode;
  70. end.
  71. {
  72. $Log$
  73. Revision 1.3 2004-06-17 16:55:46 peter
  74. * powerpc compiles again
  75. Revision 1.2 2004/03/05 22:17:11 jonas
  76. * fixed importing of variables from shared libraries, but disabled
  77. PIC support for now. You have to save/restore r31 when you us it! :)
  78. Also, it's not necessary to support the imported variables
  79. Revision 1.1 2004/03/02 17:32:12 florian
  80. * make cycle fixed
  81. + pic support for darwin
  82. + support of importing vars from shared libs on darwin implemented
  83. }