Recent

Author Topic: [SOLVED] how to force ld to start at PASCALMAIN?  (Read 1185 times)

Key-Real

  • Sr. Member
  • ****
  • Posts: 261
[SOLVED] how to force ld to start at PASCALMAIN?
« on: June 06, 2024, 07:55:57 pm »
my .s
Code: Pascal  [Select][+][-]
  1.  
  2.         .file "test.pas"
  3.         .module nomips16
  4. # Begin asmlist al_procedures
  5.  
  6. .section .text,"ax"
  7.         .balign 4
  8. .globl  P$PROGRAM_$$_INITSCREEN
  9. P$PROGRAM_$$_INITSCREEN:
  10. .ent P$PROGRAM_$$_INITSCREEN
  11.         .set    nomips16
  12.         .frame  $sp,112,$ra
  13.         .mask   0xC0000000,-36
  14.         .fmask  0x00000000,0
  15.         .set    noreorder
  16.         .set    nomacro
  17. move $t2,$t2
  18.         nop
  19.         nop
  20.         nop
  21.         nop
  22.  
  23.         addiu   $sp,$sp,-112
  24.         sw      $ra,76($sp)
  25.         sw      $fp,72($sp)
  26.         addiu   $fp,$sp,112
  27.         move    $a0,$zero
  28.         jal     ResetGraph
  29.         nop
  30.         jal     InitGeom
  31.         nop
  32.         move    $a0,$zero
  33.         jal     SetGraphDebug
  34.         nop
  35.         addiu   $a1,$zero,256
  36.         addiu   $a0,$zero,960
  37.         jal     FntLoad
  38.         nop
  39.         addiu   $v0,$zero,512
  40.         sw      $v0,20($sp)
  41.         addiu   $v0,$zero,1
  42.         sw      $v0,16($sp)
  43.         addiu   $a3,$zero,64
  44.         addiu   $a2,$zero,320
  45.         addiu   $a1,$zero,100
  46.         addiu   $a0,$zero,100
  47.         jal     FntOpen
  48.         nop
  49.         move    $a0,$v0
  50.         jal     SetDumpFnt
  51.         nop
  52.         lw      $fp,72($sp)
  53.         lw      $ra,76($sp)
  54.         jr      $ra
  55.         addiu   $sp,$sp,112
  56.         .set    macro
  57.         .set    reorder
  58. .end P$PROGRAM_$$_INITSCREEN
  59.  
  60. .section .text,"ax"
  61.         .balign 4
  62. .globl  main
  63. main:
  64. .globl  PASCALMAIN
  65. PASCALMAIN:
  66. .ent main
  67.         .set    nomips16
  68.         .frame  $sp,104,$ra
  69.         .mask   0xC0000000,-36
  70.         .fmask  0x00000000,0
  71.         .set    noreorder
  72.         .set    nomacro
  73.  
  74.         move $t1,$t1
  75.         nop
  76.         nop
  77.         nop
  78.         nop
  79.  
  80.         addiu   $sp,$sp,-104
  81.         sw      $ra,68($sp)
  82.         sw      $fp,64($sp)
  83.         addiu   $fp,$sp,104
  84.         jal     fpc_initializeunits
  85.         nop
  86.         jal     P$PROGRAM_$$_INITSCREEN
  87.         nop
  88.         addiu   $v0,$zero,1
  89.         lui     $v1,%hi(U_$P$PROGRAM_$$_I)
  90.         sw      $v0,%lo(U_$P$PROGRAM_$$_I)($v1)
  91. .Lj5:
  92.         lui     $v0,%hi(U_$P$PROGRAM_$$_I)
  93.         lw      $v0,%lo(U_$P$PROGRAM_$$_I)($v0)
  94.         nop
  95.         addiu   $v1,$v0,1
  96.         lui     $v0,%hi(U_$P$PROGRAM_$$_I)
  97.         sw      $v1,%lo(U_$P$PROGRAM_$$_I)($v0)
  98.         lui     $a0,%hi(_$PROGRAM$_Ld1)
  99.         addiu   $a0,$a0,%lo(_$PROGRAM$_Ld1)
  100.         lui     $v0,%hi(U_$P$PROGRAM_$$_I)
  101.         lw      $a1,%lo(U_$P$PROGRAM_$$_I)($v0)
  102.         jal     FntPrint
  103.         nop
  104.         move    $a0,$zero
  105.         jal     DrawSync
  106.         nop
  107.         move    $a0,$zero
  108.         jal     VSync
  109.         nop
  110.         addiu   $a0,$zero,-1
  111.         jal     FntFlush
  112.         nop
  113.         b       .Lj5
  114.         nop
  115.         jal     fpc_do_exit
  116.         nop
  117.         lw      $fp,64($sp)
  118.         lw      $ra,68($sp)
  119.         jr      $ra
  120.         addiu   $sp,$sp,104
  121.         .set    macro
  122.         .set    reorder
  123. .end main
  124. # End asmlist al_procedures
  125. # Begin asmlist al_globals
  126.  
  127. .section .bss,"aw",%nobits
  128.         .balign 4
  129. U_$P$PROGRAM_$$_DRAW:
  130.         .zero 92
  131.  
  132. .section .bss,"aw",%nobits
  133.         .balign 2
  134. U_$P$PROGRAM_$$_DISP:
  135.         .zero 20
  136.  
  137. .section .bss,"aw",%nobits
  138.         .balign 4
  139. U_$P$PROGRAM_$$_I:
  140.         .zero 4
  141.  
  142. .section .bss,"aw",%nobits
  143.         .balign 2
  144. U_$P$PROGRAM_$$_R:
  145.         .zero 8
  146.  
  147. .section .data
  148.         .balign 4
  149. .globl  INITFINAL
  150. INITFINAL:
  151.         .long   0,0
  152.  
  153. .section .data
  154.         .balign 4
  155. .globl  FPC_THREADVARTABLES
  156. FPC_THREADVARTABLES:
  157.         .long   0
  158.  
  159. .section .data
  160.         .balign 4
  161. .globl  FPC_RESOURCESTRINGTABLES
  162. FPC_RESOURCESTRINGTABLES:
  163.         .long   0
  164.  
  165. .section .data
  166.         .balign 4
  167. .globl  FPC_WIDEINITTABLES
  168. FPC_WIDEINITTABLES:
  169.         .long   0
  170.  
  171. .section .data
  172.         .balign 4
  173. .globl  FPC_RESSTRINITTABLES
  174. FPC_RESSTRINITTABLES:
  175.         .long   0
  176.  
  177. .section .fpc,"aw"
  178.         .balign 8
  179. __fpc_ident:
  180.         .ascii  "FPC 3.3.1 [2024/06/06] for mipsel - ps1"
  181.  
  182. .section .data
  183.         .balign 4
  184. .globl  __stklen
  185. __stklen:
  186.         .long   33554432
  187.  
  188. .section .data
  189.         .balign 4
  190. .globl  __heapsize
  191. __heapsize:
  192.         .long   0
  193.  
  194. .section .data
  195.         .balign 4
  196. .globl  __fpc_valgrind
  197. __fpc_valgrind:
  198.         .byte   0
  199.  
  200. .section .data
  201.         .balign 4
  202. .globl  FPC_RESLOCATION
  203. FPC_RESLOCATION:
  204.         .long   0
  205. # End asmlist al_globals
  206. # Begin asmlist al_typedconsts
  207.  
  208. .section .rodata
  209.         .balign 4
  210. .globl  _$PROGRAM$_Ld1
  211. _$PROGRAM$_Ld1:
  212.         .ascii  "\002%d\000"
  213. # End asmlist al_typedconsts
  214.  
  215.  

