All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Bame <bame@endor.fc.hp.com>
To: Grant Grundler <grundler@cup.hp.com>
Cc: parisc-linux@thepuffingroup.com
Subject: Re: [parisc-linux] crti.S Nested procedures error
Date: Wed, 10 May 2000 14:03:17 -0600	[thread overview]
Message-ID: <E12pchR-0005Kc-00@endor.fc.hp.com> (raw)
In-Reply-To: Your message of "Mon, 01 May 2000 11:41:00 PDT." <200005011841.LAA11187@milano.cup.hp.com>

= "make" died with the following error:
= 
= /linux/grundler/glibc/hppa1.1-linux/csu/crti.S: Assembler messages:
= /linux/grundler/glibc/hppa1.1-linux/csu/crti.S:42: Fatal error: Nested proced
ures
= 
= Sure enough, two .PROC's have no .PROCEND in between.

I think I've figured this out, and it'll take a glibc expert to do
the *right* thing vis-a-vis the complex glibc structure.

Let's ignore the .fini section and just deal with .init.  This is the
section where code which needs to execute prior to main() is placed.  It
is in effect a normal assembly-language procedure whose contents are
created at link-time.  The procedure looks like this (somewhat simplified):

    .globl _init
	    .EXPORT _init,ENTRY
	    .type    _init,@function
    _init:
	    .PROC
	    .CALLINFO FRAME=64,CALLS,SAVE_RP,ENTRY_GR=3
	    .ENTRY
	    a few assembly statements

	    /***** pre-main() code to be inserted here *******/

	    a few more assembly statements
	    .EXIT
	    .PROCEND

glibc wants to place the first part (up to the comment) into crti.S, and
the second part into crtn.S, then at link time something like this happens:

	ld -o a.out crti.o users's-object-files crtn.o

Inside the user's object files, if they need something called before main(),
like a C++ static constructor, you might find code like this:

	.section .init
	bl,n my-static-constructor,%r2

Thus the _init procedure is created is link time, but that's not the problem.

The problem is that the neither the first scrap of code nor the second
will assemble, because there's a .PROC without .PROCEND and .ENTRY
without .EXIT.  .ENTRY and .EXIT both produce code, .ENTRY depends on
.CALLINFO which depends a tad upon .PROC.

If we hand-code the .ENTRY and .EXIT sequences, we can nuke all the
troublesome assembler directives and fix this... simple!...

except for the way this code got generated in the first place.
It's generated in glibc/csu by 'gcc -S initfini.c' and then
hacking the generated assembly, which contains the .PROC,.ENTRY,etc...

So one thing we could do is hack gcc to produce its own entry/exit
assembly code generation.  Another thing we could do is make the
assembler very forgiving.  Perhaps the best thing we could do is find a way
to insert PA-specific handwritten assembly for these two files
into the glibc build.  I can't figure out how to do this without
making glibc specific only to PA.  Help!

	-Paul Bame

  parent reply	other threads:[~2000-05-11  2:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-01 18:41 [parisc-linux] crti.S Nested procedures error Grant Grundler
2000-05-03 14:18 ` Sam Creasey
2000-05-03 15:53   ` willy
2000-05-04  0:28     ` Alan Modra
2000-05-10 20:03 ` Paul Bame [this message]
     [not found] <200005040040.RAA14682@milano.cup.hp.com>
2000-05-04  0:49 ` Alan Modra
2000-05-04  0:54   ` Jeffrey A Law
2000-05-04  1:27     ` Alan Modra
2000-05-04  4:45       ` Jeffrey A Law
  -- strict thread matches above, loose matches on Subject: below --
2000-05-10 21:48 Cary Coutant

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E12pchR-0005Kc-00@endor.fc.hp.com \
    --to=bame@endor.fc.hp.com \
    --cc=grundler@cup.hp.com \
    --cc=parisc-linux@thepuffingroup.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.