GCC for Windows NT / Dec Alpha?

Somehow I never noticed this until making what seemed like a pointless GCC config.

You can apparently build a GCC like this:

sh configure –host=i386-winnt35 –target=alpha-winnt35

And you can get a cross compiler.

The real question is, does it work?  I don’t know I don’t have a cross assembler, linker or a target machine.

 


D:\proj\gcc-3.0.4\gcc>xgcc -v
Using builtin specs.
Configured with: : (reconfigured) : (reconfigured) : (reconfigured)
Thread model: single
gcc version 3.0.4

D:\proj\gcc-3.0.4\gcc>xgcc -v -S hi.c
Using builtin specs.
Configured with: : (reconfigured) : (reconfigured) : (reconfigured)
Thread model: single
gcc version 3.0.4
cc1 -lang-c -v -iprefix ../lib/gcc-lib/alpha-winnt35/3.0.4/ -D__GNUC__=3 -D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=4 -DWIN32 -D_WIN32 -DWINNT -D__STDC__=0 -DALMOST_STDC -D_M_ALPHA -D_ALPHA_ -D_LONGLONG -D__unaligned= -D__stdcall= -D__WIN32__ -D_WIN32 -D__WINNT__ -D__STDC__=0 -D__ALMOST_STDC__ -D_M_ALPHA -D_ALPHA_ -D_LONGLONG -D__unaligned= -D__stdcall= -D__WIN32 -D__WINNT -D__ALMOST_STDC -Asystem=winnt -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D__LANGUAGE_C__ -D__LANGUAGE_C -DLANGUAGE_C -Acpu=alpha -Amachine=alpha -D__alpha -D__alpha__ -D__alpha_ev4__ -Acpu=ev4 hi.c -quiet -dumpbase hi.c -version -o hi.s
GNU CPP version 3.0.4 (cpplib)
GNU C version 3.0.4 (alpha-winnt35)
compiled by GNU C version 5.1.0.
ignoring nonexistent directory “../lib/gcc-lib/alpha-winnt35/3.0.4/include”
ignoring nonexistent directory “../lib/gcc-lib/alpha-winnt35/3.0.4/../../../../alpha-winnt35/sys-include”
ignoring nonexistent directory “../lib/gcc-lib/alpha-winnt35/3.0.4/../../../../alpha-winnt35/include”
ignoring nonexistent directory “NONE/include”
ignoring nonexistent directory “D:/pcem/building/MinGW/msys/1.0/local/lib/gcc-lib/alpha-winnt35/3.0.4/include”
ignoring nonexistent directory “D:/pcem/building/MinGW/msys/1.0/local/lib/gcc-lib/alpha-winnt35/3.0.4/../../../../alpha-winnt35/sys-include”
ignoring nonexistent directory “D:/pcem/building/MinGW/msys/1.0/local/lib/gcc-lib/alpha-winnt35/3.0.4/../../../../alpha-winnt35/include”
#include “…” search starts here:
End of search list.
: warning: “__STDC__” redefined
: warning: this is the location of the previous definition
: warning: “__STDC__” redefined
: warning: this is the location of the previous definition
hi.c: In function `main’:
hi.c:3: warning: return type of `main’ is not `int’

This is what the output looks like, which looks nothing like targeting the i386 so I guess so?


.set noreorder
.set volatile
.set noat
.globl __fltused
.file 1 "hi.c"
.rdata
.quad 0
$LC0:
.ascii "Hello from GCC %s\12\0"
$LC1:
.ascii "3.0.4\0"
.text
.align 2
.globl main
.ent main
main:
.frame $15,0,$26,0
.mask 0x4008000,0
lda $30,-16($30)
stq $26,0($30)
stq $15,8($30)
mov $30,$15
.prologue 0
jsr $26,__main
lda $1,$LC0
addl $1,$31,$2
lda $1,$LC1
addl $1,$31,$1
mov $2,$16
mov $1,$17
jsr $26,printf
mov $15,$30
ldq $26,0($30)
ldq $15,8($30)
lda $30,16($30)
ret $31,($26),1
.end main

Just for you, lucky Spanish user, GCC 3.0.4 for Windows NT (MinGW)

From Spain!

I cannot understand why you want this, or why I’m even going to do it.  At this point in GCC history the winnt-3.5 target had been dumped in favour of going all in with Cygwin.  So yeah, this does not either clearly configure, or compile.  But a little bit of mashing files, and I have it at least compiling some assembly that can be translated into an object file that a later version of MinGW can actually compile.

All I’ve built is the gcc driver, the cpp pre-processor, and the cc1 aka C backend.

D:\proj\gcc-3.0.4\gcc>xgcc -c -v hi.c
Using builtin specs.
Configured with:
Thread model: single
gcc version 3.0.4
cc1 -lang-c -v -iprefix ../lib/gcc-lib/i386-winnt35/3.0.4/ -D__GNUC__=3 -D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=4 -Dunix -DWIN32 -D_WIN32 -DWINNT -D_M_IX86=300 -D_X86_=1 -D__STDC__=0 -DALMOST_STDC -D_MSC_VER=800 -D__stdcall=__attribute__((__stdcall__)) -D__cdecl=__attribute__((__cdecl__)) -D_cdecl=__attribute__((__cdecl__)) -D__unix__ -D__WIN32__ -D_WIN32 -D__WINNT__ -D_M_IX86=300 -D_X86_=1 -D__STDC__=0 -D__ALMOST_STDC__ -D_MSC_VER=800 -D__stdcall=__attribute__((__stdcall__)) -D__cdecl=__attribute__((__cdecl__)) -D__cdecl__=__attribute__((__cdecl__)) -D__unix -D__WIN32 -D__WINNT -D__ALMOST_STDC -D__cdecl=__attribute__((__cdecl__)) -Asystem=unix -Asystem=winnt -D__NO_INLINE__ -D__STDC_HOSTED__=1 -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i386__ hi.c -quiet -dumpbase hi.c -version -o C:\Users\jason\AppData\Local\Temp\ccpflisr.s
GNU CPP version 3.0.4 (cpplib) (80386, BSD syntax)
GNU C version 3.0.4 (i386-winnt35)
compiled by GNU C version 5.1.0.
ignoring nonexistent directory "../lib/gcc-lib/i386-winnt35/3.0.4/include"
ignoring nonexistent directory "../lib/gcc-lib/i386-winnt35/3.0.4/../../../../i386-winnt35/include"
ignoring nonexistent directory "D:/pcem/building/MinGW/msys/1.0/local/include"
ignoring nonexistent directory "NONE/include"
ignoring nonexistent directory "D:/pcem/building/MinGW/msys/1.0/local/lib/gcc-lib/i386-winnt35/3.0.4/include"
ignoring nonexistent directory "D:/pcem/building/MinGW/msys/1.0/local/lib/gcc-lib/i386-winnt35/3.0.4/../../../../i386-winnt35/include"
ignoring nonexistent directory "/usr/include"
#include "..." search starts here:
End of search list.
: warning: "__STDC__" redefined
: warning: this is the location of the previous definition
: warning: "__STDC__" redefined
: warning: this is the location of the previous definition
hi.c: In function `main':
hi.c:3: warning: return type of `main' is not `int'
as --traditional-format -o hi.o C:\Users\jason\AppData\Local\Temp\ccpflisr.s

