Message ID | 5679A1F8.90008@fgznet.ch |
---|---|
State | New |
Headers | show |
On 22.12.15 20:18, Andreas Tobler wrote: > Hi all, > > The attached patch fixes a problem you get if you build dynamic binaries > for a 32-bit powerpc target on a 64-bit powerpc host. > > At the time I did this port I didn't fully understand all the scenarios > you might run into. > > The issue is this, on all FreeBSD archs the interpreter is ld-elf.so.1. > On powerpc64 we have also an ld-elf32.so.1 for 32-bit binaries. In case > we run a 32-bit binary on a 64-bit host the RTLD reroutes the call to > this ld-elf32.so.1. > > Up to now this rerouting didn't happen since gcc used the ld-elf32.so.1 > instead. The binary runs fine on the 64-bit host since the RTLD finds a > ld-elf32.so.1. > > But now when I take this binary to a 32-bit host I can't run it since > the RTLD does not find the ld-elf32.so.1. > > The patch fixes this and simplifies the LINK_OS_FREEBSD_SPEC_DEF for > FreeBSD powerpc64. > > If there are no major objections I'm going to apply this patch to trunk, > gcc-5 and gcc-49 branch in the next days. It is FreeBSD powerpc64 only > and it is a bug. Applied on the mentioned branches. Andreas > 2015-12-22 Andreas Tobler <andreast@gcc.gnu.org> > > * config/rs6000/freebsd64.h: Delete FREEBSD_DYNAMIC_LINKER32/64 > defines. Use FBSD_DYNAMIC_LINKER instead. > Rename and simplify LINK_OS_FREEBSD_SPEC_DEF32/64 to > LINK_OS_FREEBSD_SPEC_DEF. > > >
Index: freebsd64.h =================================================================== --- freebsd64.h (revision 231662) +++ freebsd64.h (working copy) @@ -167,10 +167,7 @@ { "link_os_freebsd_spec32", LINK_OS_FREEBSD_SPEC32 }, \ { "link_os_freebsd_spec64", LINK_OS_FREEBSD_SPEC64 }, -#define FREEBSD_DYNAMIC_LINKER32 "/libexec/ld-elf32.so.1" -#define FREEBSD_DYNAMIC_LINKER64 "/libexec/ld-elf.so.1" - -#define LINK_OS_FREEBSD_SPEC_DEF32 "\ +#define LINK_OS_FREEBSD_SPEC_DEF "\ %{p:%nconsider using `-pg' instead of `-p' with gprof(1)} \ %{v:-V} \ %{assert*} %{R*} %{rpath*} %{defsym*} \ @@ -178,25 +175,13 @@ %{!shared: \ %{!static: \ %{rdynamic: -export-dynamic} \ - %{!dynamic-linker:-dynamic-linker " FREEBSD_DYNAMIC_LINKER32 "}} \ + %{!dynamic-linker:-dynamic-linker " FBSD_DYNAMIC_LINKER "}} \ %{static:-Bstatic}} \ %{symbolic:-Bsymbolic}" -#define LINK_OS_FREEBSD_SPEC_DEF64 "\ - %{p:%nconsider using `-pg' instead of `-p' with gprof(1)} \ - %{v:-V} \ - %{assert*} %{R*} %{rpath*} %{defsym*} \ - %{shared:-Bshareable %{h*} %{soname*}} \ - %{!shared: \ - %{!static: \ - %{rdynamic: -export-dynamic} \ - %{!dynamic-linker:-dynamic-linker " FREEBSD_DYNAMIC_LINKER64 "}} \ - %{static:-Bstatic}} \ - %{symbolic:-Bsymbolic}" - -#define LINK_OS_FREEBSD_SPEC32 "-melf32ppc_fbsd " LINK_OS_FREEBSD_SPEC_DEF32 +#define LINK_OS_FREEBSD_SPEC32 "-melf32ppc_fbsd " LINK_OS_FREEBSD_SPEC_DEF -#define LINK_OS_FREEBSD_SPEC64 "-melf64ppc_fbsd " LINK_OS_FREEBSD_SPEC_DEF64 +#define LINK_OS_FREEBSD_SPEC64 "-melf64ppc_fbsd " LINK_OS_FREEBSD_SPEC_DEF #undef MULTILIB_DEFAULTS #define MULTILIB_DEFAULTS { "m64" }