🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.help
Article #125

Help: g++ assembler output on V.4

#125
From: Per G. Bilse
Date: Sun, 26 Jul 1992 10:15
100 lines
2630 bytes
I'm experiencing a problem with g++ (v 2.2.2) on a '386 V.4
(Consensys, to be specific) ... g++ emits special section
directives for constructors and destructors, as appears normal
on V.4:

  .section	.dtors,"a",@progbits	.long	 <address>
  .section	.ctors,"a",@progbits	.long	 <address>

However, the assembler on my system distinctly dislikes anything
following the ``"a"'' ...  complete sample output is as follows:

#include <stdio.h>
struct A {
  A() { fputs("A\n", stdout); }
  ~A() { fputs("~A\n", stdout); }
};
A a;
main()
{
  return 0;
}


	.file	"c++test.c"
	.version	"01.01"
gcc2_compiled.:
	.ident "@(#)head:stdio.h	2.34.1.2"
.section	.rodata
.LC0:
	.string	"A\n"
.LC1:
	.string	"~A\n"
.globl a
.data
	.type	 a,@object
	.size	 a,1
a:
	.zero	1
.text
	.align 16
.globl main
	.type	 main,@function
main:
	pushl %ebp
	movl %esp,%ebp
	xorl %eax,%eax
	movl %ebp,%esp
	popl %ebp
	ret
	.align 16
.Lfe1:
	.size	 main,.Lfe1-main
	.align 16
.globl _GLOBAL_.D.a
	.type	 _GLOBAL_.D.a,@function
_GLOBAL_.D.a:
	pushl %ebp
	movl %esp,%ebp
	pushl $__iob+16
	pushl $.LC1
	call fputs__FPCcP4FILE
	movl %ebp,%esp
	popl %ebp
	ret
	.align 16
.Lfe2:
	.size	 _GLOBAL_.D.a,.Lfe2-_GLOBAL_.D.a
.section	.dtors,"a",@progbits	.long	 _GLOBAL_.D.a
.text
	.align 16
.globl _GLOBAL_.I.a
	.type	 _GLOBAL_.I.a,@function
_GLOBAL_.I.a:
	pushl %ebp
	movl %esp,%ebp
	pushl $__iob+16
	pushl $.LC0
	call fputs__FPCcP4FILE
	movl %ebp,%esp
	popl %ebp
	ret
	.align 16
.Lfe3:
	.size	 _GLOBAL_.I.a,.Lfe3-_GLOBAL_.I.a
.section	.ctors,"a",@progbits	.long	 _GLOBAL_.I.a
	.ident	"GCC: (GNU) 2.1"


I should add that I'm in dire straits with this one.  I need to get
this working by the end of the month and have ordered the relevant
books, but delivery time on those seems to be a problem.

Any help would be greatly appreciated.

In advance, thanks.
--
Per G. Bilse:   bilse@dkuug.dk   bilse@login.dkuug.dk  per@bilse.dk
work DKUUG, Universitetsparken 1-3, 2100 Copenhagen OE  +45 31 39 73 22
priv Dannebrogsgade 35, DK-1660 Copenhagen V.  +45 31 31 39 71
      "It's spaghetti, Jim, but not as we know it"
Technical Details
Message-ID: <bilse.712145734@login.dkuug.dk>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!dkuug!login.dkuug.dk!bilse

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!dkuug!login.dkuug.dk!bilse
From: bilse@login.dkuug.dk (Per G. Bilse)
Newsgroups: gnu.g++.help
Subject: Help: g++ assembler output on V.4
Summary: V.4 assembler doesn't like g++ [cd]tors sections.
Keywords: g++ constructor destructor assembler section 386 486 V.4
Message-ID: <bilse.712145734@login.dkuug.dk>
Date: 26 Jul 92 10:15:34 GMT
Sender: news@slyrf.dkuug.dk
Organization: Prolog Development Center
Lines: 100