MavEtJu's Distorted View of the World

Migrating from i386 to amd64 - ldd(1) on 32 bit objects

Posted on 2008-07-04 09:00:00
Tags: FreeBSD

In the last couple of months I have migrated left-over applications on old i386 servers running FreeBSD 4.something to jails on amd64 servers running FreeBSD 6.3. It works fine, it works like a charm, thanks to the 32 bit compatibility and the misc/compat4x port. I could just copy everything in /usr/local/ to the new jail, run ldconfig -32 /usr/local/lib and everything started without problems.

There was only an issue with the ldd(1) command in the base-system:

[/] root@ed-exigent>ldd `which httpd`
ldd: /usr/local/sbin/httpd: can't read program header
ldd: /usr/local/sbin/httpd: not a dynamic executable
The man-page of rtld(1) revealed that it could work:
[/] root@ed-exigent>LD_32_TRACE_LOADED_OBJECTS=1 `which httpd` => /lib32// (0x280c8000) => /usr/local/lib/ (0x280de000) => /usr/local/lib/ (0x280f2000) => /usr/local/lib/ (0x28110000) => /usr/local/lib/ (0x281fd000) => /lib32// (0x2821d000) => not found (0x0) => /lib32// (0x28235000) => /usr/lib32/ (0x2830d000)
So ldd(1) had to be educated about the differences in the ELF header for 32 bit and 64 bit ELF objects. Once that was done, no problem at all anymore!

Patches are available at bin/124906, have been commited to HEAD and will be MFCed in a week.

| Share on Facebook | Share on Twitter
Comments: No comments yet
Leave a comment
Back to the main page