I'm trying to use a FC6 64bit to AIX 5.3.0 gcc crosscompiler I built. The program I'm compiling is just hello world: #include <stdio.h> int main() { printf("Hello world\n"); return 0; }
The command line I'm using to compile is: [EMAIL PROTECTED] ~]$ powerpc-ibm-aix5.3.0-gcc test.c When I try to run the resultant binary on an AIX 5.3.0 system is: bash-2.05b# ./a.out exec(): 0509-036 Cannot load program ./a.out because of the following errors: 0509-150 Dependent module libc.a(shr.o) could not be loaded. 0509-022 Cannot load module libc.a(shr.o). 0509-026 System error: A file or directory in the path name does not exist. Running objdump on the exectuable shows that the rpath is referring to the library paths on the host system, not the target system: [EMAIL PROTECTED] ~]$ powerpc-ibm-aix5.3.0-objdump -s a.out | grep -A20 -B2 lib64 20001098 20000828 00000006 1f000002 20000840 ..(........ ..@ 200010a8 0000000f 1f000002 2000082c 00000009 ........ ..,.... 200010b8 1f000002 2f757372 2f6c6962 36342f67 ..../usr/lib64/g 200010c8 63632f70 6f776572 70632d69 626d2d61 cc/powerpc-ibm-a 200010d8 6978352e 332e302f 342e312e 313a2f75 ix5.3.0/4.1.1:/u 200010e8 73722f6c 69623634 2f676363 2f706f77 sr/lib64/gcc/pow 200010f8 65727063 2d69626d 2d616978 352e332e erpc-ibm-aix5.3. 20001108 302f342e 312e312f 2e2e2f2e 2e2f2e2e 0/4.1.1/../../.. 20001118 2f2e2e2f 706f7765 7270632d 69626d2d /../powerpc-ibm- 20001128 61697835 2e332e30 2f6c6962 3a2f7573 aix5.3.0/lib:/us 20001138 722f706f 77657270 632d6962 6d2d6169 r/powerpc-ibm-ai 20001148 78352e33 2e302f73 79732d72 6f6f742f x5.3.0/sys-root/ 20001158 7573722f 6c69623a 2f757372 2f706f77 usr/lib:/usr/pow 20001168 65727063 2d69626d 2d616978 352e332e erpc-ibm-aix5.3. 20001178 302f7379 732d726f 6f742f75 73722f6c 0/sys-root/usr/l 20001188 6f63616c 2f6c6962 3a2f7573 722f706f ocal/lib:/usr/po 20001198 77657270 632d6962 6d2d6169 78352e33 werpc-ibm-aix5.3 200011a8 2e302f73 79732d72 6f6f742f 6c69623a .0/sys-root/lib: 200011b8 2f757372 2f706f77 65727063 2d69626d /usr/powerpc-ibm 200011c8 2d616978 352e332e 302f7379 732d726f -aix5.3.0/sys-ro 200011d8 6f742f75 73722f6c 69620000 00006c69 ot/usr/lib....li 200011e8 62632e61 00736872 2e6f0000 1b5f5f6d bc.a.shr.o...__m 200011f8 616c6c6f 635f7573 65725f64 6566696e alloc_user_defin 20001208 65645f6e 616d6500 000b5f5f 6d6f645f ed_name...__mod_ 20001218 696e6974 00000d5f 5f737472 746f6c6c init...__strtoll 20001228 6d617800 00000000 max..... I compiled binutils with the following options: ../configure --target=powerpc-ibm-aix5.3.0 x86_64-redhat-linux --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --disable-werror --with-build-sysroot=/usr/powerpc-ibm-aix5.3.0/sys-root --with-sysroot=/usr/powerpc-ibm-aix5.3.0/sys-root Since I built binutils with the sysroot option, and I verified that gcc is passing --sysroot=/usr/powerpc-ibm-aix5.3.0/sys-root, the rpath should have that part of the paths stripped out. Preferrably, any paths that are outside of the sysroot should not be included either. Now if I pass rpath to the linker, the resulting binary works: [EMAIL PROTECTED] ~]$ powerpc-ibm-aix5.3.0-gcc -Wl,-rpath,/usr/lib test.c On AIX system: bash-2.05b# ./a.out Hello world It looks like the problematic code is in aix.em: if (command_line_blibpath != NULL) libpath = command_line_blibpath; else if (command_line.rpath != NULL) libpath = command_line.rpath; else if (search_head == NULL) libpath = (char *) ""; else { size_t len; search_dirs_type *search; len = strlen (search_head->name); libpath = xmalloc (len + 1); strcpy (libpath, search_head->name); for (search = search_head->next; search != NULL; search = search->next) { size_t nlen; nlen = strlen (search->name); libpath = xrealloc (libpath, len + nlen + 2); libpath[len] = ':'; strcpy (libpath + len + 1, search->name); len += nlen + 1; } } -- Summary: Default rpath does not respect sysroot Product: binutils Version: 2.17 Status: NEW Severity: normal Priority: P1 Component: ld AssignedTo: unassigned at sources dot redhat dot com ReportedBy: kstemen at centeris dot com CC: bug-binutils at gnu dot org GCC build triplet: x86_64-redhat-linux GCC host triplet: x86_64-redhat-linux GCC target triplet: powerpc-ibm-aix5.3.0 http://sourceware.org/bugzilla/show_bug.cgi?id=4023 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils