Assembly with MIPS Pro Problem

IRIX/Nekoware development, porting and related topics.
Forum rules
Any posts concerning pirated software or offering to buy/sell/trade commercial software are subject to removal.
User avatar
Adrenaline
Posts: 504
Joined: Thu Feb 10, 2005 1:37 pm
Location: Laurel, MD USA
Contact:

Assembly with MIPS Pro Problem

Unread postby Adrenaline » Mon Apr 02, 2012 5:29 am

I started reading the "See MIPS Run" book yesterday and had my little test app written and got my object output file from running as on it. Then ran ld on it and upon running the actual program I get:

Code: Select all

rld: Fatal Error: Could not resolve _environ


Searching around led me no where, anybody have any idea would could be wrong?
:Indigo: 33mhz R3k/48mb/XS24 :Indy: 150mhz R4400/256mb/XL24 :Fuel: 600mhz R14kA/2gb/V10 Image 8x1.4ghz Itanium 2/8GB :O3x08R: 32x600mhz R14kA/24GB :Tezro: 4x700mhz R16k/8GB/V12/DCD/SAS/FC/DM5 (2x) :O3x0: 4x700mhz R16k/4GB :PrismDT: 2x1.6ghz 8mb/12gb/SAS/2xFGL

robespierre
Posts: 685
Joined: Mon Sep 12, 2011 2:28 pm
Location: Boston

Re: Assembly with MIPS Pro Problem

Unread postby robespierre » Mon Apr 02, 2012 11:49 am

I'm not sure, but perhaps it needs to link in crt0.a somehow?
:PI: :O2: :Indigo2IMP: :Indigo2IMP:

User avatar
Adrenaline
Posts: 504
Joined: Thu Feb 10, 2005 1:37 pm
Location: Laurel, MD USA
Contact:

Re: Assembly with MIPS Pro Problem

Unread postby Adrenaline » Mon Apr 02, 2012 11:54 am

robespierre wrote:I'm not sure, but perhaps it needs to link in crt0.a somehow?


What's the usual MIPS Pro arguments? Maybe that's my problem.

All I'm doing is:

Code: Select all

as sar.s


And then:

Code: Select all

ld sar.o
:Indigo: 33mhz R3k/48mb/XS24 :Indy: 150mhz R4400/256mb/XL24 :Fuel: 600mhz R14kA/2gb/V10 Image 8x1.4ghz Itanium 2/8GB :O3x08R: 32x600mhz R14kA/24GB :Tezro: 4x700mhz R16k/8GB/V12/DCD/SAS/FC/DM5 (2x) :O3x0: 4x700mhz R16k/4GB :PrismDT: 2x1.6ghz 8mb/12gb/SAS/2xFGL

User avatar
canavan
Posts: 754
Joined: Mon Jul 21, 2003 6:19 am

Re: Assembly with MIPS Pro Problem

Unread postby canavan » Wed Apr 11, 2012 3:29 pm

_environ sounds almost essential...

Code: Select all

$ nm /bin/ls  |grep _environ
[51]    |         0|       4|OBJT |GLOB |DEFAULT  |UNDEF  |_environ
$ ldd  /bin/ls
        libc.so.1  =>    /lib32/libc.so.1       
$ nm /usr/lib32/libc.so.1  |grep _environ
[7626]  | 263517728|       4|OBJT |GLOB |DEFAULT  |MIPS_DATA|_environ

So, it's in libc, therefore adding -lc to your ld call should fix things. cc uses /usr/lib32/cmplrs/ld32 to link stuff, which also includes /usr/lib32/mips4/crtn.o.

User avatar
Adrenaline
Posts: 504
Joined: Thu Feb 10, 2005 1:37 pm
Location: Laurel, MD USA
Contact:

Re: Assembly with MIPS Pro Problem

Unread postby Adrenaline » Wed Apr 11, 2012 3:39 pm

canavan wrote:_environ sounds almost essential...

Code: Select all

$ nm /bin/ls  |grep _environ
[51]    |         0|       4|OBJT |GLOB |DEFAULT  |UNDEF  |_environ
$ ldd  /bin/ls
        libc.so.1  =>    /lib32/libc.so.1       
$ nm /usr/lib32/libc.so.1  |grep _environ
[7626]  | 263517728|       4|OBJT |GLOB |DEFAULT  |MIPS_DATA|_environ

So, it's in libc, therefore adding -lc to your ld call should fix things. cc uses /usr/lib32/cmplrs/ld32 to link stuff, which also includes /usr/lib32/mips4/crtn.o.


That worked! Kinda weird it would need a c library to link against for some pretty basic assembly. I won't question it though, thanks!
:Indigo: 33mhz R3k/48mb/XS24 :Indy: 150mhz R4400/256mb/XL24 :Fuel: 600mhz R14kA/2gb/V10 Image 8x1.4ghz Itanium 2/8GB :O3x08R: 32x600mhz R14kA/24GB :Tezro: 4x700mhz R16k/8GB/V12/DCD/SAS/FC/DM5 (2x) :O3x0: 4x700mhz R16k/4GB :PrismDT: 2x1.6ghz 8mb/12gb/SAS/2xFGL


Return to “SGI: Development”

Who is online

Users browsing this forum: No registered users and 1 guest