Sunday, 3 June 2012

[gccsdk] Nettle autobuilder patch

Index: network/nettle/Run.p
===================================================================
--- network/nettle/Run.p (revision 5848)
+++ network/nettle/Run.p (working copy)
@@ -12,39 +12,3 @@
-WimpSlot -min 256K -max 256K
+WimpSlot -min 1600K -max 1600K
Run <Nettle$Dir>.!RunImage %*0 ><Nettle$Dir>.stdout 2><Nettle$Dir>.stderr
-Index: c/sockwatch
-===================================================================
-RCS file: /cvsroot/nettle/nettle/c/sockwatch,v
-retrieving revision 1.8
-diff -u -r1.8 sockwatch
---- c/sockwatch 29 Aug 2010 19:45:29 -0000 1.8
-+++ c/sockwatch 31 May 2012 23:23:29 -0000
-@@ -19,7 +19,9 @@
- #include "sys/types.h"
- #include "sys/ioctl.h"
- #include "sys/socket.h"
--#ifndef __UNIXLIB_TYPES_H
-+#ifdef __UNIXLIB_TYPES_H
-+#include <unixlib/local.h>
-+#else
- #include "socklib.h"
- #include "sys/filio.h"
- #endif
-@@ -53,7 +55,7 @@
-
- #ifdef __UNIXLIB_TYPES_H
- /* get the underlying RISC OS socket handle from the Unixlib socket */
-- socket = __unixlib_getdev(socket);
-+ socket = __get_ro_socket(socket);
- #endif
-
- if ( newinternet )
-@@ -78,7 +80,7 @@
- return;
-
- #ifdef __UNIXLIB_TYPES_H
-- socket = __unixlib_getdev(socket);
-+ socket = __get_ro_socket(socket);
- #endif
-
- if ( newinternet )
Index: network/nettle/sockwatch.p
===================================================================
--- network/nettle/sockwatch.p (revision 5848)
+++ network/nettle/sockwatch.p (working copy)
@@ -1,36 +0,0 @@
-Index: c/sockwatch
-===================================================================
-RCS file: /cvsroot/nettle/nettle/c/sockwatch,v
-retrieving revision 1.8
-diff -u -r1.8 sockwatch
---- c/sockwatch 29 Aug 2010 19:45:29 -0000 1.8
-+++ c/sockwatch 31 May 2012 23:23:29 -0000
-@@ -19,7 +19,9 @@
- #include "sys/types.h"
- #include "sys/ioctl.h"
- #include "sys/socket.h"
--#ifndef __UNIXLIB_TYPES_H
-+#ifdef __UNIXLIB_TYPES_H
-+#include <unixlib/local.h>
-+#else
- #include "socklib.h"
- #include "sys/filio.h"
- #endif
-@@ -53,7 +55,7 @@
-
- #ifdef __UNIXLIB_TYPES_H
- /* get the underlying RISC OS socket handle from the Unixlib socket */
-- socket = __unixlib_getdev(socket);
-+ socket = __get_ro_socket(socket);
- #endif
-
- if ( newinternet )
-@@ -78,7 +80,7 @@
- return;
-
- #ifdef __UNIXLIB_TYPES_H
-- socket = __unixlib_getdev(socket);
-+ socket = __get_ro_socket(socket);
- #endif
-
- if ( newinternet )
Index: network/nettle/GNUmakefile.p
===================================================================
--- network/nettle/GNUmakefile.p (revision 5848)
+++ network/nettle/GNUmakefile.p (working copy)
@@ -1,40 +1,32 @@
Index: GNUmakefile
===================================================================
RCS file: /cvsroot/nettle/nettle/GNUmakefile,v
-retrieving revision 1.2
-diff -u -r1.2 GNUmakefile
---- GNUmakefile 21 Sep 2010 17:46:13 -0000 1.2
-+++ GNUmakefile 1 Jun 2012 09:44:00 -0000
-@@ -2,11 +2,11 @@
+retrieving revision 1.3
+diff -u -r1.3 GNUmakefile
+--- GNUmakefile 2 Jun 2012 17:20:34 -0000 1.3
++++ GNUmakefile 3 Jun 2012 12:24:11 -0000
+@@ -2,12 +2,12 @@
# Makefile for cross-compiling Nettle
#