D:\proj\gcc-3.0.4\gcc>gcc hi.o -o hi

D:\proj\gcc-3.0.4\gcc>hi
Hello from GCC 3.0.4

So there you go, mysterious internet user!  Download my source dump with binaries in the tree because I’m lazy.

gcc-3.0.4-MinGW.7z

IPIP tunnel to SLiRP

I know this is what 99.99% of people hope I never do, but let’s make an incredibly insecure VPN! yay!

Motivation

So the thing is that I have a cisco router and I’d love for it to connect to some Windows machine over an existing OpenVPN, and NAT out the Windows side.  Except for getting the VPN installed, they won’t give me anything else.  And they SURE as heck won’t let me connect a cisco router up…..

So first things first, I need to configure my cisco router for an IPIP tunnel, to my test Windows machine, and use the SLiRP default addresses:

interface Tunnel0
description “SLiRP tunnel”
ip address 10.0.2.15 255.255.255.0
ip mtu 1452
tunnel source GigabitEthernet0/1
tunnel destination 192.168.1.10
tunnel mode ipip
end

Now to start programming.

Well then I went looking and found this fun filled page, about calling winioctl’s myself, and getting winsock to do all kinds of fun things.  Namely how IPIP actually works, as it’s is it’s own protocol (none of that pesky TCP/UDP it’s IPIP!) and more importantly I can receive the traffic.

So looking at a quick UDP client/server I figured out that I can modify that so instead of listening with UDP like this:

if((s = socket(AF_INET , SOCK_DGRAM , 0 )) == INVALID_SOCKET)

I can instead call for a RAW socket, and listen on protocol #4 aka IPIP.