my linker script:
Code: Pascal  [Select][+][-]
  1. MEMORY
  2. {
  3.         ram (rwx) : ORIGIN = 0x80010000, LENGTH = 2M - 64K
  4. }
  5.  
  6. SECTIONS
  7. {
  8.         .text : ALIGN(8) {
  9.                 __exe_start__ = .;
  10.                 __text_start__ = .;
  11.                 *(.text .text.*)
  12.                 __text_end__ = .;
  13.                 __text_size__ = __text_start__ - __text_end__;
  14.         } > ram
  15.  
  16.         .rodata : ALIGN(8) {
  17.                 __rdata_start__ = .;
  18.                 *(.rdata .rdata.* .rodata .rodata.*)
  19.                 __rdata_end__ = .;
  20.                 __rdata_size__ = __rdata_end__ - __rdata_start__;
  21.         } > ram
  22.  
  23.         .ctors : ALIGN(8) {
  24.                 __ctors_start__ = .;
  25.                 KEEP(*(.ctors))
  26.                 KEEP(*(SORT(.ctors.*)))
  27.                 __ctors_end__ = .;
  28.                 __ctors_size__ = __ctors_end__ - __ctors_start__;
  29.         } > ram
  30.  
  31.         .dtors : ALIGN(8) {
  32.                 __dtors_start__ = .;
  33.                 KEEP(*(.dtors))
  34.                 KEEP(*(SORT(.dtors.*)))
  35.                 __dtors_end__ = .;
  36.                 __dtors_size__ = __dtors_end__ - __dtors_start__;
  37.         } > ram
  38.  
  39.         .data : ALIGN(8) {
  40.                 __sdata_start__ = .;
  41.                 *(.sdata .sdata.*)
  42.                 __sdata_end__ = .;
  43.                 __sdata_size__ = __sdata_end__ - __sdata_start__;
  44.                 __data_start__ = .;
  45.                 *(.data .data.*)
  46.                 SORT(CONSTRUCTORS)
  47.                 . = ALIGN(2048);
  48.                 __data_end__ = .;
  49.                 __exe_end__ = .;
  50.                 __data_size__ = __data_end__ - __data_start__;
  51.         } > ram
  52.  
  53.         __exe_size__ = __exe_end__ - __exe_start__;
  54.  
  55.         .sbss : ALIGN(64) {
  56.                 __sbss_start__ = .;
  57.                 *(.sbss .sbss.*)
  58.                 __sbss_end__ = .;
  59.                 __sbss_size__ = __sbss_end__ - __sbss_start__;
  60.         } > ram
  61.  
  62.         .bss : ALIGN(64) {
  63.                 __bss_start__ = .;
  64.                 *(.bss .bss.*)
  65.                 *(COMMON)
  66.                 . = ALIGN(64);
  67.                 __bss_end__ = .;
  68.                 __bss_size__ = __bss_end__ - __bss_start__;
  69.         } > ram
  70. }
  71.  

