🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac.programmer.codewarrior
Article #954

Re: Linking asm into Mach-O project ?

#954
From: Paul Russell
Date: Fri, 28 Jun 2002 05:33
39 lines
2945 bytes
MW Ron wrote:
> 
> In article <3D19F129.B549F3E0@arc-software.com>,
>  Paul Russell <prussell@arc-software.com> wrote:
> 
> >I'm trying to integrate a chunk of gcc PowerPC assembler code into a CW
> >8 Mach-O project. I've tried two approaches, neither of which seem to
> >work. Has anyone else had more success than I have ?
> >
> >(i) fix the syntax (by hand !) and put the code into an inline asm {}
> >function - this fails because CW complains that there aren't enough free
> >registers (despite teh fact that I'm only using about 12 GPR's)
> >
> >(ii) assemble with gcc and try to link in the object file - the Mach-O
> >Importer barfs with an error about an unsupported relocation type or
> >some such
> >
> >Surely it shouldn't be this hard to link is some very straightforward
> >asm functions, that already work with gcc ?
> 
> What linker are you using? the Apple GCC linker or Metrowerks Mach-O
> linker,  do you have a small example project (or code for a stationery
> project) that you can send that I can forward on.
> 

I'm using the default MetroWerks "Mac OS X PowerPC Mach-O" linker, and
the default file mappings, which map object files to "Mach-O Importer",
which seems to be where the error message is coming from. I think I
tried changing the linker but it didn't make any difference.

If I make a small asm function that does nothing then I can link that in
OK - the problem seems to occur when the function has branches in it -
the Mach-O Importer doesn't like something about the relocation info in
the object file. Since these would be relative branches I can't imagine
what the problem would be.

As you suggest, I'll put together a demo which illustrates the problem.

Paul
Technical Details
Message-ID: <3D1BF52D.AF8EB4D3@arc-software.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!HSNX.atgi.net!feed.news.sonic.net!typhoon.sonic.net!not-for-mail
References: <3D19F129.B549F3E0@arc-software.com> <mwron-1E3F2D.22075227062002@enews.newsguy.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10bcce,ca141578f4efb1df
X-Google-Attributes: gid10bcce,public
X-Google-Thread: f635e,ca141578f4efb1df
X-Google-Attributes: gidf635e,public
X-Google-ArrivalTime: 2002-06-27 22:35:12 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!HSNX.atgi.net!feed.news.sonic.net!typhoon.sonic.net!not-for-mail
Message-ID: <3D1BF52D.AF8EB4D3@arc-software.com>
From: Paul Russell <prussell@arc-software.com>
Reply-To: prussell@arc-software.com
Organization: Coastal Software
X-Mailer: Mozilla 4.76 (Macintosh; U; PPC)
X-Accept-Language: en,pdf
MIME-Version: 1.0
Newsgroups: comp.sys.mac.programmer.codewarrior,codewarrior.mac
Subject: Re: Linking asm into Mach-O project ?
References: <3D19F129.B549F3E0@arc-software.com> <mwron-1E3F2D.22075227062002@enews.newsguy.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 39
Date: Fri, 28 Jun 2002 05:33:31 GMT
NNTP-Posting-Host: 208.201.231.212
X-Complaints-To: abuse@sonic.net
X-Trace: typhoon.sonic.net 1025242411 208.201.231.212 (Thu, 27 Jun 2002 22:33:31 PDT)
NNTP-Posting-Date: Thu, 27 Jun 2002 22:33:31 PDT