English Amiga Board


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

 
 
Thread Tools
Old 09 January 2015, 14:52   #1
arti
Registered User
 
Join Date: Jul 2008
Location: Poland
Posts: 662
New 68k gcc toolchain

Hi!

Finally new gcc 4.5.4 + clib2 linux for 68k target!

I've just built hhexen-1.6.3 using it!

Ixemul and libnix build was quiting itself to workbench.
So now we have third option

You can grab it here:

http://ci.netsurf-browser.org/builds...hains/?C=M;O=D

I 'molested' netsurf devs to make it
arti is offline  
Old 09 January 2015, 20:05   #2
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,754
How good is the code it produces?
Thorham is offline  
Old 09 January 2015, 20:13   #3
arti
Registered User
 
Join Date: Jul 2008
Location: Poland
Posts: 662
I don't know.
I could compile some test program to check.
arti is offline  
Old 11 January 2015, 15:55   #4
flype
Registered User
 
Join Date: Dec 2014
Location: France
Posts: 104
Hi, it is good news, thank you.
I can see there is an update today.
http://ci.netsurf-browser.org/builds...4-01-36.tar.xz

Is it usable with ADE ?
http://aminet.net/package/dev/gcc/ADE
flype is offline  
Old 20 January 2015, 10:38   #5
utri007
mä vaan
 
Join Date: Nov 2001
Location: Finland
Posts: 1,653
Netsurf

Chris has fixed toolchain and Netsurf and all depencies builds now. Compiled Netsurf exe even starts now but crash before it opens window


Quote:
I've also spent quite a while fixing all the compiler and linker errors for the OS4 build, when passed through the 68k toolchain. It now builds and runs (don't get too excited) as far as errorneously displaying the splash window as a long thin window at the top of the screen. It then crashes, probably somewhere between initialising the DataTypes handler and initialising NetSurf.
68k source with changes are here http://git.netsurf-browser.org

He is asking help to fix remaining bugs, so NOTE: This would be officially supported build, unlike current SDL + Framebuffer Netsurf.

More about Chris's effort to get proper Netsurf for 68k Amigas here :

http://www.amiga.org/forums/showthre...t=63990&page=9
utri007 is offline  
Old 20 January 2015, 10:42   #6
alexh
Thalion Webshrine
 
alexh's Avatar
 
Join Date: Jan 2004
Location: Oxford
Posts: 14,343
http://www.amiga.org/forums/showthre...t=63990&page=9
alexh is offline  
Old 30 January 2015, 21:36   #7
utri007
mä vaan
 
Join Date: Nov 2001
Location: Finland
Posts: 1,653
About Netsurf : http://www.amiga.org/forums/showthre...=63990&page=17

Quote:

The font scanner appears to be working but freezes at the end, I suspect it's another NULL pointer access. Actually I'm suspecting I've done something wrong with my list access loops, which are defined like this:


Code:
node = GetHead(list);
do {
nnode = GetSucc(node);
// more code here
} while((node = nnode));This works fine on OS4, but when built for OS3 I think it's not stopping properly

GetSucc(node) is defined as node ? node->ln_Succ : NULL
It was just node->ln_Succ but I put some extra armour around it. It doesn't seem to have helped though.

GetHead is:

Code:
struct Node *GetHead(struct List *list)
{
struct Node *res = NULL;

if ((NULL != list) && (NULL != list->lh_Head->ln_Succ))
{
res = list->lh_Head;
}
return res;
}Can anybody spot anything obviously wrong?

Other than that, see if the previous two hits were fixed. You can trick it into skipping the font scan by creating a file in your user directory called FontGlyphCache, containing:
0x0000 "CGTimes"
utri007 is offline  
Old 17 July 2015, 23:13   #8
alkis
Registered User
 
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
Umm, isn't GetHead returning a null when there is just one element in the list?
alkis is offline  
Old 21 July 2015, 10:41   #9
Alexco
Registered User
 
Join Date: Jun 2008
Location: outer space
Posts: 60
May I ask why version 4.5 and not the latest 4.x? Just curious. And on which distribution does this work?
Alexco is offline  
Old 24 July 2015, 23:23   #10
arti
Registered User
 
Join Date: Jul 2008
Location: Poland
Posts: 662
Maybe it was easier to patch? I don't know, you better ask Chris Young.
Anyway it is now downgraded to 3.4 for better 68k code.

I tested on Ubuntu and debian.
arti is offline  
Old 25 July 2015, 01:57   #11
matthey
Banned
 
Join Date: Jan 2010
Location: Kansas
Posts: 1,284
Quote:
Originally Posted by alkis View Post
Umm, isn't GetHead returning a null when there is just one element in the list?
I don't think so. Exec lists are a little different than most doubly linked lists. From page 494 of the RKRM Libraries, the following 2 ways are suggested for determining if a list is empty.

1)
Code:
if (NULL != list->lh_Head->ln_Succ)
   printf("list is empty\n");
2)
Code:
if (list->lh_TailPred == (struct Node *)list)
   printf("list is empty\n");
Neither is very pretty. Not mentioned is a macro in exec/lists.h includes which uses the 2nd method above (probably the more optimal method with most compilers) but looks better IMO.

Code:
if (IsListEmpty(list))
   printf("list is empty\n");
Substituting with the macro, we come up with the following.

Code:
struct Node *GetHead(struct List *list)
{
	struct Node *res = NULL;

	if ((NULL != list) && (!IsListEmpty(list))
	{
		res = list->lh_Head;
	}
	return res;
}
Does that look better and correct? If we know the list is at least properly initialized, the (NULL != list) can be dropped also.

Quote:
Originally Posted by arti View Post
Maybe it was easier to patch? I don't know, you better ask Chris Young.
Anyway it is now downgraded to 3.4 for better 68k code.
I thought I was using GCC 3.4 for a long time but it was only GCC 3.3 because of an install problem. When I fixed my install so I was using GCC 3.4, the executables were noticeably larger and the compiler noticeably slower. GCC 3.3 had a few bugs but it was usable for my smaller projects. It was pretty close overall to GCC 2.95.3 in 68k code generation.

Quote:
Originally Posted by arti View Post
Is it possible to use vbcc math .lib in gcc ?
It would not be easy. GCC uses its own static link library format. I believe vbcc uses a format similar to what SAS/C used. A static or dynamic library could be created with the vbcc vclib math library code using different names. For example, the C= mathieeexxx.library math libraries can be called from GCC even if there is not a compiler option to use them implicitly. The C= libraries do not provide a complete c99 implementation though. It may be easier to fix up vbcc's integer code generation. The basic vbcc integer code generation is not bad just too simple. NetSurf is only written in C (no C++) but does require c99 in recent versions. Vbcc received some c99 updates including c99 include files like inttypes.h (Frank Wille should be able to send you updates). Have you tried to compile NetSurf with vbcc? If so, what was lacking?
matthey is offline  
Old 25 July 2015, 19:35   #12
arti
Registered User
 
Join Date: Jul 2008
Location: Poland
Posts: 662
Quote:
Originally Posted by matthey View Post
Have you tried to compile NetSurf with vbcc? If so, what was lacking?
Not yet, but I imagine it would be too much work.
Just got NetSurf working with libnix. It works better than clib2, no problem with events and slowdown after loading 4th page.
It is only lacking %zd, %llu in printf functions.
Maybe it can be enabled like in clib2 by putting -lc before -lm ?

Do you know this?
arti is offline  
Old 25 July 2015, 21:01   #13
matthey
Banned
 
Join Date: Jan 2010
Location: Kansas
Posts: 1,284
Quote:
Originally Posted by arti View Post
Not yet, but I imagine it would be too much work.
Just got NetSurf working with libnix. It works better than clib2, no problem with events and slowdown after loading 4th page.
It is only lacking %zd, %llu in printf functions.
Maybe it can be enabled like in clib2 by putting -lc before -lm ?

Do you know this?
Libnix is very well written but it is old and not updated. Long long (64 bit integers) were not at all common back in the day. GCC supported them before they became standard in C so maybe libnix didn't fully support them? I don't see any mention in the libnix.guide but I would have expected %llu to be supported. The %zd is C99 which I believe came after libnix.

It looks like vbcc should support %zd and %llu from looking at the vclib vfprintf() source. Vbcc does *not* currently support the uncommon C99 floating point %a hex notation. Vbcc is strict for whatever version of C is selected and will often generate many warnings and errors by default. GCC uses its own non-conforming sloppy version of C by default and is quiet about many warnings and errors. The sloppiness of GCC is less overwhelming for porting projects but vbcc has its advantages of making sure the code is more C compliant and portable. They are different beasts and vbcc has its own learning curve.
matthey is offline  
Old 26 July 2015, 21:07   #14
arti
Registered User
 
Join Date: Jul 2008
Location: Poland
Posts: 662
Libnix was updated to version 3.0 by Diego Casorran.
https://github.com/diegocr/libnix

Does any of this flags make anything better?
-D__USE_BASETYPE__ -D__USE_INLINE__ -U__STRICT_ANSI__ -DSTMATH
arti is offline  
Old 27 July 2015, 20:06   #15
matthey
Banned
 
Join Date: Jan 2010
Location: Kansas
Posts: 1,284
Quote:
Originally Posted by arti View Post
Libnix was updated to version 3.0 by Diego Casorran.
https://github.com/diegocr/libnix
I didn't know libnix was updated. Thanks for the link.

Looking at libnix/stdio/vfprintf.c (used by printf), I don't see any support of %zd or 64 bit integers. I doubt changing switches or variables will solve this. Have you tried contacting Diego Casorran with your questions and needs?
matthey is offline  
Old 28 July 2015, 14:14   #16
arti
Registered User
 
Join Date: Jul 2008
Location: Poland
Posts: 662
Yes, he didn't answer, but I managed to compile libnix myself so I can now add anything I need.

Last edited by arti; 29 July 2015 at 13:17.
arti is offline  
Old 29 July 2015, 13:17   #17
arti
Registered User
 
Join Date: Jul 2008
Location: Poland
Posts: 662
Looks like libnix version is working fast and stable.
It could be faster with some asm optimisations.
@matthey are you interested ?
arti is offline  
Old 31 July 2015, 03:59   #18
matthey
Banned
 
Join Date: Jan 2010
Location: Kansas
Posts: 1,284
Quote:
Originally Posted by arti View Post
Yes, he didn't answer, but I managed to compile libnix myself so I can now add anything I need.
It is good that you can compile the project but it would be better to have someone familiar with the code cooperating.

Quote:
Originally Posted by arti View Post
Looks like libnix version is working fast and stable.
It could be faster with some asm optimisations.
@matthey are you interested ?
The assembler code in libnix/math/mul64.c is already from me. Assembler inlines for libnix/misc/bcopy.c and libnix/misc/bzero.c could be advantageous. Most of the code should probably remain in C (some of it needs updating for 64 bit integer support) although some C optimizations are still possible.

It looks like the glibc (GNU library) source for vfprintf.c has changed significantly.

https://fossies.org/dox/glibc-2.21/v...8c_source.html

The source code of the new version of vfprintf() is huge. You could try adapting it for libnix but I wouldn't be surprised if resulting executables are also significantly larger. Maybe an older version of vfprintf() could be found that has 64 bit integer support but before the rewrite. The vbcc vclib source is similar to the old vfprintf() but has support for %llu and %zd. The libnix source has the following line.

Code:
if (*ptr=='h' || *ptr=='l' || *ptr=='L')
While the similar vclib code has the following.

Code:
if (*ptr=='h' || *ptr=='l' || *ptr=='L' || *ptr=='j' || *ptr=='z' || *ptr== 't')
It may not be too difficult to adapt the vclib vfprintf() for what you need. Of course, vfscanf() and others should be updated for consistency. What seems like small changes can end up being a lot of work. This kind of work needs to be organized and documented so problems can be rolled back and so the whole project doesn't become a mess.
matthey is offline  
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
gcc .lib mritter0 Coders. C/C++ 13 27 October 2018 02:13
Issue with photon/xxxx WinUAE Toolchain arpz Coders. Asm / Hardware 2 26 September 2015 22:33
gcc linker mritter0 Coders. C/C++ 3 21 December 2014 16:54
Building 68k C++ using gcc and an IDE! NovaCoder Coders. General 25 17 May 2010 02:19
latest GCC compiler 68k Tony Landais Coders. General 27 23 November 2006 01:02

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 18:12.

Top

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