[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ld returned 1 exit status
From: |
derrick_chi |
Subject: |
Re: ld returned 1 exit status |
Date: |
Thu, 30 Aug 2007 10:55:55 -0700 |
User-agent: |
G2/1.0 |
On Aug 20, 5:48 pm, Bikal KC <nepbabucxspamf...@yahoo.ca> wrote:
> derrick_...@msn.com wrote:
> > I am using the g++ compiler to compile the program shown below,
> > and I am getting this error "ld returned 1 exit status"
> > can anyone help me with this error.
>
> > #include "stdio.h"
> > #include "iostream."
>
> #include <iostream>
>
> You can compile your code with -
> g++ yourcode.cpp -o yourcode
>
> Normally I believe, C++ codes don't use stdio.h
> and you could *possibly* get rid of it.
>
> Cheers
I am using the following command sde-g++ -v -mtune=r2k -T ph.ld -O2
GCD.cpp -o GCD.bin, and I am having no success but if I remove
iostream the compile will run fine, the problem is that I do not
believe its creating the right mips-elf file when I look at the
assembler code from the disassembler list the code doesn't appear to
work right, following the code line by line I see mistakes that will
eventually lead to infinite loops and the c++ code I wrote is fine it
compiles in DEV C++ and runs fine but the code produced by g++ that I
am testing on my processor more than likly will not work because I
don't believe it was done correctly by the linker and compiler and I
believe its because I have to remove iostream. What do you guys
think? The Disassemebleed code is shown below, with the compile
commands I used to get the result.
sde-g++ -mtune=r2k -T ph.ld -O2 GCD.cpp -o GCD.bin
sde-objdump --disassemble --line-numbers --source GCD.bin >
disassemble.list
GCD.bin: file format elf32-tradbigmips
Disassembly of section .text:
00000000 <__do_global_dtors_aux>:
__do_global_dtors_aux():
0: 27bdffe0 addiu sp,sp,-32
4: afb10014 sw s1,20(sp)
8: 3c110001 lui s1,0x1
c: 92220020 lbu v0,32(s1)
10: afbf0018 sw ra,24(sp)
14: 14400012 bnez v0,60 <__do_global_dtors_aux+0x60>
18: afb00010 sw s0,16(sp)
1c: 10000004 b 30 <__do_global_dtors_aux+0x30>
20: 3c100001 lui s0,0x1
24: 24c50004 addiu a1,a2,4
28: 0060f809 jalr v1
2c: ae050008 sw a1,8(s0)
30: 8e040008 lw a0,8(s0)
34: 8c830000 lw v1,0(a0)
38: 1460fffa bnez v1,24 <__do_global_dtors_aux+0x24>
3c: 8e060008 lw a2,8(s0)
40: 3c070000 lui a3,0x0
44: 24e30000 addiu v1,a3,0
48: 10600003 beqz v1,58 <__do_global_dtors_aux+0x58>
4c: 3c080001 lui t0,0x1
50: 0c000000 jal 0 <__do_global_dtors_aux>
54: 25040000 addiu a0,t0,0
58: 24090001 li t1,1
5c: a2290020 sb t1,32(s1)
60: 8fbf0018 lw ra,24(sp)
64: 8fb10014 lw s1,20(sp)
68: 8fb00010 lw s0,16(sp)
6c: 03e00008 jr ra
70: 27bd0020 addiu sp,sp,32
00000074 <frame_dummy>:
frame_dummy():
74: 3c030000 lui v1,0x0
78: 27bdffe8 addiu sp,sp,-24
7c: 3c040001 lui a0,0x1
80: 3c050001 lui a1,0x1
84: 24620000 addiu v0,v1,0
88: afbf0010 sw ra,16(sp)
8c: 24840000 addiu a0,a0,0
90: 10400003 beqz v0,a0 <frame_dummy+0x2c>
94: 24a50024 addiu a1,a1,36
98: 0c000000 jal 0 <__do_global_dtors_aux>
9c: 00000000 nop
a0: 3c040001 lui a0,0x1
a4: 8c86001c lw a2,28(a0)
a8: 10c00008 beqz a2,cc <frame_dummy+0x58>
ac: 8fbf0010 lw ra,16(sp)
b0: 3c080000 lui t0,0x0
b4: 25070000 addiu a3,t0,0
b8: 10e00004 beqz a3,cc <frame_dummy+0x58>
bc: 2484001c addiu a0,a0,28
c0: 8fbf0010 lw ra,16(sp)
c4: 08000000 j 0 <__do_global_dtors_aux>
c8: 27bd0018 addiu sp,sp,24
cc: 03e00008 jr ra
d0: 27bd0018 addiu sp,sp,24
000000d4 <_Z9GCD_FUNCTjj>:
_Z9GCD_FUNCTjj():
d4: 10850007 beq a0,a1,f4 <_Z9GCD_FUNCTjj+0x20>
d8: 00000000 nop
dc: 00a4102b sltu v0,a1,a0
e0: 10400006 beqz v0,fc <_Z9GCD_FUNCTjj+0x28>
e4: 00000000 nop
e8: 00852023 subu a0,a0,a1
ec: 1485fffb bne a0,a1,dc <_Z9GCD_FUNCTjj+0x8>
f0: 00000000 nop
f4: 03e00008 jr ra
f8: 00801021 move v0,a0
fc: 1000fff5 b d4 <_Z9GCD_FUNCTjj>
100: 00a42823 subu a1,a1,a0
00000104 <main>:
main():
104: 27bdff20 addiu sp,sp,-224
108: 27a80010 addiu t0,sp,16
10c: afbf00d8 sw ra,216(sp)
110: afb100d4 sw s1,212(sp)
114: afb000d0 sw s0,208(sp)
118: 00002821 move a1,zero
11c: 01003021 move a2,t0
120: 24a2000c addiu v0,a1,12
124: 00021880 sll v1,v0,0x2
128: 24a50001 addiu a1,a1,1
12c: 30440001 andi a0,v0,0x1
130: 00621821 addu v1,v1,v0
134: 2ca7001f sltiu a3,a1,31
138: 14800002 bnez a0,144 <main+0x40>
13c: 00021080 sll v0,v0,0x2
140: 00031040 sll v0,v1,0x1
144: acc20000 sw v0,0(a2)
148: 14e0fff5 bnez a3,120 <main+0x1c>
14c: 24c60004 addiu a2,a2,4
150: 01008021 move s0,t0
154: 2411001d li s1,29
158: 8e060000 lw a2,0(s0)
15c: 8e030004 lw v1,4(s0)
160: 2631ffff addiu s1,s1,-1
164: 0066382b sltu a3,v1,a2
168: 00c02021 move a0,a2
16c: 14e00003 bnez a3,17c <main+0x78>
170: 00602821 move a1,v1
174: 00602021 move a0,v1
178: 00c02821 move a1,a2
17c: 0c000035 jal d4 <_Z9GCD_FUNCTjj>
180: 00000000 nop
184: ae020080 sw v0,128(s0)
188: 0621fff3 bgez s1,158 <main+0x54>
18c: 26100004 addiu s0,s0,4
190: 8fbf00d8 lw ra,216(sp)
194: 8fb100d4 lw s1,212(sp)
198: 8fb000d0 lw s0,208(sp)
19c: 00001021 move v0,zero
1a0: 03e00008 jr ra
1a4: 27bd00e0 addiu sp,sp,224
000001a8 <__do_global_ctors_aux>:
__do_global_ctors_aux():
1a8: 27bdffe0 addiu sp,sp,-32
1ac: 3c040001 lui a0,0x1
1b0: afb00010 sw s0,16(sp)
1b4: 24820010 addiu v0,a0,16
1b8: afbf0018 sw ra,24(sp)
1bc: afb10014 sw s1,20(sp)
1c0: 8c44fffc lw a0,-4(v0)
1c4: 2403ffff li v1,-1
1c8: 10830008 beq a0,v1,1ec <__do_global_ctors_aux+0x44>
1cc: 2450fffc addiu s0,v0,-4
1d0: 00801021 move v0,a0
1d4: 2411ffff li s1,-1
1d8: 0040f809 jalr v0
1dc: 2610fffc addiu s0,s0,-4
1e0: 8e020000 lw v0,0(s0)
1e4: 1451fffc bne v0,s1,1d8 <__do_global_ctors_aux+0x30>
1e8: 00000000 nop
1ec: 8fbf0018 lw ra,24(sp)
1f0: 8fb10014 lw s1,20(sp)
1f4: 8fb00010 lw s0,16(sp)
1f8: 03e00008 jr ra
1fc: 27bd0020 addiu sp,sp,32
Disassembly of section .init:
00000200 <_init>:
_init():
200: 27bdffe0 addiu sp,sp,-32
204: afbf0014 sw ra,20(sp)
208: 0c00001d jal 74 <frame_dummy>
20c: 00000000 nop
210: 0c00006a jal 1a8 <__do_global_ctors_aux>
214: 00000000 nop
218: 8fbf0014 lw ra,20(sp)
21c: 03e00008 jr ra
220: 27bd0020 addiu sp,sp,32
Disassembly of section .fini:
00000224 <_fini>:
_fini():
224: 27bdffe0 addiu sp,sp,-32
228: afbf0014 sw ra,20(sp)
22c: 0c000000 jal 0 <__do_global_dtors_aux>
230: 00000000 nop
234: 8fbf0014 lw ra,20(sp)
238: 03e00008 jr ra
23c: 27bd0020 addiu sp,sp,32