--CC = /home/riscos/cross/bin/arm-unknown-riscos-gcc
--CFLAGS = -c -std=c9x -Wall -mpoke-function-name -I/home/riscos/env/include
+-CC = /home/riscos/gccsdk/cross/bin/arm-unknown-riscos-gcc
+CC = gcc
-+CFLAGS = -c -std=c9x -Wall -mpoke-function-name
+ NATIVE_CC = /usr/bin/gcc
+-CFLAGS = -c -D_BSD_SOURCE -std=c9x -Wall -mpoke-function-name -I/home/riscos/gccsdk/env/include
++CFLAGS = -c -D_BSD_SOURCE -std=c9x -Wall -mpoke-function-name
CONFIG = -DWITH_SSH

--LIBS = -L/home/riscos/env/lib -lssh2 -lgcrypt -lgpg-error
+-LIBS = -L/home/riscos/gccsdk/env/lib -lssh2 -lgcrypt -lgpg-error -lcrypto
+LIBS = -lssh2 -lgcrypt -lgpg-error -lcrypto
OBJS = chardefn.o choices.o dnslib.o globals.o init.o keyboard.o lineedit.o \
main.o misc.o hotlist.o nettle.o process.o socket.o quit.o seln.o \
wimp.o zapgen.o fortify.o sockwatch.o messages.o termlist.o url.o \
-@@ -23,7 +23,7 @@
+@@ -24,7 +24,7 @@

- !Nettle/!RunImage,ff8: RunImage,e1f
+ !Nettle/!RunImage,ff8: !Nettle/!RunImage,e1f
@echo " ELF2AIF:" $@
-- @/home/riscos/cross/bin/elf2aif $< $@
+- @/home/riscos/gccsdk/cross/bin/elf2aif $< $@
+ @elf2aif $< $@
+ @rm !Nettle/!RunImage,e1f

- RunImage,e1f: $(OBJS)
- @echo " LINK:" $@
-@@ -37,7 +37,7 @@
-
- # intentionally compiled using native compiler
- templheadr: templheadr.c
-- gcc -o $@ $(LINKFLAGS) $?
-+ /usr/bin/gcc -o $@ $(LINKFLAGS) $?
-
- templ.h: templheadr $(TEMPLATES)
- ./templheadr $(TEMPLATES) $@
+ !Nettle/!RunImage,e1f: $(OBJS)
I've attached a patch for the nettle autobuilder, having firtled with
the source upstream a bit :)

I couldn't work out how to make it create a package (I just got random
errors about Nettle not being found and things), so I gave up :)

Alex.

Saturday, 2 June 2012

Re: [gccsdk] AsAsm conditional assembly directives bug?

On Sat, Jun 02, 2012 at 12:11:38PM +0000, John Tytgat wrote:
> Yes, in Acorn/objasm and ARM Ltd's assembler documentation, only ":LNOT:"
> (with 2nd column) is mentioned, not ":LNOT". I know ":LNOT" gets accepted
> by objasm and to me it looks like a bug and decided not implement this.
> There were several similar instances in Castle's RO sources which all got
> corrected when AsAsm was tested.

Fairy snuff.

As you might have worked out, I was trying to build the Raspberry Pi sources
with asasm, and ran into a few problems. That one is trivial to fix, but
came across a few more things:

asasm/targetcpu.c is somewhat odd. There's a list of architecture types
('5TEJ') and a list of CPU cores ('ARM968E-S'). You can supply either with
-cpu to asasm. If you supply a CPU core, it converts it to an architecture.
But if you supply an architecture, it looks for a CPU core that implements
it, then uses the given architecture. But this means asasm needs to be
kept up to date with every core. If I supply an arch of '6Z' (as the ROOL
build system does), the lookup falls over because it doesn't know a CPU
core that contains it. But why should it need to do this arch->CPU->arch
lookup at all?

objasm now has a {UAL} predicate. asasm seems to have support for UAL in 32
bit (non-Thumb) mode, but not the flag. The BCM2835 HAL has a tiny amount
of UAL code, and all of that has conditional assembly with non-UAL
alternatives available. So in this case defining {UAL} = FALSE would
probably suffice.

-fpu gives an error. This causes the ROOL build system to bail and revert
to CPU arch 5TEJ. I'm not sure the best way forward here, but perhaps not
exit(1) if -fpu is found (ie just report a warning, but continue anyway)
even if it doesn't actually do anything. Then ROOL's script won't think
that something bad happened and assume an out of date objasm.

So far I've got it to ROM linking stage, when it causes an internal error in
Norcroft C (probably I need the latest version). But looks like asasm only
needs a few tweaks to work.

You may be interested in my bounty suggestion for improving the situation:
https://www.riscosopen.org/forum/forums/8/topics/1069

Theo

_______________________________________________
GCCSDK mailing list gcc@gccsdk.riscos.info
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK

Re: [gccsdk] AsAsm conditional assembly directives bug?

On Sat, 02 Jun 2012 13:11:38 +0100, John Tytgat <John.Tytgat@aaug.net> wrote:
> Yes, in Acorn/objasm and ARM Ltd's assembler documentation, only ":LNOT:"
> (with 2nd column) is mentioned, not ":LNOT". I know ":LNOT" gets accepted by objasm and to me it looks like a bug and decided not
> implement this.

For what it's worth, I know it's strange, but in the sources to objasm, it
explicitly checks for either a colon or whitespace as the terminator of
"word-type" operators like that, so I think it was deliberate (albeit
undocumented).

Ben

_______________________________________________
GCCSDK mailing list gcc@gccsdk.riscos.info
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK

Re: [gccsdk] OSLib cross-build fail

In message <20120601101010.GE4665@chiark.greenend.org.uk>
Theo Markettos <theo@markettos.org.uk> wrote:

> [...]
> I can see why this is happening; in AOF mode DefMod2 is compiling a command
> line that includes 'gcc' but that's picking up the system gcc not the cross
> compiler. It appears the paths from ro-make aren't getting through - if I
> change the DefMod2 source to call arm-riscos-unknown-gcc instead, it can't
> find it.
>
> I don't fully understand how passing through path variables works... any
> suggestions?

The AOF version OSLib is supposed to be built with GCCSDK 3.4.x as this
is an AOF based release. The ELF version OSLib should be built with
GCCSDK 4.x. Cfr. !OSLib/!Readme.

It is true that with GCCSDK 4.x you now can use AsAsm to assemble the
DefMod2 generated assembler files to AOF object files but you will be
missing the AOF library creation tool and also will be unable to compile
the C sources to AOF object files (OSLibSupport).

John.
--
John Tytgat, in his comfy chair at home BASS
John.Tytgat@aaug.net ARM powered, RISC OS driven

_______________________________________________
GCCSDK mailing list gcc@gccsdk.riscos.info
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK

Re: [gccsdk] AsAsm conditional assembly directives bug?

In message <20120602101555.GH4665@chiark.greenend.org.uk>
Theo Markettos <theo@markettos.org.uk> wrote:

> If I assemble this with asasm, it doesn't like the conditional compilation:
>
> *asasm -aof -o o.Selection s.Selection
> hdr.Text2:2:10: Fatal error: Illegal expression
> called from line 4 from file s.Selection
> [ :LNOT :DEF: BCM2835_Hdr
> ----------^
>
> Yet objasm is fine:
>
> *objasm -o o.Selection s.Selection
> ARM AOF Macro Assembler 3.32 (Acorn Computers Ltd) [10 Feb 2005]
> *
>
> Any ideas what might be going wrong?

Yes, in Acorn/objasm and ARM Ltd's assembler documentation, only ":LNOT:"
(with 2nd column) is mentioned, not ":LNOT". I know ":LNOT" gets accepted
by objasm and to me it looks like a bug and decided not implement this.
There were several similar instances in Castle's RO sources which all got
corrected when AsAsm was tested.

John.
--
John Tytgat, in his comfy chair at home BASS
John.Tytgat@aaug.net ARM powered, RISC OS driven

_______________________________________________
GCCSDK mailing list gcc@gccsdk.riscos.info
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK

[gccsdk] AsAsm conditional assembly directives bug?

I've just been trying to assemble some code with asasm from GCC
4.1.2rel2dev. I have a file called s.Selection that contains this:

AREA |ARM$$code|, CODE, READONLY, PIC

GET hdr.Text2
END

and a file called hdr.Text2 containing this:

[ :LNOT :DEF: MyHdr
GBLL MyHdr

GBLL Debug
Debug SETL {TRUE}

]
END


If I assemble this with asasm, it doesn't like the conditional compilation:

*asasm -aof -o o.Selection s.Selection
hdr.Text2:2:10: Fatal error: Illegal expression
called from line 4 from file s.Selection
[ :LNOT :DEF: BCM2835_Hdr
----------^

Yet objasm is fine:

*objasm -o o.Selection s.Selection
ARM AOF Macro Assembler 3.32 (Acorn Computers Ltd) [10 Feb 2005]
*

Any ideas what might be going wrong?

Thanks
Theo

_______________________________________________
GCCSDK mailing list gcc@gccsdk.riscos.info
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK

Friday, 1 June 2012

Re: [gccsdk] OSLib cross-build fail

On Tue, Nov 29, 2011 at 01:02:08AM +0000, John Tytgat wrote:
[Build problems with OSLib]
> Yes, you're right, it is a bug in DefMod2 and gets triggered by binutils
> 2.21.1 (at gccsdk trunk we're now using binutils 2.22). I've commited
> a fix.

Hmm, I'm now trying to rebuild OSlib in AOF mode and having toolchain issues
in DefMod2 (today's SVN 5844):


/local/scratch/atm26/riscos/autobuilder/oslib/!OSLib/Source/../Bin/defmod -asmtype gccaof -h < CDFSFiler.swi > CDFSFiler.h
/local/scratch/atm26/riscos/autobuilder/oslib/!OSLib/Source/../Bin/defmod -asmtype gccaof -h < NetFiler.swi > NetFiler.h
/local/scratch/atm26/riscos/autobuilder/oslib/!OSLib/Source/../Bin/defmod -asmtype gccaof -l -o l/ADFS -byte_wide /local/scratch/atm26/riscos/autobuilder/oslib/!OSLib/Source/ByteWide -32bit < ADFS.swi
Warning: type "FileCore_DiscAddress" not defined in this module - assuming it's a word
Assembler messages:
Fatal error: invalid listing option `p'
Non-zero return code
gcc -mapcs-32 -c -xassembler -Wa,-objasm,-apcs32 -o l/ADFS/0x40240x.001.o l/ADFS/0x40240x.001.s
make[2]: *** [ADFS.o] Error 1
make[2]: Leaving directory `/local/scratch/atm26/riscos/autobuilder/oslib/!OSLib/Source/Computer/oslib'
make[1]: *** [/local/scratch/atm26/riscos/autobuilder/oslib/!OSLib/Source/../Build/OSLib32.o] Error 2
make[1]: Leaving directory `/local/scratch/atm26/riscos/autobuilder/oslib/!OSLib/Source'
make: *** [oslib-aof] Error 2
Package oslib: ***Failure***
Build for package "oslib" failed


I can see why this is happening; in AOF mode DefMod2 is compiling a command
line that includes 'gcc' but that's picking up the system gcc not the cross
compiler. It appears the paths from ro-make aren't getting through - if I
change the DefMod2 source to call arm-riscos-unknown-gcc instead, it can't
find it.

I don't fully understand how passing through path variables works... any
suggestions?

Thanks
Theo

----- End forwarded message -----

_______________________________________________
GCCSDK mailing list gcc@gccsdk.riscos.info
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK