Nekochan Net

Official Chat Channel: #nekochan // irc.nekochan.net
It is currently Fri Apr 18, 2014 11:36 pm

All times are UTC - 8 hours


Forum rules


Any posts concerning pirated software or offering to buy/sell/trade commercial software are subject to removal.



Post new topic Reply to topic  [ 5 posts ] 
Author Message
Unread postPosted: Mon Apr 02, 2012 4:29 am 
Offline
User avatar

Joined: Thu Feb 10, 2005 12:37 pm
Posts: 486
Location: Laurel, MD USA
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:
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


Top
 Profile  
 
Unread postPosted: Mon Apr 02, 2012 10:49 am 
Offline

Joined: Mon Sep 12, 2011 1:28 pm
Posts: 479
Location: Boston
I'm not sure, but perhaps it needs to link in crt0.a somehow?

_________________
:PI: :O2: :Indigo2IMP: :Indigo2IMP:


Top
 Profile  
 
Unread postPosted: Mon Apr 02, 2012 10:54 am 
Offline
User avatar

Joined: Thu Feb 10, 2005 12:37 pm
Posts: 486
Location: Laurel, MD USA
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:
as sar.s


And then:
Code:
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


Top
 Profile  
 
Unread postPosted: Wed Apr 11, 2012 2:29 pm 
Offline
User avatar

Joined: Mon Jul 21, 2003 5:19 am
Posts: 724
_environ sounds almost essential...
Code:
$ 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.


Top
 Profile  
 
Unread postPosted: Wed Apr 11, 2012 2:39 pm 
Offline
User avatar

Joined: Thu Feb 10, 2005 12:37 pm
Posts: 486
Location: Laurel, MD USA
canavan wrote:
_environ sounds almost essential...
Code:
$ 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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group