flatmush / dingoo-sdk

Automatically exported from code.google.com/p/dingoo-sdk
2 stars 3 forks source link

64-bit: elf2app segmentation fault #26

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Don't know if this has to do with my switching to a 64-bit linux or what, 
but now I can't get the latest trunk to compile and elf2app throws seg 
faults.

Might have something to do with work being done on dingoo.o? No clue. I ran 
install twice as per one of the previous tickets with no change.

Attached are my install and AstroLander make outputs.

Original issue reported on code.google.com by russell.bernhardt@gmail.com on 12 Apr 2010 at 11:53

Attachments:

GoogleCodeExporter commented 9 years ago
Right, that seems to be a compatibility issue with the new elf2app, not sure 
why it
would segfault on linux but not windows when it uses entirely posix functions. 
You'll
have to revert to using the old elf2app for now until I can find out why it
segfaults, unless you want to look at it, it was late at night when I made it 
so it's
probably a silly error.

Original comment by Flatmush@googlemail.com on 13 Apr 2010 at 12:18

GoogleCodeExporter commented 9 years ago
OK, I've made a few changes that could possibly fix the segfault you're 
getting. Try
the new version, and if it segfaults again then uncomment all the printf's and 
tell
me what the output is, that should give me a rough indicator of the problem.

Original comment by Flatmush@googlemail.com on 13 Apr 2010 at 12:34

GoogleCodeExporter commented 9 years ago
Still not working... Attached the output from the uncommented printf's.

Original comment by russell.bernhardt@gmail.com on 13 Apr 2010 at 12:48

Attachments:

GoogleCodeExporter commented 9 years ago
OK, try again. I've fixed a few things that may have caused it, if it still 
segfaults
then can you also uncomment the printfs inside the _import and _export 
functions too.

Original comment by Flatmush@googlemail.com on 13 Apr 2010 at 12:35

GoogleCodeExporter commented 9 years ago

Original comment by Flatmush@googlemail.com on 13 Apr 2010 at 12:46

GoogleCodeExporter commented 9 years ago

Original comment by Flatmush@googlemail.com on 13 Apr 2010 at 4:37

GoogleCodeExporter commented 9 years ago
I'll test it this afternoon. I'm also downloading a 32-bit linux to test on it 
see if 
this is a 64-bit only issue or not. I'll follow up with what I find.

Original comment by russell.bernhardt@gmail.com on 13 Apr 2010 at 11:08

GoogleCodeExporter commented 9 years ago
Confirmed this is a 64-bit only issue. 32-bit linux compiles without a problem, 
but 
64-bit still seg faults on elf2app. Attached make output, but basically same 
results 
as before. Had already uncommented the _import and _export printf's.

I'll just stick to 32-bit linux for now for simplicity, but this should remain 
an open 
issue in case someone else attempt to report it.

Original comment by russell.bernhardt@gmail.com on 14 Apr 2010 at 6:16

GoogleCodeExporter commented 9 years ago
Forgot to attach make output. Here it is.

Original comment by russell.bernhardt@gmail.com on 14 Apr 2010 at 6:22

Attachments:

GoogleCodeExporter commented 9 years ago
Ok, I found out why it was breaking on a 64-bit system (I think). I was using
uintptr_t in some places instead of uint32_t (since it's a 32-bit app file). 
I've
corrected the issues and modified the printf/scanf calls to use the correct 
tokens.

Try this new one, and as always if it doesn't work post the output, but I 
suspect it
might work this time.

Original comment by Flatmush@googlemail.com on 14 Apr 2010 at 10:32

GoogleCodeExporter commented 9 years ago
Since it's only on 64-bit, this isn't quite so critical now, reduced priority 
to High.

Original comment by Flatmush@googlemail.com on 14 Apr 2010 at 10:33

GoogleCodeExporter commented 9 years ago
Ready for some weirdness?

In $DINGOO_SDK/samples/AstroLander:

"../../tools/elf2app/elf2app AstroLander" works
"$DINGOO_SDK/tools/elf2app/elf2app AstroLander" seg faults

No idea what the deal with that is. Might be an OS issue, but something like:

"$MIPSTOOLS/bin/mipsel-linux-gcc" works just fine, so I don't think it's an 
environment variable resolution issue... but like I said, seems to be an OS 
issue as 
there should be no difference between:

"../../tools/elf2app/elf2app" and "$DINGOO_SDK/tools/elf2app/elf2app".

Strange. Dunno if you want to consider this "closed" or if you know what's 
going on.

In the meantime, I've modified my AstroLander Makefile to use a relative path 
instead 
of the variable path to elf2app and it seems to be working. I won't commit it 
as it 
seems to be an issue only on my 64-bit system. May be a good topic for a "known 
issues" wiki page.

For the record, I'm using Ubuntu 9.10 64-bit.

Original comment by russell.bernhardt@gmail.com on 14 Apr 2010 at 3:37

GoogleCodeExporter commented 9 years ago
I think it's something that can be fixed. I use the path passed into argv[0] to
calculate the current path, then use the known current path to load the import 
and
export tables. It could be a problem there, whereby the path passed into 
argv[0] is
literally what was typed at the commandline, and then fopen doesn't correctly 
resolve
environment variables.

Try replacing the fopen part of that with a popen and cat, cause that will 
resolve
environment variables, either that or we could make it resolve environment vars 
ourself.

Original comment by Flatmush@googlemail.com on 14 Apr 2010 at 7:11

GoogleCodeExporter commented 9 years ago
That's so lame! It's completely the OS's job to resolve environment variables 
IMO. Oh 
well. I'll mess with it later then, for now I got the Windows/Cygwin config 
going just 
because I got tired of rebooting; that and I can't access my Dingoo's internal 
memory 
from Linux.

Original comment by russell.bernhardt@gmail.com on 14 Apr 2010 at 7:48

GoogleCodeExporter commented 9 years ago
I wrote a quick test to make sure my OS is properly resolving environment 
variables 
and it seems to be working just fine. I wrote the attached parser to test it 
and in 
Cygwin and in 64-bit Linux the raw string is always parsed by the OS before 
it's 
passed to the application, so I don't think fopen is the issue. I'll continue 
looking 
at this and see if I can't trace the problem.

Original comment by russell.bernhardt@gmail.com on 18 Apr 2010 at 7:29

Attachments:

GoogleCodeExporter commented 9 years ago
one more bug found (see revision 207)
please test your cases

Original comment by djd...@gmail.com on 15 Jul 2010 at 5:56