[fpc-pascal] is there a ready to use FPC Cross compiler x86-Linux -> MIPS-linux?

Dennis Poon dennis at avidsoft.com.hk
Sun Jun 16 18:16:31 CEST 2013


Sven,

I tried your suggestion and the result is exactly the same. So, I guess 
putting the path in BINUTILSPREFIX has the same effect as CROSSBINDIR.
It will just concatenate both variable to get the full 'as' and 'ar' 
file paths.

As per your second suggestion, my knowledge of assembler is too limited. 
I don't how hot to fiddle the paramters passed to the 'as'.
I typed the -help below. Can anyone give me some advice as to how to 
solve the 'as' problem:
   Error: illegal operands `lui $a2,%hi(__dl_fini)'


Usage: /home/dennis/toolchains/staging_dir_mips/bin/mips-linux-as 
[option...] [asmfile...]
Options:
   -a[sub-option...]      turn on listings
                             Sub-options [default hls]:
                             c      omit false conditionals
                             d      omit debugging directives
                             h      include high-level source
                             l      include assembly
                             m      include macro expansions
                             n      omit forms processing
                             s      include symbols
                             =FILE  list to FILE (must be last sub-option)
   --alternate             initially turn on alternate macro syntax
   -D                      produce assembler debugging messages
   --defsym SYM=VAL        define symbol SYM to given value
   --em=[mipsbelf | mipslelf | mipself]
                           emulate output (default mipsbelf)
   --execstack             require executable stack for this object
   --noexecstack           don't require executable stack for this object
   -f                      skip whitespace and comment preprocessing
   -g --gen-debug          generate debugging information
   --gstabs                generate STABS debugging information
   --gstabs+               generate STABS debug info with GNU extensions
   --gdwarf-2              generate DWARF2 debugging information
   --hash-size=<value>     set the hash table size close to <value>
   --help                  show this message and exit
   --target-help           show target specific options
   -I DIR                  add DIR to search list for .include directives
   -J                      don't warn about signed overflow
   -K                      warn when differences altered for long 
displacements
   -L,--keep-locals        keep local symbols (e.g. starting with `L')
   -M,--mri                assemble in MRI compatibility mode
   --MD FILE               write dependency information in FILE (default 
none)
   -nocpp                  ignored
   -o OBJFILE              name the object-file output OBJFILE (default 
a.out)
   -R                      fold data section into text section
   --reduce-memory-overheads
                           prefer smaller memory use at the cost of longer
                           assembly times
   --statistics            print various measured statistics from execution
   --strip-local-absolute  strip local absolute symbols
   --traditional-format    Use same format as native assembler when possible
   --version               print assembler version number and exit
   -W  --no-warn           suppress warnings
   --warn                  don't suppress warnings
   --fatal-warnings        treat warnings as errors
   --itbl INSTTBL          extend instruction set to include instructions
                           matching the specifications defined in file 
INSTTBL
   -w                      ignored
   -X                      ignored
   -Z                      generate object file even after errors
   --listing-lhs-width     set the width in words of the output data 
column of
                           the listing
   --listing-lhs-width2    set the width in words of the continuation lines
                           of the output data column; ignored if smaller 
than
                           the width of the first line
   --listing-rhs-width     set the max width in characters of the lines from
                           the source file
   --listing-cont-lines    set the maximum number of continuation lines used
                           for the output data column of the listing
   @FILE                   read options from FILE
MIPS options:
-EB            generate big endian output
-EL            generate little endian output
-g, -g2            do not remove unneeded NOPs or swap branches
-G NUM            allow referencing objects up to NUM bytes
             implicitly with the gp register [default 8]
-mips1            generate MIPS ISA I instructions
-mips2            generate MIPS ISA II instructions
-mips3            generate MIPS ISA III instructions
-mips4            generate MIPS ISA IV instructions
-mips5                  generate MIPS ISA V instructions
-mips32                 generate MIPS32 ISA instructions
-mips32r2               generate MIPS32 release 2 ISA instructions
-mips64                 generate MIPS64 ISA instructions
-mips64r2               generate MIPS64 release 2 ISA instructions
-march=CPU/-mtune=CPU    generate code/schedule for CPU, where CPU is 
one of:
                         mips1, mips2, mips3, mips4, mips5, mips32,
                         mips32r2, mips64, mips64r2, r3000, r2000, r3900,
                         r6000, r4000, r4010, vr4100, vr4111, vr4120,
                         vr4130, vr4181, vr4300, r4400, r4600, orion,
                         r4650, r8000, r10000, r12000, vr5000, vr5400,
                         vr5500, rm5200, rm5230, rm5231, rm5261, rm5721,
                         rm7000, rm9000, 4kc, 4km, 4kp, m4k, 24k, 24kc,
                         24kf, 24kx, 5kc, 5kf, 20kc, sb1, from-abi
-mCPU            equivalent to -march=CPU -mtune=CPU. Deprecated.
-no-mCPU        don't generate code specific to CPU.
             For -mCPU and -no-mCPU, CPU must be one of:
                         3900, 4010, 4100, 4650
-mips16            generate mips16 instructions
-no-mips16        do not generate mips16 instructions
-mdsp            generate DSP instructions
-mno-dsp        do not generate DSP instructions
-mmt            generate MT instructions
-mno-mt            do not generate MT instructions
-mfix-vr4120        work around certain VR4120 errata
-mfix-vr4130        work around VR4130 mflo/mfhi errata
-mgp32            use 32-bit GPRs, regardless of the chosen ISA
-mfp32            use 32-bit FPRs, regardless of the chosen ISA
-mno-shared        optimize output for executables
-msym32            assume all symbols have 32-bit values
-O0            remove unneeded NOPs, do not swap branches
-O            remove unneeded NOPs and swap branches
--[no-]construct-floats [dis]allow floating point values to be constructed
--trap, --no-break    trap exception on div by 0 and mult overflow
--break, --no-trap    break exception on div by 0 and mult overflow
-KPIC, -call_shared    generate SVR4 position independent code
-non_shared        do not generate position independent code
-xgot            assume a 32 bit GOT
-mpdr, -mno-pdr        enable/disable creation of .pdr sections
-mshared, -mno-shared   disable/enable .cpload optimization for
                         non-shared code
-mabi=ABI        create ABI conformant object file for:
                         32, o64, n32, 64, eabi
-32            create o32 ABI object file (default)
-n32            create n32 ABI object file
-64            create 64 ABI object file

> On 15.06.2013 19:19, Dennis Poon wrote:
>>
>> I eventually found this page which talked about downloading a special
>> toolchain from openwrt web site
>>
>> http://www.dd-wrt.com/phpBB2/viewtopic.php?t=61112
>>
>> I followed its instruction and successfully compiled a helloworld c
>> program and
>> successfully RUN the helloworld binary on Netgear 3700 running DD-Wrt !
>>
>> I was overjoyed.
>>
>> Then I tried to modify the steps to compile fpc
>>
>> my toolchains  is at /home/dennis/toolchains/staging_dir_mips/bin/
>> and in this folder, there are files: mips-linux-ar  and mips-linux-as
>> so I
>> make clean all CPU_TARGET=mips OS_TARGET=linux
>> BINUTILSPREFIX=/home/dennis/toolchains/staging_dir_mips/bin/mips-linux-
>
> It seems not to be your problem, but your arguments are not entirely 
> correct (and it "works" just by accident). BINUTILSPREFIX is *only* 
> the prefix of the binaries, in your case "mips-linux-". The path must 
> be passed as CROSSBINDIR like so: 
> CROSSBINDIR=/home/dennis/toolchains/staging_dir_mips/bin
> And did you choose the correct endianess? Aka CPU_TARGET=mipsel or 
> CPU_TARGET=mipseb?
>
> Maybe you could try to fiddle around with the arguments passed to 
> mips-linux-as by hand. This means take the command below and try to 
> get the prt0.as file to assemble:
>
> /home/dennis/toolchains/staging_dir_mips/bin/mips-linux-as -32 -mips32 
> -EB -o /home/dennis/fpc/2.7.1/rtl/units/mips-linux/prt0.o mips/prt0.as
>
> (current directory should be /home/dennis/fpc/2.7.1/rtl/linux )
>
> Regards,
> Sven
>



More information about the fpc-pascal mailing list