if((s = socket(AF_INET , SOCK_RAW , 4 )) == INVALID_SOCKET)

One caveat I had on this, is that you need to run as Administrator on the Windows machine to create raw sockets.  If you don’t have administrator privleges you’ll get this error:

Could not create socket : 10013socket() failed with error code : 10013

Now add in some nonblocking, and feed the data into SLiRP, and I got invalid data!  Using wireshark I can see that I only receive the IP portion of the data, so no hardware frame, but what is more interesting is that I receive ALL of the IP information so I get the IP+IP+DATA.  So I have to forge a L2 header, and cut out the first IP header.  I did this by cheating, using the following for a L2 header:

0x44,0x8a,0x5b,0x62,0xcb,0xaf,0x00,0x1b,0x90,0x21,0x58,0x1b,0x08,0x00

I then just memcpy that to the start of my buffer, then copy in the rest of the received data like this:

memcpy(buf2+14,buf+20,recv_len-20);

And now I can forge data going to SLiRP to make it happy!

And sending replies didn’t make wireshark happy at all, as there is an L2 header in there, that just doesn’t make sense in L3 space, so I trimmed that with the following:

memcpy(buf,qp->data+14,qp->len-14);

Putting it all together

And now much to my amazement I can ping SLiRP from my 7206!

IPIP Ping!

Ok, I know what you are thinking. ICMP is great, but how about TCP?  Can I actually use this thing?

I add a route to my BBS over the SLiRP tunnel, with a simple route statement:

ip route 172.86.181.35 255.255.255.255 10.0.2.2

and then telnet…

Telnet to my BBS over IPIP to SLiRP

So yes, it does actually work!\

I don’t think anyone will ever want to use this, but for me it’s 100% novelty in that I could.

Executable & source code is here, ipip.7z.

I suppose later I could look at ipdecap, to work out how to work with GRE.

Adding some of the GNU 1989 source ‘tapes’ into sourceforge

After scrounging around from an earlier post, on a DECUS mirror that goes back to 1989 I’ve put together the following source tapes:

Quite a list!

I haven’t tried to build any of it, but I figured for the time being, it may be easier to make some tap files for SIMH, and maybe someone else will do the hard work for me.  Or it’ll be a lazy day type thing.

Holy crap did I get the most annoying trojan attempt ever!

Sit down kids, it’s time for an old man rant.

So yeah, I have one of those clients who wants to use ‘one of those’ file sharing sites. UGH.  I swear I’m to the point of just paying for an Office 365 subscription for them so I don’t have to deal with this kind of shit.  So I hit the site on my phone, then it jumps to this genchatu.top site.  Fantastic.

Then I’m alerted that my phone is 28.1% DAMAGED, and somehow my phone’s SIM card will be damaged!  Yes, it’s one of these scam sites!

Wow

Oh no, my phone apparently may be already physically damaged?  I guess this is once someone is tricked by this official Google looking image you’ll want to throw your phone against the wall.  As any user of Android will tell you updates from Google are non existent, and anything that could infect your phone, well is pretty much your problem.  You can beg the vendor, but lol, good luck.

I like to live dangerously, so yeah let’s look at the app.

Ace, alright, more like acehole!

So with this scary and official looking thing it’s trying to railroad you into “Ace Cleaner”  I don’t know how on earth they haven’t either been reported, or knocked out of the app store.  I guess Google is busy teaming up with Facebook trying to figure out how to censor the new appropriately instead of trying to squash actual scam artists.

I honestly haven’t tracked any of these ‘reviews’ to see how many are just idiots, or how many are just ballot stuffers.

Yeah, it’s a scam.

 

No backing away!

And of course you can’t just back away from the page, you get this nice thing along with something in java script that gets your phone to buzz and light up.  Thanks Google!  That’ll never get abused like the blink tag!

You have to be kidding me

Oh no, I’ve been threatened to be blocked.

How bad can this crapware be?

Oh dear.  From the application page, let’s take a look:

Version 1.1.9 can access:
Device & app history
  • retrieve running apps
  • read your Web bookmarks and history

So they know what you are running, and what bookmark’d sites you like.

Identity
  • find accounts on the device

They know WHO you are.

Contacts
  • find accounts on the device

They know WHO you KNOW.

Phone
  • read phone status and identity
Photos/Media/Files
  • access USB storage filesystem
  • read the contents of your USB storage
  • modify or delete the contents of your USB storage

Storage

  • read the contents of your USB storage
  • modify or delete the contents of your USB storage

