English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 10 February 2018, 18:10   #761
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
Right, only function calls can use PC-relative jumps + extra absolute jump if needed. I would have been quite difficult to do with LEAs

Very tiny observation:

Long word array offset calculation use 2x add.l dn,dn. I think -Os should use shorter lsl.l #2,d0.
Toni Wilen is offline  
Old 10 February 2018, 23:57   #762
bebbo
bye
 
Join Date: Jun 2016
Location: Some / Where
Posts: 680
Quote:
Originally Posted by Toni Wilen View Post
Right, only function calls can use PC-relative jumps + extra absolute jump if needed. I would have been quite difficult to do with LEAs
you can use -mpcrel on some source files and if ordered correctly it will work.

Quote:
Originally Posted by Toni Wilen View Post
Very tiny observation:

Long word array offset calculation use 2x add.l dn,dn. I think -Os should use shorter lsl.l #2,d0.
I think, I can live with add add.
bebbo is offline  
Old 12 February 2018, 21:52   #763
wawa
Registered User
 
Join Date: Aug 2007
Location: berlin/germany
Posts: 1,054
bebbo, dont want to derail your thread any further, just wanted to ask if you could point me to where, if you hat manually enable relative addressing in gcc. like when specifying an offset to address register content here:
bset.b #0,4(a1)
thats what aros gcc seems not to understand.
my thread is here:
http://eab.abime.net/showthread.php?...54#post1219154
wawa is offline  
Old 02 March 2018, 13:00   #764
bebbo
bye
 
Join Date: Jun 2016
Location: Some / Where
Posts: 680
Quote:
Originally Posted by Toni Wilen View Post
Long word array offset calculation use 2x add.l dn,dn. I think -Os should use shorter lsl.l #2,d0.
All modes should use lsl.l #2,d0 (12 cycles) instead of 2x add.l dn,dn (2x8cycles).

=> Done
bebbo is offline  
Old 07 March 2018, 22:46   #765
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,545
i try to build lhasa/lha.exe using -mcrt=clib2 -m68000
same with: -mcrt=clib2 -m68020-40 -msoft-float
and get the linker message:
Code:
lha-list.o(.text+0x63a): undefined reference to `__mulsf3'
lha-list.o(.text+0x654): undefined reference to `__divsf3'
are these missing?

if so, I found something which may help:
Code:
To get gcc to build a floating point library, I think you need to change
the line

softfp_float_modes := tf

in the file gcc/config/i386/t-fprules-softfp to be

softfp_float_modes := sf df tf

I don't know if that will suffice but as far as I can see it is a
necessary step.
#1) it does build using: -mcrt=clib2 -m68020-40 -m68881
so something is missing in the softfloat math lib

Last edited by emufan; 07 March 2018 at 23:03.
emufan is offline  
Old 08 March 2018, 12:08   #766
bebbo
bye
 
Join Date: Jun 2016
Location: Some / Where
Posts: 680
Quote:
Originally Posted by emufan View Post
i try to build lhasa/lha.exe using -mcrt=clib2 -m68000
same with: -mcrt=clib2 -m68020-40 -msoft-float
and get the linker message:
Code:
lha-list.o(.text+0x63a): undefined reference to `__mulsf3'
lha-list.o(.text+0x654): undefined reference to `__divsf3'
are these missing?

if so, I found something which may help:
Code:
To get gcc to build a floating point library, I think you need to change
the line

softfp_float_modes := tf

in the file gcc/config/i386/t-fprules-softfp to be

softfp_float_modes := sf df tf

I don't know if that will suffice but as far as I can see it is a
necessary step.
#1) it does build using: -mcrt=clib2 -m68020-40 -m68881
so something is missing in the softfloat math lib
please add -lm
bebbo is offline  
Old 08 March 2018, 12:45   #767
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,545
Quote:
Originally Posted by bebbo View Post
please add -lm
seriously? I refused to do so, since I could not imagine it's again that simple

#1) of course you are right
Code:
 CFLAGS="-mcrt=clib2 -m68000" LDFLAGS="-lm" ./configure ...
#2) but can you shed some light on the way described in my quote from the gnu website?
is this the way to configure the toolchain build, so it does build softfloat libs?

Last edited by emufan; 08 March 2018 at 13:00.
emufan is offline  
Old 08 March 2018, 13:24   #768
bebbo
bye
 
Join Date: Jun 2016
Location: Some / Where
Posts: 680
Quote:
Originally Posted by emufan View Post
seriously? I refused to do so, since I could not imagine it's again that simple

#1) of course you are right
Code:
 CFLAGS="-mcrt=clib2 -m68000" LDFLAGS="-lm" ./configure ...
good to hear!

Quote:
Originally Posted by emufan View Post
#2) but can you shed some light on the way described in my quote from the gnu website?
is this the way to configure the toolchain build, so it does build softfloat libs?
You were referring to the configuration for i386. If you plan to create code for an old cpu like 8086, then you would need code for single and double float.

The configuration for i386 does not affect what's build for the m68k line.

AFAIK the libraries (clib2, libnix) are providing a math lib using the Amiga math libraries. Thus you need -lm for float/double math operations. (And you also need -lm for printing float/double with libnix)

Last edited by bebbo; 08 March 2018 at 15:08.
bebbo is offline  
Old 08 March 2018, 14:23   #769
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,545
Quote:
The configuration for i386 does not affect what's build for the m68k line.
c'mon. :/
of course I saw the i386. it was more a question,
regarding the way those things are build generally.

but thanks for info.
emufan is offline  
Old 08 March 2018, 15:05   #770
bebbo
bye
 
Join Date: Jun 2016
Location: Some / Where
Posts: 680
Quote:
Originally Posted by emufan View Post
c'mon. :/
of course I saw the i386. it was more a question,
regarding the way those things are build generally.

but thanks for info.
I think config.host is the right location where soft floating point stuff is enabled:
Code:
m68k-*-amiga*)
    tmake_file="$tmake_file m68k/t-glue m68k/t-floatlib soft-fp"
bebbo is offline  
Old 08 March 2018, 15:45   #771
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,545
Quote:
Originally Posted by bebbo View Post
I think config.host is the right location where soft floating point stuff is enabled:
Code:
m68k-*-amiga*)
    tmake_file="$tmake_file m68k/t-glue m68k/t-floatlib soft-fp"
ok, thanks
emufan is offline  
Old 14 March 2018, 23:40   #772
Fook42
Registered User
 
Join Date: Aug 2016
Location: germany
Posts: 67
build -problem

hello,
i'm on the latest from the git-repo
(commitid: bee61d81df17239be5e158b4264a7470358824cb)
but the build using "toolchain-m68k" fails:

Code:
...
INFO: extract files from ".build-m68k/archives/ira.lha"
DEBUG: makedir ".build-m68k/tmp/tmp2SPBmK/ira"
DEBUG: extract "ira/amiga_hunks.c"
DEBUG: extract "ira/amiga_hunks.h"
DEBUG: extract "ira/atari.c"
DEBUG: extract "ira/atari.h"
DEBUG: extract "ira/binary.c"
DEBUG: extract "ira/binary.h"
DEBUG: extract "ira/config.c"
DEBUG: extract "ira/config.h"
DEBUG: extract "ira/constants.c"
DEBUG: extract "ira/constants.h"
DEBUG: extract "ira/elf.c"
DEBUG: extract "ira/elf.h"
DEBUG: extract "ira/init.c"
DEBUG: extract "ira/init.h"
DEBUG: extract "ira/ira.c"
DEBUG: extract "ira/ira.doc"
DEBUG: extract "ira/ira.exe"
DEBUG: extract "ira/ira.h"
DEBUG: extract "ira/ira.readme"
DEBUG: extract "ira/ira2.doc"
DEBUG: extract "ira/ira_2.c"
DEBUG: extract "ira/ira_2.h"
DEBUG: extract "ira/ira_68k"
DEBUG: extract "ira/ira_config.doc"
DEBUG: extract "ira/ira_mos"
DEBUG: extract "ira/ira_os4"
DEBUG: extract "ira/make.rules"
DEBUG: extract "ira/Makefile"
DEBUG: extract "ira/Makefile.mos"
DEBUG: extract "ira/Makefile.os3"
DEBUG: extract "ira/Makefile.os4"
DEBUG: extract "ira/Makefile.osx"
DEBUG: extract "ira/Makefile.win32"
DEBUG: extract "ira/megadrive.c"
DEBUG: extract "ira/megadrive.h"
DEBUG: makedir ".build-m68k/tmp/tmp2SPBmK/ira/obj"
DEBUG: extract "ira/obj/.dummy"
DEBUG: extract "ira/opcode.c"
DEBUG: extract "ira/opcode.h"
DEBUG: extract "ira/supp.c"
DEBUG: extract "ira/supp.h"
DEBUG: copytree ".build-m68k/tmp/tmp2SPBmK" to ".build-m68k/build/ira"
DEBUG: makedir ".build-m68k/build/ira"
DEBUG: makedir ".build-m68k/build/ira/ira"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/Makefile" to ".build-m68k/build/ira/ira/Makefile"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/Makefile.mos" to ".build-m68k/build/ira/ira/Makefile.mos"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/Makefile.os3" to ".build-m68k/build/ira/ira/Makefile.os3"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/Makefile.os4" to ".build-m68k/build/ira/ira/Makefile.os4"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/Makefile.osx" to ".build-m68k/build/ira/ira/Makefile.osx"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/Makefile.win32" to ".build-m68k/build/ira/ira/Makefile.win32"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/amiga_hunks.c" to ".build-m68k/build/ira/ira/amiga_hunks.c"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/amiga_hunks.h" to ".build-m68k/build/ira/ira/amiga_hunks.h"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/atari.c" to ".build-m68k/build/ira/ira/atari.c"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/atari.h" to ".build-m68k/build/ira/ira/atari.h"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/binary.c" to ".build-m68k/build/ira/ira/binary.c"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/binary.h" to ".build-m68k/build/ira/ira/binary.h"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/config.c" to ".build-m68k/build/ira/ira/config.c"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/config.h" to ".build-m68k/build/ira/ira/config.h"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/constants.c" to ".build-m68k/build/ira/ira/constants.c"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/constants.h" to ".build-m68k/build/ira/ira/constants.h"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/elf.c" to ".build-m68k/build/ira/ira/elf.c"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/elf.h" to ".build-m68k/build/ira/ira/elf.h"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/init.c" to ".build-m68k/build/ira/ira/init.c"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/init.h" to ".build-m68k/build/ira/ira/init.h"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/ira.c" to ".build-m68k/build/ira/ira/ira.c"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/ira.doc" to ".build-m68k/build/ira/ira/ira.doc"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/ira.exe" to ".build-m68k/build/ira/ira/ira.exe"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/ira.h" to ".build-m68k/build/ira/ira/ira.h"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/ira.readme" to ".build-m68k/build/ira/ira/ira.readme"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/ira2.doc" to ".build-m68k/build/ira/ira/ira2.doc"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/ira_2.c" to ".build-m68k/build/ira/ira/ira_2.c"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/ira_2.h" to ".build-m68k/build/ira/ira/ira_2.h"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/ira_68k" to ".build-m68k/build/ira/ira/ira_68k"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/ira_config.doc" to ".build-m68k/build/ira/ira/ira_config.doc"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/ira_mos" to ".build-m68k/build/ira/ira/ira_mos"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/ira_os4" to ".build-m68k/build/ira/ira/ira_os4"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/make.rules" to ".build-m68k/build/ira/ira/make.rules"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/megadrive.c" to ".build-m68k/build/ira/ira/megadrive.c"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/megadrive.h" to ".build-m68k/build/ira/ira/megadrive.h"
DEBUG: makedir ".build-m68k/build/ira/ira/obj"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/obj/.dummy" to ".build-m68k/build/ira/ira/obj/.dummy"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/opcode.c" to ".build-m68k/build/ira/ira/opcode.c"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/opcode.h" to ".build-m68k/build/ira/ira/opcode.h"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/supp.c" to ".build-m68k/build/ira/ira/supp.c"
DEBUG: copy ".build-m68k/tmp/tmp2SPBmK/ira/supp.h" to ".build-m68k/build/ira/ira/supp.h"
DEBUG: rmtree ".build-m68k/tmp/tmp2SPBmK"
DEBUG: enter directory ".build-m68k/build"
DEBUG: execute "patch -t -p0 -i /home/renef/AMIGA/new/amigaos-cross-toolchain/patches/ira/Makefile.diff"
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- ira/Makefile       2015-09-11 09:25:13.000000000 +0200
|+++ ira/Makefile       2015-09-11 09:21:37.000000000 +0200
--------------------------
No file to patch.  Skipping patch.
1 out of 1 hunk ignored
ERROR: command "patch -t -p0 -i /home/renef/AMIGA/new/amigaos-cross-toolchain/patches/ira/Makefile.diff" failed with 1
the ira-files (including the missing ira/Makefile) are here .build-m68k/build/ira/ira/ .. instead of .build-m68k/build/ira/ ...

