LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   ldd on cross-compiled executable (https://www.linuxquestions.org/questions/linux-software-2/ldd-on-cross-compiled-executable-763015/)

ranthal 10-19-2009 02:28 PM

ldd on cross-compiled executable
 
Hey all,

I'm trying to run ldd on an x86 host for an executable file that is cross-compiled for a PowerPC I can't seem to get it to print the linked libraries. Here's what the output essentially looks like:
Code:

user$ file main
main: ELF 32-bit MSB executable, PowerPC or cisco 4500, version 1 (SYSV), dynamically linked (uses shared libs), not stripped
user$ ldd main
    not a dynamic executable

I feel like the solution is fairly obvious but I haven't been able to find it. Help?

JohnGraham 10-19-2009 04:25 PM

Right, I deleted my last post on account of me just being way, way wrong - I'd never run ldd against anything I've cross-compiled, so I went and ran it against something I thought I'd cross-compiled that I'd actually natively compiled, because I'm an idiot :p

The short of it: I don't know how ldd does its job, but my x86 ldd doesn't work on my cross-compiled ARM executables either, so it looks like it just doesn't work at all. Maybe you should take your powerpc-*-ldd compiled with your C library (if you use glibc/uClibc, at least) and run it on your target architecture?

ranthal 10-19-2009 05:03 PM

Quote:

Originally Posted by JohnGraham (Post 3725315)
The short of it: I don't know how ldd does its job, but my x86 ldd doesn't work on my cross-compiled ARM executables either, so it looks like it just doesn't work at all. Maybe you should take your powerpc-*-ldd compiled with your C library (if you use glibc/uClibc, at least) and run it on your target architecture?

Haha, well yeah, I considered that so I'll give it a shot, just gotta go through the extra steps of tftping it over. I did run readelf and got this:
Code:

Dynamic section at offset 0x3403c contains 28 entries:
  Tag        Type                        Name/Value
 0x00000001 (NEEDED)                    Shared library: [libcryptoservices.so]
 0x00000001 (NEEDED)                    Shared library: [libframework.so]
 0x00000001 (NEEDED)                    Shared library: [libtommath.so]
 0x00000001 (NEEDED)                    Shared library: [libhwaes.so]
 0x00000001 (NEEDED)                    Shared library: [libfpui.so]
 0x00000001 (NEEDED)                    Shared library: [libstdc++.so.6]
 0x00000001 (NEEDED)                    Shared library: [libm.so.0]
 0x00000001 (NEEDED)                    Shared library: [libgcc_s.so.1]
 0x00000001 (NEEDED)                    Shared library: [libc.so.0]
 0x0000000c (INIT)                      0x10008bbc
 0x0000000d (FINI)                      0x1002cd80
 0x00000004 (HASH)                      0x10000128
 0x00000005 (STRTAB)                    0x10003230
 0x00000006 (SYMTAB)                    0x10001180
 0x0000000a (STRSZ)                      19619 (bytes)
 0x0000000b (SYMENT)                    16 (bytes)
 0x00000015 (DEBUG)                      0x0
 0x00000003 (PLTGOT)                    0x10044220
 0x00000002 (PLTRELSZ)                  1896 (bytes)
 0x00000014 (PLTREL)                    RELA
 0x00000017 (JMPREL)                    0x10008454
 0x00000007 (RELA)                      0x1000834c
 0x00000008 (RELASZ)                    2160 (bytes)
 0x00000009 (RELAENT)                    12 (bytes)
 0x6ffffffe (VERNEED)                    0x100082ec
 0x6fffffff (VERNEEDNUM)                2
 0x6ffffff0 (VERSYM)                    0x10007ed4
 0x00000000 (NULL)                      0x0

The first group of libs you see in the list are the libs I was hoping it would show. This is all so I can debug it with gdb locally while running gdbserver on the target. I had it working fine about a month ago then something in our build system must have changed screwing it all up. Hmmmmm....


All times are GMT -5. The time now is 11:46 PM.