If you have any USB attached device, (flash drive, hard disk…) they can not only READ, but can MODIFY and DELETE the contents.  NICE!

Camera
  • take pictures and videos

I suppose an album of bewildered users would be amusing from time to time.  Also having the phone send videos of them doing various things.

Wi-Fi connection information
  • view Wi-Fi connections

Naturally they want to know about the Wi-Fi AP’s you use.

Device ID & call information
  • read phone status and identity

I guess knowing your phone charge status, and IEME #’s are good to know too.  But wow check out the next laundry list!

Other
  • bind to an accessibility service
  • update component usage statistics
  • read Home settings and shortcuts
  • write Home settings and shortcuts
  • read Home settings and shortcuts
  • write Home settings and shortcuts
  • view network connections
  • read battery statistics
  • send sticky broadcast
  • change network connectivity
  • connect and disconnect from Wi-Fi
  • delete all app cache data
  • expand/collapse status bar
  • control flashlight
  • measure app storage space
  • full network access
  • close other apps
  • run at startup
  • draw over other apps
  • control vibration
  • prevent device from sleeping
  • modify system settings
  • write web bookmarks and history
  • install shortcuts
  • uninstall shortcuts

Read / Write the home page, guess who you’ll be visiting quite often?  Checking out your network, and say if you are somewhere where they want to upload a video, if they KNOW a WiFi network in the area they can have your phone join it, record you, upload it, and drop.  Yeah great!  I also like the drawing over other apps, that way you may THINK you are running another app, but they are just watching what you are doing.  And maybe they’ll pass control down, maybe not.

I suppose it may be fun too if they have a subscription service, to buzz and turn on the camera flash to warn you that you got infected once your subscription lapsed, so you better pay up!

Absolutely deplorable!

Where to go from here?

Seriously how do companies like this survive?  I guess quite well.  I guess I’m just more amazed by Google’s complacency in all of this.  But at the same time they are an ADVERTISING COMPANY, and I’m the product, Android is just the TV programme to get me to watch their annoying ads.  And considering their track record with illegal pharmacies, I guess it really is no surprise.

The truth is that no doubt that this kind of thing is just too profitable.  And people will just fall time and time again for this trap.

Found some more ancient GNU software

I found a bunch of them here: ftp://ftp.ne.jp

CVS brows of the following:

I didn’t know that GNUmake 2.9 and prior was actually part of binutils.  I guess at some point I’ll build the older ones on 4.2 BSD to round out the experience.

And I don’t know where to find Emacs 18.41 and going further back.  Although I did find emacs1855.taz a DECUS (Digital Equipment Computer Users’ Society) image from late 1989.

Building and using GCC 0.9 aka the first public version

In my quest for old software, I’ve seen this file in multiple searches, gcc-0.9.tar.bz2, which is the first version of GCC!

article from virtuallyfun.superglobalmegacorp.com

GCC 0.9 on SIMH VAX / 4.2BSD

GCC 0.9 on SIMH VAX / 4.2BSD

From the original announcement:

 Date: Sun, 22 Mar 87 10:56:56 EST
From: rms (Richard M. Stallman)

   The GNU C compiler is now available for ftp from the file
/u2/emacs/gcc.tar on prep.ai.mit.edu.  This includes machine
descriptions for vax and sun, 60 pages of documentation on writing
machine descriptions (internals.texinfo, internals.dvi and Info
file internals).

   This also contains the ANSI standard (Nov 86) C preprocessor and 30
pages of reference manual for it.

   This compiler compiles itself correctly on the 68020 and did so
recently on the vax.  It recently compiled Emacs correctly on the
68020, and has also compiled tex-in-C and Kyoto Common Lisp.
However, it probably still has numerous bugs that I hope you will
find for me.

   I will be away for a month, so bugs reported now will not be
handled until then.

   If you can’t ftp, you can order a compiler beta-test tape from the
Free Software Foundation for $150 (plus 5% sales tax in
Massachusetts, or plus $15 overseas if you want air mail).

   Free Software Foundation
1000 Mass Ave
Cambridge, MA  02138

[tapes are generally in Unix tar format.  If you have other needs,
write to the above address, and ask if they can be met. -len]

And indeed, the files are dated 22/03/1987 making this the first public release of GCC.