how can we fix this?
just moving the files from the ira/ira/-directory to ira/ is not working completely (several other patches fail)
Fook42 is offline  
Old 15 March 2018, 00:28   #773
Marlon_
AmigaDev.com
 
Marlon_'s Avatar
 
Join Date: Mar 2016
Location: Stockholm, Sweden
Age: 35
Posts: 625
Use this repo instead: https://github.com/bebbo/amiga-gcc
Marlon_ is offline  
Old 27 March 2018, 17:56   #774
alkis
Registered User
 
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
So, I have a small project (like the command "ls" in linux) and uses nostartup and thus it has a custom startup in assembly.

The exe size is at ~19k, and if I add -fbaserel -msmall-code goes at ~15k. Impressive and all but....what is the inner workings for a4?

I probably have to provide a "geta4()" in my startup, right? (and also call it at start, to set it once)
But to what value should I set it to? Does linker expose a symbol for that purpose when -fbaserel is used?
alkis is offline  
Old 27 March 2018, 18:24   #775
Amiga1992
Registered User
 
Join Date: May 2001
Location: ?
Posts: 19,645
OK so let's say (because it's true :P) that I am a n00b, but I know C, and want to try this out.

What is exactly all I need to be able to code on my modern (PC/Win) computer and make binaries for Amiga? Is it just this? > https://github.com/bebbo/amigaos-cross-toolchain
Do I need an Amiga, emulated or not, at all for this? (ideally no).
Amiga1992 is offline  
Old 27 March 2018, 18:26   #776
Samurai_Crow
Total Chaos forever!
 
Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,186
Quote:
Originally Posted by Akira View Post
OK so let's say (because it's true :P) that I am a n00b, but I know C, and want to try this out.

What is exactly all I need to be able to code on my modern (PC/Win) computer and make binaries for Amiga? Is it just this? > https://github.com/bebbo/amigaos-cross-toolchain
Do I need an Amiga, emulated or not, at all for this? (ideally no).
That repo is frozen in favor of the link in Marlon_'s post.
Samurai_Crow is offline  
Old 27 March 2018, 18:29   #777
Amiga1992
Registered User
 
Join Date: May 2001
Location: ?
Posts: 19,645
Quote:
Originally Posted by Samurai_Crow View Post
That repo is frozen in favor of the link in Marlon_'s post.
OK I see, and these are tools that run in a PC right?
But not in Windows?
Also: Is there any tutorial to get started?
Amiga1992 is offline  
Old 27 March 2018, 18:30   #778
Samurai_Crow
Total Chaos forever!
 
Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,186
Quote:
Originally Posted by Akira View Post
OK I see, and these are tools that run in a PC right?
But not in Windows?
Also: Is there any tutorial to get started?
PC, Mac or Linux. Preferably Mac or Linux.
Samurai_Crow is offline  
Old 27 March 2018, 18:32   #779
alkis
Registered User
 
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
Quote:
Originally Posted by Akira View Post
OK so let's say (because it's true :P) that I am a n00b, but I know C, and want to try this out.

What is exactly all I need to be able to code on my modern (PC/Win) computer and make binaries for Amiga? Is it just this? > https://github.com/bebbo/amigaos-cross-toolchain
Do I need an Amiga, emulated or not, at all for this? (ideally no).
that repository is frozen.

Now, you should use https://github.com/bebbo/amiga-gcc

Someone with windows experience should tackle this, but if you were in linux you would do:
git pull https://github.com/bebbo/amiga-gcc
cd amiga-gcc
export PREFIX=/home/username/gcc6
make update
make all -j8
alkis is offline  
Old 27 March 2018, 18:59   #780
Amiga1992
Registered User
 
Join Date: May 2001
Location: ?
Posts: 19,645
It's just that my only Linux machines are Raspberry Pis. I don't want to run Linux on my Windows PC, although I usually have a virtual machine ready for special cases.
Amiga1992 is offline  
 


Currently Active Users Viewing This Thread: 3 (0 members and 3 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
New GCC based dev toolchain for AmigaOS 3.x cla Coders. Releases 8 24 December 2017 10:18
Issue with photon/xxxx WinUAE Toolchain arpz Coders. Asm / Hardware 2 26 September 2015 22:33
New 68k gcc toolchain arti Coders. C/C++ 17 31 July 2015 03:59
Hannibal's WinUAE Demo Toolchain 5 Bobic Amiga scene 1 23 July 2015 21:04
From gcc to vbcc. Cowcat Coders. General 9 06 June 2014 14:45

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 17:24.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.20867 seconds with 16 queries