if i load the executable he does not load main first, he loads the P$PROGRAM_$$_INITSCREEN in my bin start address 0x80010000
so the P$PROGRAM_$$_INITSCREEN is executed right at 0x80010000 which is the entry address
I don't knew how to force the linker to start at main (PASCALMAIN)
« Last Edit: June 06, 2024, 10:57:38 pm by Key-Real »

PascalDragon

  • Hero Member
  • *****
  • Posts: 5548
  • Compiler Developer
Re: how to force ld to start at PASCALMAIN?
« Reply #1 on: June 06, 2024, 09:42:40 pm »
You know that you could look at the documentation for ld?

Also you shouldn't directly start PASCALMAIN, but your RTL should have a dedicated entry point function that does some low level setup (e.g. arguments and such) and that then calls PASCALMAIN (just look at the Linux RTL for example that has the _start symbol in its various startup files in rtl/linux/<arch>).

Key-Real

  • Sr. Member
  • ****
  • Posts: 261
Re: how to force ld to start at PASCALMAIN?
« Reply #2 on: June 06, 2024, 09:45:38 pm »
I done this but nothing happens

ccrause

  • Hero Member
  • *****
  • Posts: 903
Re: how to force ld to start at PASCALMAIN?
« Reply #3 on: June 06, 2024, 09:52:04 pm »
Read Setting the Entry Point. So either specify the entry point symbol with the -e _start command line option to the linker, or add entry(_start) to your linker script.

The compiler often use the entry keyword in its own target linker scripts.

Edit: Changed symbol name to _start after reading the follow-up discussion.
« Last Edit: June 06, 2024, 09:54:39 pm by ccrause »

Key-Real

  • Sr. Member
  • ****
  • Posts: 261
Re: how to force ld to start at PASCALMAIN?
« Reply #4 on: June 06, 2024, 09:53:51 pm »
Read Setting the Entry Point. So either specify the entry point symbol with the -e PASCALMAIN command line option to the linker, or add entry(PASCALMAIN) to your linker script.

The compiler often use the entry keyword in its own target linker scripts.

this isn't working because fpc creates several .text sections.
this is why we need the si_prc.pp

Key-Real

  • Sr. Member
  • ****
  • Posts: 261
Re: how to force ld to start at PASCALMAIN?
« Reply #5 on: June 06, 2024, 09:57:08 pm »
@PascalDragon

with the setup i posted above nothing of si_prc.pp is written in the .s file

Key-Real

  • Sr. Member
  • ****
  • Posts: 261
Re: how to force ld to start at PASCALMAIN?
« Reply #6 on: June 06, 2024, 10:09:59 pm »
Code: Pascal  [Select][+][-]
  1. systems_internal_sysinit = [system_i386_win32,system_x86_64_win64,
  2.                                    system_i386_linux,system_powerpc64_linux,system_sparc64_linux,system_x86_64_linux,
  3.                                    system_xtensa_linux,system_mips64_linux,system_mips64el_linux,
  4.                                    system_m68k_atari,system_m68k_palmos,system_m68k_sinclairql,system_m68k_human68k,
  5.                                    system_i386_haiku,system_x86_64_haiku,
  6.                                    system_i386_openbsd,system_x86_64_openbsd,
  7.                                    system_riscv32_linux,system_riscv64_linux,
  8.                                    system_aarch64_win64,
  9.                                    system_z80_zxspectrum,system_z80_msxdos,
  10.                                    system_wasm32_wasi,system_loongarch64_linux,
  11.                                    system_mipsel_ps1
  12.                                   ]+systems_darwin+systems_amigalike;

i even set this, but still nothing happens

ccrause

  • Hero Member
  • *****
  • Posts: 903
Re: how to force ld to start at PASCALMAIN?
« Reply #7 on: June 06, 2024, 10:10:23 pm »
with the setup i posted above nothing of si_prc.pp is written in the .s file

The test.txt file looks like the compiler generated assembler for the test.pas unit only so it will not contain code from another unit. One can for example use objdump -S to disassemble the final linked executable, objdump -t or readelf -s to list all the symbols linked into the executable image.

Key-Real

  • Sr. Member
  • ****
  • Posts: 261
Re: how to force ld to start at PASCALMAIN?
« Reply #8 on: June 06, 2024, 10:14:21 pm »
The test.txt file looks like the compiler generated assembler for the test.pas unit only so it will not contain code from another unit.
why is it the case? what to do?

One can for example use objdump -S to disassemble the final linked executable, objdump -t or readelf -s to list all the symbols linked into the executable image.

can't do this, my .elf is in a unknown format, I use mipsel-unknown-elf-ld

PascalDragon

  • Hero Member
  • *****
  • Posts: 5548
  • Compiler Developer
Re: how to force ld to start at PASCALMAIN?
« Reply #9 on: June 06, 2024, 10:16:55 pm »
i even set this, but still nothing happens

Because your TExternalLinker descendant also needs to override InitSysInitUnitName. Look at the other targets. And best also override WriteResponseFile to dynamically create the linker script (again, look at the other targets).

The test.txt file looks like the compiler generated assembler for the test.pas unit only so it will not contain code from another unit.
why is it the case? what to do?

Because that is how Pascal works?! Every unit is its own object file and thus its own assembly file. It's the linker's task to link these together.

One can for example use objdump -S to disassemble the final linked executable, objdump -t or readelf -s to list all the symbols linked into the executable image.

can't do this, my .elf is in a unknown format, I use mipsel-unknown-elf-ld

That does not mean that the format itself is unknown, only that the platform is not specified. Also there should be a mipsel-unknown-elf-objdump.

Key-Real

  • Sr. Member
  • ****
  • Posts: 261
Re: how to force ld to start at PASCALMAIN?
« Reply #10 on: June 06, 2024, 10:29:57 pm »
I done all this, but the first routine in the disasembled file is still initscreen

Key-Real

  • Sr. Member
  • ****
  • Posts: 261
Re: how to force ld to start at PASCALMAIN?
« Reply #11 on: June 06, 2024, 10:32:51 pm »
and
80010198 <SI_PRC_$$__FPC_PROC_START$$LONGINT>:
cames after main :(

Key-Real

  • Sr. Member
  • ****
  • Posts: 261
Re: how to force ld to start at PASCALMAIN?
« Reply #12 on: June 06, 2024, 10:40:20 pm »
Code: Pascal  [Select][+][-]
  1.  
  2. ./test.elf:     file format elf32-littlemips
  3.  
  4.  
  5. Disassembly of section .text:
  6.  
  7. 80010000 <P$PROGRAM_$$_INITSCREEN>:
  8. 80010000:       27bdff90        addiu   sp,sp,-112
  9. 80010004:       afbf004c        sw      ra,76(sp)
  10. 80010008:       afbe0048        sw      s8,72(sp)
  11. 8001000c:       27be0070        addiu   s8,sp,112
  12. 80010010:       00002025        move    a0,zero
  13. 80010014:       0c0043da        jal     80010f68 <ResetGraph>
  14. 80010018:       00000000        nop
  15. 8001001c:       0c00500c        jal     80014030 <InitGeom>
  16. 80010020:       00000000        nop
  17. 80010024:       00002025        move    a0,zero
  18. 80010028:       0c004437        jal     800110dc <SetGraphDebug>
  19. 8001002c:       00000000        nop
  20. 80010030:       240201e0        li      v0,480
  21. 80010034:       afa20010        sw      v0,16(sp)
  22. 80010038:       3c048002        lui     a0,0x8002
  23. 8001003c:       24849040        addiu   a0,a0,-28608
  24. 80010040:       24070280        li      a3,640
  25. 80010044:       00003025        move    a2,zero
  26. 80010048:       00002825        move    a1,zero
  27. 8001004c:       0c00409e        jal     80010278 <SetDefDrawEnv>
  28. 80010050:       00000000        nop
  29. 80010054:       240201e0        li      v0,480
  30. 80010058:       afa20010        sw      v0,16(sp)
  31. 8001005c:       3c048002        lui     a0,0x8002
  32. 80010060:       2484909c        addiu   a0,a0,-28516
  33. 80010064:       24070280        li      a3,640
  34. 80010068:       00003025        move    a2,zero
  35. 8001006c:       00002825        move    a1,zero
  36. 80010070:       0c0040ce        jal     80010338 <SetDefDispEnv>
  37. 80010074:       00000000        nop
  38. 80010078:       24040001        li      a0,1
  39. 8001007c:       0c004493        jal     8001124c <SetDispMask>
  40. 80010080:       00000000        nop
  41. 80010084:       3c048002        lui     a0,0x8002
  42. 80010088:       24849040        addiu   a0,a0,-28608
  43. 8001008c:       0c004652        jal     80011948 <PutDrawEnv>
  44. 80010090:       00000000        nop
  45. 80010094:       3c048002        lui     a0,0x8002
  46. 80010098:       2484909c        addiu   a0,a0,-28516
  47. 8001009c:       0c0046c5        jal     80011b14 <PutDispEnv>
  48. 800100a0:       00000000        nop
  49. 800100a4:       24050100        li      a1,256
  50. 800100a8:       240403c0        li      a0,960
  51. 800100ac:       0c0040ee        jal     800103b8 <FntLoad>
  52. 800100b0:       00000000        nop
  53. 800100b4:       24020200        li      v0,512
  54. 800100b8:       afa20014        sw      v0,20(sp)
  55. 800100bc:       24020001        li      v0,1
  56. 800100c0:       afa20010        sw      v0,16(sp)
  57. 800100c4:       24070040        li      a3,64
  58. 800100c8:       24060140        li      a2,320
  59. 800100cc:       24050064        li      a1,100
  60. 800100d0:       24040064        li      a0,100
  61. 800100d4:       0c004116        jal     80010458 <FntOpen>
  62. 800100d8:       00000000        nop
  63. 800100dc:       00402025        move    a0,v0
  64. 800100e0:       0c0040de        jal     80010378 <SetDumpFnt>
  65. 800100e4:       00000000        nop
  66. 800100e8:       8fbe0048        lw      s8,72(sp)
  67. 800100ec:       8fbf004c        lw      ra,76(sp)
  68. 800100f0:       03e00008        jr      ra
  69. 800100f4:       27bd0070        addiu   sp,sp,112
  70.  
  71. 800100f8 <main>:
  72. 800100f8:       27bdff98        addiu   sp,sp,-104
  73. 800100fc:       afbf0044        sw      ra,68(sp)
  74. 80010100:       afbe0040        sw      s8,64(sp)
  75. 80010104:       27be0068        addiu   s8,sp,104
  76. 80010108:       0c004091        jal     80010244 <fpc_initializeunits>
  77. 8001010c:       00000000        nop
  78. 80010110:       0c004000        jal     80010000 <P$PROGRAM_$$_INITSCREEN>
  79. 80010114:       00000000        nop
  80. 80010118:       24020001        li      v0,1
  81. 8001011c:       3c038002        lui     v1,0x8002
  82. 80010120:       ac6290b0        sw      v0,-28496(v1)
  83. 80010124:       3c028002        lui     v0,0x8002
  84. 80010128:       8c4290b0        lw      v0,-28496(v0)
  85. 8001012c:       00000000        nop
  86. 80010130:       24430001        addiu   v1,v0,1
  87. 80010134:       3c028002        lui     v0,0x8002
  88. 80010138:       ac4390b0        sw      v1,-28496(v0)
  89. 8001013c:       3c048001        lui     a0,0x8001
  90. 80010140:       24845a38        addiu   a0,a0,23096
  91. 80010144:       3c028002        lui     v0,0x8002
  92. 80010148:       8c4590b0        lw      a1,-28496(v0)
  93. 8001014c:       0c00428b        jal     80010a2c <FntPrint>
  94. 80010150:       00000000        nop
  95. 80010154:       00002025        move    a0,zero
  96. 80010158:       0c0044b9        jal     800112e4 <DrawSync>
  97. 8001015c:       00000000        nop
  98. 80010160:       00002025        move    a0,zero
  99. 80010164:       0c00526a        jal     800149a8 <VSync>
  100. 80010168:       00000000        nop
  101. 8001016c:       2404ffff        li      a0,-1
  102. 80010170:       0c0041c4        jal     80010710 <FntFlush>
  103. 80010174:       00000000        nop
  104. 80010178:       1000ffea        b       80010124 <main+0x2c>
  105. 8001017c:       00000000        nop
  106. 80010180:       0c004097        jal     8001025c <fpc_do_exit>
  107. 80010184:       00000000        nop
  108. 80010188:       8fbe0040        lw      s8,64(sp)
  109. 8001018c:       8fbf0044        lw      ra,68(sp)
  110. 80010190:       03e00008        jr      ra
  111. 80010194:       27bd0068        addiu   sp,sp,104
  112.  
  113. 80010198 <SI_PRC_$$__FPC_PROC_START$$LONGINT>:
  114. 80010198:       27bdff90        addiu   sp,sp,-112
  115. 8001019c:       afbf0044        sw      ra,68(sp)
  116. 800101a0:       afbe0040        sw      s8,64(sp)
  117. 800101a4:       27be0070        addiu   s8,sp,112
  118. 800101a8:       0c00403e        jal     800100f8 <main>
  119. 800101ac:       00000000        nop
  120. 800101b0:       8fbe0040        lw      s8,64(sp)
  121. 800101b4:       8fbf0044        lw      ra,68(sp)
  122. 800101b8:       03e00008        jr      ra
  123. 800101bc:       27bd0070        addiu   sp,sp,112
  124. ...
  125.  

Key-Real

  • Sr. Member
  • ****
  • Posts: 261
Re: how to force ld to start at PASCALMAIN?
« Reply #13 on: June 06, 2024, 10:46:47 pm »
how to tell ld to put the si_prc in the front?

my script:

Code: Pascal  [Select][+][-]
  1.  
  2. MEMORY
  3. {
  4.         ram (rwx) : ORIGIN = 0x80010000, LENGTH = 2M - 64K
  5. }
  6.  
  7. SECTIONS
  8. {
  9.         .text : ALIGN(8) {
  10.                 __exe_start__ = .;
  11.                 __text_start__ = .;
  12.                 *(.text .text.*)
  13.                 __text_end__ = .;
  14.                 __text_size__ = __text_start__ - __text_end__;
  15.         } > ram
  16.  
  17.         .rodata : ALIGN(8) {
  18.                 __rdata_start__ = .;
  19.                 *(.rdata .rdata.* .rodata .rodata.*)
  20.                 __rdata_end__ = .;
  21.                 __rdata_size__ = __rdata_end__ - __rdata_start__;
  22.         } > ram
  23.  
  24.         .ctors : ALIGN(8) {
  25.                 __ctors_start__ = .;
  26.                 KEEP(*(.ctors))
  27.                 KEEP(*(SORT(.ctors.*)))
  28.                 __ctors_end__ = .;
  29.                 __ctors_size__ = __ctors_end__ - __ctors_start__;
  30.         } > ram
  31.  
  32.         .dtors : ALIGN(8) {
  33.                 __dtors_start__ = .;
  34.                 KEEP(*(.dtors))
  35.                 KEEP(*(SORT(.dtors.*)))
  36.                 __dtors_end__ = .;
  37.                 __dtors_size__ = __dtors_end__ - __dtors_start__;
  38.         } > ram
  39.  
  40.         .data : ALIGN(8) {
  41.                 __sdata_start__ = .;
  42.                 *(.sdata .sdata.*)
  43.                 __sdata_end__ = .;
  44.                 __sdata_size__ = __sdata_end__ - __sdata_start__;
  45.                 __data_start__ = .;
  46.                 *(.data .data.*)
  47.                 SORT(CONSTRUCTORS)
  48.                 . = ALIGN(2048);
  49.                 __data_end__ = .;
  50.                 __exe_end__ = .;
  51.                 __data_size__ = __data_end__ - __data_start__;
  52.         } > ram
  53.  
  54.         __exe_size__ = __exe_end__ - __exe_start__;
  55.  
  56.         .sbss : ALIGN(64) {
  57.                 __sbss_start__ = .;
  58.                 *(.sbss .sbss.*)
  59.                 __sbss_end__ = .;
  60.                 __sbss_size__ = __sbss_end__ - __sbss_start__;
  61.         } > ram
  62.  
  63.         .bss : ALIGN(64) {
  64.                 __bss_start__ = .;
  65.                 *(.bss .bss.*)
  66.                 *(COMMON)
  67.                 . = ALIGN(64);
  68.                 __bss_end__ = .;
  69.                 __bss_size__ = __bss_end__ - __bss_start__;
  70.         } > ram
  71. }
  72.  
  73.  

Key-Real

  • Sr. Member
  • ****
  • Posts: 261
Re: how to force ld to start at PASCALMAIN?
« Reply #14 on: June 06, 2024, 10:57:23 pm »
Code: Pascal  [Select][+][-]
  1. STARTUP(./rtl/ps1/si_prc.o)
  2.  

done the job!!!

thx :)

 

TinyPortal © 2005-2018