GNU CC is a fairly portable optimizing C compiler intended for
machines with 32-bit words that have several registers and address
memory in terms of 8-bit bytes.  It supports full ANSI standard C, not
including libraries (which we do not consider to be part of a
compiler).
Currently we have working machine descriptions for the Vax and for
the 68000/68020 (including 68881 support).
Optimizations performed by GNU CC include:

  • Invariant code motion out of loops.
  • Common subexpression elimination.
  • Automatic register packing (register declarations are unnecessary
    and ignored).
  • Constant propagation and elimination of consequent dead code.
  • Copy propagation.
  • Elimination of dead stores.
  • Jump optimization including cross-jumping.
  • Delaying of stack adjustments after function calls.
  • Arithmetic performed in subword types when appropriate.
  • Many local optimizations.

GNU CC runs about as fast as PCC.
Most of the optimizations are machine-independent or controlled by a
machine description.  GNU CC takes advantage of all the 68020
addressing modes that we can see how to make the Sun assembler
assemble.  Debugging output for DBX is available whether you request
optimization or not.

Seeing as 4.3BSD didn’t ship until 1988, I went ahead and set out to build this on 4.2BSD. The first stumbling block I hit is that GCC needs bison.  The oldest version of bison I have is 1.25 which honestly is just too new!  However in the same location as GCC is this file gnu1988.tar.bz2 which contains all of the current GNU software of 1988!  And what is on that tape?

  • bison-1.00
  • gcc-1.21
  • gdb-2.5.1
  • gplusplus-1.21
  • libgplusplus

So this is probably as old as it is going to get, so I downloaded and went to compile bison, however getopt is a missing call!  A creative search found getopt.c (local mirror) and even better PCC liked it enough to get a running bison so I could then configure GCC.

Configuring GCC is a manual process, but not too involved:

  • Make a symbolic link from file `config.h’ to the top-level
    config file for the machine you are using. Its name should be
    `config-MACHINE.h’. This file is responsible for
    defining information about the host machine. It includes
    `tm.h’.
  • Make a symbolic link from `tm.h’ to the machine-description
    macro file for your machine (its name should be
    `tm-MACHINE.h’).
  • Make a symbolic link from `md’ to the
    machine description pattern file (its name should be
    `MACHINE.md’)
  • Make a symbolic link from
    `aux-output.c’ to the output-subroutine file for your machine
    (its name should be `MACHINE-output.c’).Make sure the Bison parser generator is installed.Build the compiler. Just type `make’ in the compiler directory.

And in a minute I had GCC compiled.  I ran it with -v and got this output:

# gcc -v
ld /lib/crt0.o -lc
Undefined:
_main

It really is nowhere near as featured as 1.21 that is for sure!  So time to do a simple hello world program:

# cat hello.c
#include <stdio.h>
void main(){
printf(“GCC 0.9 in action!\n”);
}
# gcc -v hello.c -o hello
cpp -Dvax hello.c /tmp/cc002050.cpp
cc1 /tmp/cc002050.cpp -quiet -dumpbase hello.c -noreg -o /tmp/cc002050.s
as -o hello.o /tmp/cc002050.s
ld -o hello /lib/crt0.o hello.o -lc
# ./hello
GCC 0.9 in action!

And there we go!

I don’t know why, but I haven’t seen anything about anyone actually running GCC 0.9.  Or even where or how they found this ‘lost’ file.  Let alone anyone even building or running it in 2016.

For anyone who wants to try, SIMH tape files of the binaries are here:

And of course source tapes are here.

More idiots stealing my posts

So I just had made a nonsensical post on “Linux Apache GCC binutils elf .com a.out binary loader blob freedom Ralph Nader for president” and sure enough codesec.net picked it up

codesec.net theivery in progress

codesec.net theivery in progress

Usually they say that thievery is the highest compliment, but dam how about a reference back to the original?

To me the ultimate worst is how they butcher the content.

codesec.net how lame!

codesec.net how lame!

They capture none of the formatting, none of the love.  Instead they just scoop and poop content.

It’s really not such a red flag, I mean They don’t copy everything so they miss so much, and of course now it just means I need to inject some obnoxious title, and you can view the rest and much more @ superglobalmegacorp.com nonsense.. I don’t worry so much about page views, but rather I think the serendipity of additional topics and page views is what I end up losing.  Again it’s not that I advertise, I spend some $20 USD a month on a dedicated Iron server to run my blog on, but rather for me it is the conversation, and further engagement in comments that make it all worth while.

To me community engagement is the real currency.  And my endless blathering is the honey trap.

Ha ha.  Anyways I have more stuff to write on, not as naval gazing as this, but I did want someone else to write the magical words Ralph Nader for president.

myron

Myron Reducto – Ralph Nader for President