[comp.unix.amiga] g++

s000623@kowande.bu.oz.au (Jason Patterson) (06/19/91)

Installing (or trying to) g++ for AMIX is a nightmare!

Even when the config files from AMIX gcc (1.37) are used, there
are still *HEAPS* of problems...

I have attempted to install g++ TWICE for AMIX (version 1.37.0,
stay away from 1.39, even the author suggests this!).

Both times I managed to overcome the stuff your getting to now
by following the hacks required to gcc 1.37, found on the 4th
segment of the 1.1 release tape. (ie: the changes required for
AMIX, mostly to allow for PIC and so on).


BUT... Don't get your hopes up...
The following *BIG* problem still exists...

 **** THE STANDARD ASSEMBLER HATES $ SIGNS IN LABELS ****


This is a big problem because EVERY constructor gets a $ sign
put into it's "mangled" name by g++ (standard mangled names for
constructors begin _$_).

WHAT DOES THIS MEAN - It means I have a perfectly good WORKING
c++ compiler, which compiles everything WITHOUT constructors
perfectly, but outputs assembly code that 'as' can't assemble
if constructors are involved. If I really wan't to, I can do a
textual search and replace of $ in labels to something else
(like an x), and then assemble the result.

Although this works, I do NOT wan't to have to S&R every time
I compile something with constructors. Besides, this will stuff
up the workings of things like gdb anyway (because they will also
expect $ in constructors).

Why as can't handle $ is a puzzle, especially since every other
assembler I've come across seems to handle them ok.

Anyway, the following solutions come to mind...

	1) FIX THE STANDARD ASSEMBLER  (best option by far)

	2) USE GAS (which I have not yet installed, because this
	   would imply remaking gcc, and I would prefer NOT to
           have to do this)

	3) Hack *A LOT* of the g++ compiler (especially the name
           mangler and demangler) to use some other symbol.
	   
	   BUT WHAT ELSE DOES STANDARD AS NOT ALLOW IN LABLES?

	   Besides, I do NOT have the time to hack the g++ compiler
	   to bits, and this would mean *MORE* work to fix future 
	   updates in any case.


So WHY am I writing this? (for help, what else?)

 1) If anyone has a working g++ for AMIX, *PLEASE* let me know.
    (I already know about Comeau C++)

 2) If someone fixes the assembler, please let me know.

 3) If anyone want's a *HALF WORKING* g++ (which is unable to
    compile constructors, and hence is unable to compile libg++),
    please let me know.
          (nobody could be this desperate, could they?)

 4) If I can help you (slim chance), or you can help me (much more
    likely, since I've only installed a couple of compilers, and
    so am very inexperienced) please let me know...


I know I didn't help this time, I hope I can help in the future...

LETS GET G++ WORKING FOR AMIX...


Jason Patterson

************************************************************
EMAIL: s000623@kowande.bu.oz.au
   OR: s000623@sand.sics.bu.oz.au

Info & Computing Science, Bond University, AUSTRALIA, 4229

"These views are NOT necessarily those of Bond University"
************************************************************

malcolm@pandanus.ntu.edu.au (Malcolm Caldwell) (06/19/91)

>	1) FIX THE STANDARD ASSEMBLER  (best option by far)
>
>	2) USE GAS (which I have not yet installed, because this
>	   would imply remaking gcc, and I would prefer NOT to
>           have to do this)

I would say that getting gas to work is about your best bet.  Remaking gcc
is no problem as that is what you have done each time you recompile g++ (in
effect)

Besides, gas can probably produce better code than as (Believe it or not).
At least this is true on a sun3 here (68020).  It does a better job of branch
optimization.
--
Malcolm Caldwell                malcolm@pandanus.ntu.edu.au
Technical Officer
Computer Science
Northern Territory University, Darwin Australia

her@compel.UUCP (Helge Egelund Rasmussen) (06/20/91)

s000623@kowande.bu.oz.au (Jason Patterson) writes:

>Installing (or trying to) g++ for AMIX is a nightmare!
>BUT... Don't get your hopes up...
>The following *BIG* problem still exists...
> **** THE STANDARD ASSEMBLER HATES $ SIGNS IN LABELS ****
>This is a big problem because EVERY constructor gets a $ sign
>put into it's "mangled" name by g++ (standard mangled names for
>constructors begin _$_).

Well, I haven't AMIX, and I'm working with g++.1.39.0, so might be wrong here...

Try to define 
     NO_DOLLAR_IN_LABEL 
in the tm.h, it should solve this problem.

This define is described in cplus_tree.h:
    Define NO_DOLLAR_IN_LABEL in your favourite tm file if your assembler
    doesn't allow '$' in symbol names.

Hope this will work for you, now if someone could port g++ to AmigaDos....

Helge 
---
Helge E. Rasmussen  .  PHONE + 45 36 72 33 00  .  E-mail:  her@compel.dk
Compel A/S          .  FAX   + 45 36 72 43 00  .  
Copenhagen, Denmark

crash@ckctpa.UUCP (Frank J. Edwards) (06/23/91)

In article <1512@compel.UUCP> her@compel.UUCP (Helge Egelund Rasmussen) writes:
>s000623@kowande.bu.oz.au (Jason Patterson) writes:
>
>> **** THE STANDARD ASSEMBLER HATES $ SIGNS IN LABELS ****
>>This is a big problem because EVERY constructor gets a $ sign
>>put into it's "mangled" name by g++ (standard mangled names for
>>constructors begin _$_).
>
>Well, I haven't AMIX, and I'm working with g++.1.39.0, so might be wrong here...
>
>Try to define 
>     NO_DOLLAR_IN_LABEL 
>in the tm.h, it should solve this problem.
>
>This define is described in cplus_tree.h:

Yeah, but all that does is use periods instead.  And "as" under Amix doesn't
like periods in the middle of labels either.

I created a test file for the assembler and tried every punctuation character
on the keyboard to see what the assembler _would_ take; the underscore (if
you consider that punctuation) and the percent sign ('%') were it.  Of
course, the percent sign has problems when the compiler tries to do printf()s
and stuff, so you have to double it up, right?  Wrong.  The code makes
assumptions about labels of the form _$_ and expects three characters, so
_%%_ won't work.

All this is solved with the patch Rich Skrenta posted.  (aside to Rich:
my G++ is bombing out on src/Random.cc with segment violations in the
g++/varasm.c source file, subroutine decode_asm_reg() called from
make_decl_rtl().  It appears FIRST_PSEUDO_REGISTER is too large and
is causing strcmp() to perform a check with invalid parameters.  Would
you send me the config files you're using?  tm.h, md, etc.  Also include
any #include'd files please.  Thanks, I owe you one :-)  If you ever make
it down to Clearwater beach, look me up ;-)

>Hope this will work for you, now if someone could port g++ to AmigaDos....

Yeah, hopefully G++/GCC will be able to bootstrap itself to AmigaDOS once
I get this working (and I understand _WHY_ it's working ;-)

>Helge 
>---
>Helge E. Rasmussen  .  PHONE + 45 36 72 33 00  .  E-mail:  her@compel.dk
>Compel A/S          .  FAX   + 45 36 72 43 00  .  
>Copenhagen, Denmark

-- 
Frank J. Edwards		|  "I did make up my own mind -- there
2677 Arjay Court		|   simply WASN'T ANY OTHER choice!"
Palm Harbor, FL  34684-4504	|		-- Me
Phone (813) 786-3675 (voice)	|    Only Amiga Makes It Possible...