Bug 62103 - iconv_open() problem for IA32 application on IA64 system
Summary: iconv_open() problem for IA32 application on IA64 system
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: x86-compat-libs
Version: 7.2
Hardware: ia64
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-03-27 15:36 UTC by IBM Bug Proxy
Modified: 2015-06-29 06:31 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-04-19 18:20:11 UTC
Embargoed:


Attachments (Terms of Use)

Description IBM Bug Proxy 2002-03-27 15:36:09 UTC
THE PROBLEM
===========

A 32-bit binary that calls the iconv_open() routine does not appear to work on
an IA64 system.  When such a program is run on the IA64 system, iconv_open()
returns an errno value of 22 (EINVAL).  The iconv_open() routine sets that
errno value when the codeset conversion being requested is not supported by
the system.

If the program is re-compiled on the IA64 system, it will run correctly.  That
is, the iconv_open() routine will return an indication of success.

If the codeset conversion modules from /usr/lib/gconv are ftp'ed from an i686
system onto the IA64 system and the GCONV_PATH environment variable is set
to point to the directory holding the ftp'ed conversion modules, the 32-bit
binary will run.

So the root of the problem appears to be that iconv_open() causes some shared
objects in /usr/lib/gconv to be loaded into the address space of the program.
If the program is a 32-bit binary, the loading fails because the shared
objects in /usr/lib/gconv are 64-bit objects.  Note that this loading is 
dynamic, that is, iconv_open() uses dlopen() to load the modules it needs.

The following section illustrates the program.  The section after that
contains commentary.


PROBLEM ILLUSTRATION
====================

[01] /tmp/agar # ls -l
total 8
drwxr-xr-x    3 root     root         4096 Mar 19 17:11 ftped32
drwxr-xr-x    2 root     root         4096 Mar 19 17:03 native64

[02] /tmp/agar # cd native64
/tmp/agar/native64 # ls -l
total 20
-rwxr-xr-x    1 root     root        14865 Mar 19 17:03 iconvopen
-rw-r--r--    1 root     root          318 Mar 19 17:02 iconvopen.c

[03] /tmp/agar/native64 # cat iconvopen.c
#include <unistd.h>
#include <stdio.h>
#include <iconv.h>
#include <errno.h>


int main(int argc, char **argv)
{
    iconv_t cd;


        cd = iconv_open("UTF-8", "ISO8859-1");

        if (cd == (iconv_t)-1) {
                printf("iconv_open() failed with errno %d.\n", errno);
        } else {
                printf("iconv_open() worked.\n");
        }

        return 0;
}

[04] /tmp/agar/native64 # objdump -T iconvopen

iconvopen:     file format elf64-ia64-little

DYNAMIC SYMBOL TABLE:
0000000000000000      DF *UND*  00000000000000a0  GLIBC_2.2   printf
0000000000000000      DF *UND*  0000000000000020  GLIBC_2.2   __errno_location
0000000000000000      DF *UND*  00000000000005e0  GLIBC_2.2   iconv_open
0000000000000000      DF *UND*  0000000000000250  GLIBC_2.2   __libc_start_main

[05] /tmp/agar/native64 # ./iconvopen
iconv_open() worked.

[06] /tmp/agar/native64 # cd ../ftped32

[07] /tmp/agar/ftped32 # ls -l
total 28
drwxr-xr-x    2 root     root         4096 Mar 19 17:14 gconv32
-rwxr-xr-x    1 root     root        14066 Mar 19 17:06 iconvopen
-rw-r--r--    1 root     root          318 Mar 19 17:06 iconvopen.c
-rwxr-xr-x    1 root     root           54 Mar 19 17:11 iconvopen.sh

[08] /tmp/agar/ftped32 # objdump -T iconvopen

iconvopen:     file format elf32-little

DYNAMIC SYMBOL TABLE:
000000000804837c  w   DF *UND*  0000000000000081  GLIBC_2.0   
__register_frame_i\
nfo
000000000804838c      DF *UND*  0000000000000216  GLIBC_2.1   iconv_open
000000000804839c      DF *UND*  0000000000000018  GLIBC_2.0   __errno_location
00000000080483ac  w   DF *UND*  00000000000000ac  GLIBC_2.0   
__deregister_frame\
_info
00000000080483bc      DF *UND*  00000000000000ca  GLIBC_2.0   __libc_start_main
00000000080483cc      DF *UND*  0000000000000032  GLIBC_2.0   printf
00000000080483dc  w   DF *UND*  000000000000009d  GLIBC_2.1.3 __cxa_finalize
00000000080485c4 g    DO .rodata        0000000000000004  Base        
_IO_stdin_\
used
0000000000000000  w   D  *UND*  0000000000000000              __gmon_start__

[09] /tmp/agar/ftped32 # ./iconvopen
iconv_open() failed with errno 22.

[10] /tmp/agar/ftped32 # cat iconvopen.sh
#!/bin/ksh

export GCONV_PATH=./gconv32
./iconvopen

[11] /tmp/agar/ftped32 # ls -l ./gconv32
total 4128
-rwxr-xr-x    1 root     root        18360 Mar 19 17:14 ANSI_X3.110.so
-rwxr-xr-x    1 root     root         7960 Mar 19 17:14 ASMO_449.so
-rwxr-xr-x    1 root     root       124660 Mar 19 17:14 BIG5HKSCS.so
-rwxr-xr-x    1 root     root        83992 Mar 19 17:14 BIG5.so
-rwxr-xr-x    1 root     root         8216 Mar 19 17:14 CP1250.so
-rwxr-xr-x    1 root     root         8120 Mar 19 17:14 CP1251.so
-rwxr-xr-x    1 root     root         8120 Mar 19 17:14 CP1252.so
-rwxr-xr-x    1 root     root         8088 Mar 19 17:14 CP1253.so
-rwxr-xr-x    1 root     root         8152 Mar 19 17:14 CP1254.so
-rwxr-xr-x    1 root     root         8120 Mar 19 17:14 CP1255.so
-rwxr-xr-x    1 root     root         8248 Mar 19 17:14 CP1256.so
-rwxr-xr-x    1 root     root         8216 Mar 19 17:14 CP1257.so
-rwxr-xr-x    1 root     root         8184 Mar 19 17:14 CP1258.so
-rwxr-xr-x    1 root     root         8208 Mar 19 17:14 CP737.so
-rwxr-xr-x    1 root     root         8296 Mar 19 17:14 CP775.so
-rwxr-xr-x    1 root     root         8120 Mar 19 17:14 CSN_369103.so
-rwxr-xr-x    1 root     root         8280 Mar 19 17:14 CWI.so
-rwxr-xr-x    1 root     root         8056 Mar 19 17:14 DEC-MCS.so
-rwxr-xr-x    1 root     root         7928 Mar 19 17:14 EBCDIC-AT-DE-A.so
-rwxr-xr-x    1 root     root         7928 Mar 19 17:14 EBCDIC-AT-DE.so
-rwxr-xr-x    1 root     root         7928 Mar 19 17:14 EBCDIC-CA-FR.so
-rwxr-xr-x    1 root     root         7928 Mar 19 17:14 EBCDIC-DK-NO-A.so
-rwxr-xr-x    1 root     root         7928 Mar 19 17:14 EBCDIC-DK-NO.so
-rwxr-xr-x    1 root     root        16024 Mar 19 17:14 EBCDIC-ES-A.so
-rwxr-xr-x    1 root     root        16024 Mar 19 17:14 EBCDIC-ES.so
-rwxr-xr-x    1 root     root         7896 Mar 19 17:14 EBCDIC-ES-S.so
-rwxr-xr-x    1 root     root         7928 Mar 19 17:14 EBCDIC-FI-SE-A.so
-rwxr-xr-x    1 root     root         7928 Mar 19 17:14 EBCDIC-FI-SE.so
-rwxr-xr-x    1 root     root         7928 Mar 19 17:14 EBCDIC-FR.so
-rwxr-xr-x    1 root     root        15896 Mar 19 17:14 EBCDIC-IS-FRISS.so
-rwxr-xr-x    1 root     root         7928 Mar 19 17:14 EBCDIC-IT.so
-rwxr-xr-x    1 root     root         7928 Mar 19 17:14 EBCDIC-PT.so
-rwxr-xr-x    1 root     root        15928 Mar 19 17:14 EBCDIC-UK.so
-rwxr-xr-x    1 root     root         7832 Mar 19 17:14 EBCDIC-US.so
-rwxr-xr-x    1 root     root         7992 Mar 19 17:14 ECMA-CYRILLIC.so
-rwxr-xr-x    1 root     root        13512 Mar 19 17:14 EUC-CN.so
-rwxr-xr-x    1 root     root        12404 Mar 19 17:14 EUC-JP.so
-rwxr-xr-x    1 root     root        10880 Mar 19 17:14 EUC-KR.so
-rwxr-xr-x    1 root     root        17892 Mar 19 17:14 EUC-TW.so
-rwxr-xr-x    1 root     root       187960 Mar 19 17:14 GB18030.so
-rwxr-xr-x    1 root     root        52668 Mar 19 17:14 GBBIG5.so
-rwxr-xr-x    1 root     root         7944 Mar 19 17:14 GBGBK.so
-rwxr-xr-x    1 root     root       109572 Mar 19 17:14 GBK.so
-rwxr-xr-x    1 root     root        38489 Mar 19 17:14 gconv-modules
-rwxr-xr-x    1 root     root         8024 Mar 19 17:14 GOST_19768-74.so
-rwxr-xr-x    1 root     root         7992 Mar 19 17:14 GREEK7-OLD.so
-rwxr-xr-x    1 root     root         7960 Mar 19 17:14 GREEK7.so
-rwxr-xr-x    1 root     root         7960 Mar 19 17:14 GREEK-CCITT.so
-rwxr-xr-x    1 root     root        17304 Mar 19 17:14 HP-ROMAN8.so
-rwxr-xr-x    1 root     root         7928 Mar 19 17:14 IBM037.so
-rwxr-xr-x    1 root     root         7832 Mar 19 17:14 IBM038.so
-rwxr-xr-x    1 root     root         8120 Mar 19 17:14 IBM1004.so
-rwxr-xr-x    1 root     root         8088 Mar 19 17:14 IBM1026.so
-rwxr-xr-x    1 root     root         8440 Mar 19 17:14 IBM1046.so
-rwxr-xr-x    1 root     root         7928 Mar 19 17:14 IBM1047.so
-rwxr-xr-x    1 root     root         8120 Mar 19 17:14 IBM1124.so
-rwxr-xr-x    1 root     root         8152 Mar 19 17:14 IBM1129.so
-rwxr-xr-x    1 root     root         8088 Mar 19 17:14 IBM256.so
-rwxr-xr-x    1 root     root         8056 Mar 19 17:14 IBM273.so
-rwxr-xr-x    1 root     root         7928 Mar 19 17:14 IBM274.so
-rwxr-xr-x    1 root     root         7896 Mar 19 17:14 IBM275.so
-rwxr-xr-x    1 root     root         8056 Mar 19 17:14 IBM277.so
-rwxr-xr-x    1 root     root         8056 Mar 19 17:14 IBM278.so
-rwxr-xr-x    1 root     root         8056 Mar 19 17:14 IBM280.so
-rwxr-xr-x    1 root     root         7960 Mar 19 17:14 IBM281.so
-rwxr-xr-x    1 root     root         8056 Mar 19 17:14 IBM284.so
-rwxr-xr-x    1 root     root         8056 Mar 19 17:14 IBM285.so
-rwxr-xr-x    1 root     root         8056 Mar 19 17:14 IBM290.so
-rwxr-xr-x    1 root     root         8056 Mar 19 17:14 IBM297.so
-rwxr-xr-x    1 root     root         8184 Mar 19 17:14 IBM420.so
-rwxr-xr-x    1 root     root         8632 Mar 19 17:14 IBM423.so
-rwxr-xr-x    1 root     root         8024 Mar 19 17:14 IBM424.so
-rwxr-xr-x    1 root     root         8312 Mar 19 17:14IBM437.so
-rwxr-xr-x    1 root     root         7928 Mar 19 17:14 IBM500.so
-rwxr-xr-x    1 root     root         8184 Mar 19 17:14 IBM850.so
-rwxr-xr-x    1 root     root         8248 Mar 19 17:14 IBM851.so
-rwxr-xr-x    1 root     root         8280 Mar 19 17:14 IBM852.so
-rwxr-xr-x    1 root     root         8184 Mar 19 17:14 IBM855.so
-rwxr-xr-x    1 root     root         8600 Mar 19 17:14 IBM856.so
-rwxr-xr-x    1 root     root         8184 Mar 19 17:14 IBM857.so
-rwxr-xr-x    1 root     root         8280 Mar 19 17:14 IBM860.so
-rwxr-xr-x    1 root     root         8312 Mar 19 17:14 IBM861.so
-rwxr-xr-x    1 root     root         8312 Mar 19 17:14 IBM862.so
-rwxr-xr-x    1 root     root         8312 Mar 19 17:14 IBM863.so
-rwxr-xr-x    1 root     root         8280 Mar 19 17:14 IBM864.so
-rwxr-xr-x    1 root     root         8312 Mar 19 17:14 IBM865.so
-rwxr-xr-x    1 root     root         8280 Mar 19 17:14 IBM868.so
-rwxr-xr-x    1 root     root         8184 Mar 19 17:14 IBM869.so
-rwxr-xr-x    1 root     root         8408 Mar 19 17:14 IBM870.so
-rwxr-xr-x    1 root     root         7928 Mar 19 17:14 IBM871.so
-rwxr-xr-x    1 root     root         8056 Mar 19 17:14 IBM874.so
-rwxr-xr-x    1 root     root         8056 Mar 19 17:14 IBM875.so
-rwxr-xr-x    1 root     root         8056 Mar 19 17:14 IBM880.so
-rwxr-xr-x    1 root     root         7800 Mar 19 17:14 IBM891.so
-rwxr-xr-x    1 root     root         7800 Mar 19 17:14 IBM903.so
-rwxr-xr-x    1 root     root         7832 Mar 19 17:14 IBM904.so
-rwxr-xr-x    1 root     root         8408 Mar 19 17:14 IBM905.so
-rwxr-xr-x    1 root     root         8152 Mar 19 17:14 IBM918.so
-rwxr-xr-x    1 root     root         8408 Mar 19 17:14 IBM922.so
-rwxr-xr-x    1 root     root       247604 Mar 19 17:14 IBM930.so
-rwxr-xr-x    1 root     root        66496 Mar 19 17:14 IBM932.so
-rwxr-xr-x    1 root     root       255584 Mar 19 17:14 IBM933.so
-rwxr-xr-x    1 root     root       202432 Mar 19 17:14 IBM935.so
-rwxr-xr-x    1 root     root       256196 Mar 19 17:14 IBM937.so
-rwxr-xr-x    1 root     root       247572 Mar 19 17:14 IBM939.so
-rwxr-xr-x    1 root     root        67496 Mar 19 17:14 IBM943.so
-rwxr-xr-x    1 root     root         8216 Mar 19 17:14 IEC_P27-1.so
-rwxr-xr-x    1 root     root         7960 Mar 19 17:14 INIS-8.so
-rwxr-xr-x    1 root     root         7992 Mar 19 17:14 INIS-CYRILLIC.so
-rwxr-xr-x    1 root     root         7896 Mar 19 17:14 INIS.so
-rwxr-xr-x    1 root     root         8120 Mar 19 17:14 ISIRI-3342.so
-rwxr-xr-x    1 root     root         8088 Mar 19 17:14 ISO_10367-BOX.so
-rwxr-xr-x    1 root     root        38360 Mar 19 17:14 ISO-2022-CN-EXT.so
-rwxr-xr-x    1 root     root        28876 Mar 19 17:14 ISO-2022-CN.so
-rwxr-xr-x    1 root     root        36528 Mar 19 17:14 ISO-2022-JP.so
-rwxr-xr-x    1 root     root        11844 Mar 19 17:14 ISO-2022-KR.so
-rwxr-xr-x    1 root     root         7864 Mar 19 17:14 ISO_2033.so
-rwxr-xr-x    1 root     root         7928 Mar 19 17:14 ISO_5427-EXT.so
-rwxr-xr-x    1 root     root         7928 Mar 19 17:14 ISO_5427.so
-rwxr-xr-x    1 root     root         7992 Mar 19 17:14 ISO_5428.so
-rwxr-xr-x    1 root     root        18048 Mar 19 17:14 ISO646.so
-rwxr-xr-x    1 root     root        17752 Mar 19 17:14 ISO_6937-2.so
-rwxr-xr-x    1 root     root        17496 Mar 19 17:14 ISO_6937.so
-rwxr-xr-x    1 root     root         8120 Mar 19 17:14 ISO8859-10.so
-rwxr-xr-x    1 root     root         8056 Mar 19 17:14 ISO8859-11.so
-rwxr-xr-x    1 root     root         8120 Mar 19 17:14 ISO8859-13.so
-rwxr-xr-x    1 root     root         8088 Mar 19 17:14 ISO8859-14.so
-rwxr-xr-x    1 root     root         8024 Mar 19 17:14 ISO8859-15.so
-rwxr-xr-x    1 root     root        15960 Mar 19 17:14 ISO8859-16.so
-rwxr-xr-x    1 root     root         6416 Mar 19 17:14 ISO8859-1.so
-rwxr-xr-x    1 root     root         8344 Mar 19 17:14 ISO8859-2.so
-rwxr-xr-x    1 root     root         8408 Mar 19 17:14 ISO8859-3.so
-rwxr-xr-x    1 root     root         8344 Mar 19 17:14 ISO8859-4.so
-rwxr-xr-x    1 root     root         7992 Mar 19 17:14 ISO8859-5.so
-rwxr-xr-x    1 root     root         9272 Mar 19 17:14 ISO8859-6.so
-rwxr-xr-x    1 root     root         8056 Mar 19 17:14 ISO8859-7.so
-rwxr-xr-x    1 root     root         8056 Mar 19 17:14 ISO8859-8.so
-rwxr-xr-x    1 root     root         7960 Mar 19 17:14 ISO8859-9.so
-rwxr-xr-x    1 root     root         8184 Mar 19 17:14 ISO-IR-197.so
-rwxr-xr-x    1 root     root        14680 Mar 19 17:14 JOHAB.so
-rwxr-xr-x    1 root     root         8216 Mar 19 17:14 KOI8-R.so
-rwxr-xr-x    1 root     root         8760 Mar 19 17:14 KOI-8.so
-rwxr-xr-x    1 root     root         8184 Mar 19 17:14 KOI8-U.so
-rwxr-xr-x    1 root     root         7960 Mar 19 17:14 LATIN-GREEK-1.so
-rwxr-xr-x    1 root     root         7960 Mar 19 17:14 LATIN-GREEK.so
-rwxr-xr-x    1 root     root       157488 Mar 19 17:14 libCNS.so
-rwxr-xr-x    1 root     root        65240 Mar 19 17:14 libGB.so
-rwxr-xr-x    1 root     root        56220 Mar 19 17:14 libISOIR165.so
-rwxr-xr-x    1 root     root        98632 Mar 19 17:14 libJIS.so
-rwxr-xr-x    1 root     root        44860 Mar 19 17:14 libKSC.so
-rwxr-xr-x    1 root     root         8248 Mar 19 17:14 MACINTOSH.so
-rwxr-xr-x    1 root     root         8248 Mar 19 17:14 MAC-IS.so
-rwxr-xr-x    1 root     root         8088 Mar 19 17:14 MAC-UK.so
-rwxr-xr-x    1 root     root         7992 Mar 19 17:14 NATS-DANO.so
-rwxr-xr-x    1 root     root         7960 Mar 19 17:14 NATS-SEFI.so
-rwxr-xr-x    1 root     root         8184 Mar 19 17:14 SAMI-WS2.so
-rwxr-xr-x    1 root     root        91064 Mar 19 17:14 SJIS.so
-rwxr-xr-x    1 root     root        16536 Mar 19 17:14 T.61.so
-rwxr-xr-x    1 root     root         7992 Mar 19 17:14 TIS-620.so
-rwxr-xr-x    1 root     root        69852 Mar 19 17:14 UHC.so
-rwxr-xr-x 1 root     root         7492 Mar 19 17:14 UNICODE.so
-rwxr-xr-x    1 root     root        10032 Mar 19 17:14 UTF-16.so
-rwxr-xr-x    1 root     root        22400 Mar 19 17:14 UTF-7.so
-rwxr-xr-x    1 root     root        15544 Mar 19 17:14 VISCII.so

[12] /tmp/agar/ftped32 # objdump -T ./gconv32/ISO8859-1.so

./gconv32/ISO8859-1.so:     file format elf32-little

DYNAMIC SYMBOL TABLE:
00000000000000b4 l    d  .note.ABI-tag  0000000000000000
00000000000000d4 l    d  .hash  0000000000000000
0000000000000234 l    d  .dynsym        0000000000000000
0000000000000544 l    d  .dynstr        0000000000000000
0000000000000682 l    d  .gnu.version   0000000000000000
00000000000006e4 l    d  .gnu.version_r 0000000000000000
0000000000000734 l    d  .rel.data      0000000000000000
0000000000000744 l    d  .rel.got       0000000000000000
000000000000076c l    d  .rel.plt       0000000000000000
00000000000007cc l    d  .init  0000000000000000
00000000000007e4 l    d  .plt   0000000000000000
00000000000008c0 l    d  .text  0000000000000000
000000000000134c l    d  .fini  0000000000000000
000000000000136a l    d  .rodata        0000000000000000
0000000000002378 l    d  .data  0000000000000000
0000000000002384 l    d  .eh_frame      0000000000000000
0000000000002388 l    d  .ctors 0000000000000000
0000000000002390 l    d  .dtors 0000000000000000
0000000000002398 l    d  .got   0000000000000000
00000000000023e8 l    d  .dynamic       0000000000000000
0000000000002480 l    d  .sbss  0000000000000000
0000000000002480 l    d  .bss   0000000000000000
0000000000000000 l    d  *ABS*  0000000000000000
0000000000000000 l    d  *ABS*  0000000000000000
0000000000000000 l    d  *ABS*  0000000000000000
0000000000000000 l    d  *ABS*  0000000000000000
00000000000023e8 g    DO *ABS*  0000000000000000  Base        _DYNAMIC
0000000000000000  w   DF *UND*  0000000000000081  GLIBC_2.0   
__register_frame_i\
nfo
0000000000000000      DF *UND*  0000000000000038  GLIBC_2.1   
_dl_mcount_wrapper\
_check
0000000000000000      DF *UND*  0000000000000040  GLIBC_2.1.3 __cxa_atexit
00000000000007cc g    DF .init  0000000000000000  Base        _init
0000000000000000  w   DF *UND*  00000000000000ac  GLIBC_2.0   
__deregister_frame\
_info
0000000000000000      DF *UND*  000000000000032f  GLIBC_2.0   __xstat
0000000000000000      DF *UND*  000000000000032f  GLIBC_2.0   __fxstat
0000000000000000      DF *UND*  000000000000032f  GLIBC_2.0   __lxstat
0000000000000000      DF *UND*  0000000000000197  GLIBC_2.2   __xstat64
0000000000002480 g    DO *ABS*  0000000000000000  Base        __bss_start
000000000000134c g    DF .fini  0000000000000000  Base        _fini
0000000000000000  w   DF *UND*  000000000000009d  GLIBC_2.1.3 __cxa_finalize
00000000000009f4 g    DF .text  00000000000000d3  Base        gconv_init
0000000000000000      DF *UND*  0000000000000197  GLIBC_2.2   __lxstat64
0000000000000ad0 g    DF .text  000000000000068b  Base        gconv
0000000000002480 g    DO *ABS*  0000000000000000  Base        _edata
0000000000002398 g    DO *ABS*  0000000000000000  Base        
_GLOBAL_OFFSET_TAB\
LE_
00000000000024a0 g    DO *ABS*  0000000000000000  Base        _end
0000000000000000      DF *UND*  000000000000007c  GLIBC_2.0   __xmknod
0000000000000000      DF *UND*  0000000000000197  GLIBC_2.2   __fxstat64
0000000000000000  w   D  *UND*  0000000000000000              __gmon_start__


[13] /tmp/agar/ftped32 # ./iconvopen.sh
iconv_open() worked.


ILLUSTRATION COMMENTARY
=======================

[02]: The directory /tmp/agar/native64 holds the source code and 64-bit binary
      of the test program.

[03]: The test program simply tries to call iconv_open() specifying some
      common codesets.

[04]: objdump shows the binary is a 64-bit binary.

[05]: The 64-bit binary works.

[07]: The directory /tmp/agar/ftped32 holds the source code and 32-bit binary
      of the test program that had been ftp'ed from another machine.

[08]: objdump shows the binary is a 32-bit binary.

[09]: The 32-bit binary fails.

[10]: The shell script sets GCONV_PATH and runs the 32-bit binary.

[11]: The directory the shell script references in its setting of GCONV_PATH
      contains the gconv modules I ftp'ed from an i686 system.

[12]: objdump shows one of the gconv binaries is a 32-bit binary.

[13]: When the 32-bit binary test program is run with the 32-bit binary gconv
      shared objects, it works.

REDHAT PACKAGING
================

Redhat 7.2 includes an RPM for x86 compatibility.  This RPM includes
compatibility libraries for 32-bit binaries.  It does not seem to include the
iconv modules that are normally loaded out of /usr/lib/gconv by the
iconv_open() routine.  32-bit version of these modules are needed for 32-bit
applications that call iconv_open().

# rpm -qil x86-compat-libs

Name        : x86-compat-libs              Relocations: (not relocateable)
Version     : 7.2                               Vendor: Red Hat, Inc.
Release     : 1                             Build Date: Mon 12 Nov 2001 01:58:45
\
 PM EST
Install date: Mon 31 Dec 2001 07:51:59 AM EST      Build Host: 
stripples.devel.r\
edhat.com
Group       : Development/Libraries         Source RPM: x86-compat-libs-7.2-
1.sr\
c.rpm
Size        : 18314631                         License: GPL/LGPL/X11/MIT
Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Summary     : Runtime libraries for ix86 Red Hat Linux 7.1 compatibility
Description :
This package includes a number of run-time libraries that are compiled on
Red Hat Linux 7.1 for Intel. This package is required if you want run
ix86 binaries on your ia64 system.
/lib/ld-linux.so.2
/usr/i386-glibc22-linux/lib/libBrokenLocale-2.2.4.so
/usr/i386-glibc22-linux/lib/libBrokenLocale.so.1
/usr/i386-glibc22-linux/lib/libGL.so.1
/usr/i386-glibc22-linux/lib/libGL.so.1.2.030402
/usr/i386-glibc22-linux/lib/libGLU.so.1
/usr/i386-glibc22-linux/lib/libGLU.so.1.1.030402
/usr/i386-glibc22-linux/lib/libICE.so.6
/usr/i386-glibc22-linux/lib/libICE.so.6.3
/usr/i386-glibc22-linux/lib/libNoVersion-2.2.4.so
/usr/i386-glibc22-linux/lib/libNoVersion.so.1
/usr/i386-glibc22-linux/lib/libPEX5.so.6
/usr/i386-glibc22-linux/lib/libPEX5.so.6.0
/usr/i386-glibc22-linux/lib/libSM.so.6
/usr/i386-glibc22-linux/lib/libSM.so.6.0
/usr/i386-glibc22-linux/lib/libX11.so.6
/usr/i386-glibc22-linux/lib/libX11.so.6.2
/usr/i386-glibc22-linux/lib/libXIE.so.6
/usr/i386-glibc22-linux/lib/libXIE.so.6.0
/usr/i386-glibc22-linux/lib/libXaw.so.6
/usr/i386-glibc22-linux/lib/libXaw.so.6.1
/usr/i386-glibc22-linux/lib/libXaw.so.7
/usr/i386-glibc22-linux/lib/libXaw.so.7.0
/usr/i386-glibc22-linux/lib/libXaw3d.so.6
/usr/i386-glibc22-linux/lib/libXaw3d.so.6.1
/usr/i386-glibc22-linux/lib/libXaw3d.so.7
/usr/i386-glibc22-linux/lib/libXaw3d.so.7.0
/usr/i386-glibc22-linux/lib/libXext.so.6
/usr/i386-glibc22-linux/lib/libXext.so.6.4
/usr/i386-glibc22-linux/lib/libXfont.so.1
/usr/i386-glibc22-linux/lib/libXfont.so.1.3
/usr/i386-glibc22-linux/lib/libXft.so.1
/usr/i386-glibc22-linux/lib/libXft.so.1.0
/usr/i386-glibc22-linux/lib/libXi.so.6
/usr/i386-glibc22-linux/lib/libXi.so.6.0
/usr/i386-glibc22-linux/lib/libXmu.so.6
/usr/i386-glibc22-linux/lib/libXmu.so.6.2
/usr/i386-glibc22-linux/lib/libXp.so.6
/usr/i386-glibc22-linux/lib/libXp.so.6.2
/usr/i386-glibc22-linux/lib/libXpm.so.4
/usr/i386-glibc22-linux/lib/libXpm.so.4.11
/usr/i386-glibc22-linux/lib/libXrender.so.1
/usr/i386-glibc22-linux/lib/libXrender.so.1.0
/usr/i386-glibc22-linux/lib/libXt.so.6
/usr/i386-glibc22-linux/lib/libXt.so.6.0
/usr/i386-glibc22-linux/lib/libXtst.so.6
/usr/i386-glibc22-linux/lib/libXtst.so.6.1
/usr/i386-glibc22-linux/lib/libaudiofile.so.0
/usr/i386-glibc22-linux/lib/libaudiofile.so.0.0.1
/usr/i386-glibc22-linux/lib/libbz2.so.1
/usr/i386-glibc22-linux/lib/libbz2.so.1.0.0
/usr/i386-glibc22-linux/lib/libc-2.2.4.so
/usr/i386-glibc22-linux/lib/libc.so.6
/usr/i386-glibc22-linux/lib/libcom_err.so.2
/usr/i386-glibc22-linux/lib/libcom_err.so.2.0
/usr/i386-glibc22-linux/lib/libcom_err.so.3
/usr/i386-glibc22-linux/lib/libcom_err.so.3.0
/usr/i386-glibc22-linux/lib/libcrack.so.2
/usr/i386-glibc22-linux/lib/libcrack.so.2.7
/usr/i386-glibc22-linux/lib/libcrypt-2.2.4.so
/usr/i386-glibc22-linux/lib/libcrypt.so.1
/usr/i386-glibc22-linux/lib/libcrypto.so.0.9.6b
/usr/i386-glibc22-linux/lib/libcrypto.so.2
/usr/i386-glibc22-linux/lib/libdb-3.2.so
/usr/i386-glibc22-linux/lib/libdb.so.2
/usr/i386-glibc22-linux/lib/libdb.so.3
/usr/i386-glibc22-linux/lib/libdb1.so.2
/usr/i386-glibc22-linux/lib/libdb2.so.3
/usr/i386-glibc22-linux/lib/libdes425.so.3
/usr/i386-glibc22-linux/lib/libdes425.so.3.0
/usr/i386-glibc22-linux/lib/libdl-2.2.4.so
/usr/i386-glibc22-linux/lib/libdl.so.2
/usr/i386-glibc22-linux/lib/libdps.so.1
/usr/i386-glibc22-linux/lib/libdps.so.1.0
/usr/i386-glibc22-linux/lib/libdpstk.so.1
/usr/i386-glibc22-linux/lib/libdpstk.so.1.0
/usr/i386-glibc22-linux/lib/libdyn.so.1
/usr/i386-glibc22-linux/lib/libdyn.so.1.0
/usr/i386-glibc22-linux/lib/libform.so.5
/usr/i386-glibc22-linux/lib/libform.so.5.2
/usr/i386-glibc22-linux/lib/libfreetype.so.6
/usr/i386-glibc22-linux/lib/libfreetype.so.6.0.1
/usr/i386-glibc22-linux/lib/libg++.so.2.7.2
/usr/i386-glibc22-linux/lib/libg++.so.2.7.2.8
/usr/i386-glibc22-linux/lib/libgdbm.so.2
/usr/i386-glibc22-linux/lib/libgdbm.so.2.0.0
/usr/i386-glibc22-linux/lib/libgdk-1.2.so.0
/usr/i386-glibc22-linux/lib/libgdk-1.2.so.0.9.1
/usr/i386-glibc22-linux/lib/libgdk_pixbuf.so.2
/usr/i386-glibc22-linux/lib/libgdk_pixbuf.so.2.0.0
/usr/i386-glibc22-linux/lib/libglib-1.2.so.0
/usr/i386-glibc22-linux/lib/libglib-1.2.so.0.0.10
/usr/i386-glibc22-linux/lib/libglut.so.3
/usr/i386-glibc22-linux/lib/libglut.so.3.7.0
/usr/i386-glibc22-linux/lib/libgmodule-1.2.so.0
/usr/i386-glibc22-linux/lib/libgmodule-1.2.so.0.0.10
/usr/i386-glibc22-linux/lib/libgmp.so.3
/usr/i386-glibc22-linux/lib/libgmp.so.3.1.1
/usr/i386-glibc22-linux/lib/libgpm.so.1
/usr/i386-glibc22-linux/lib/libgpm.so.1.18.0
/usr/i386-glibc22-linux/lib/libgssapi_krb5.so.2
/usr/i386-glibc22-linux/lib/libgssapi_krb5.so.2.2
/usr/i386-glibc22-linux/lib/libgssrpc.so.3
/usr/i386-glibc22-linux/lib/libgssrpc.so.3.0
/usr/i386-glibc22-linux/lib/libgthread-1.2.so.0
/usr/i386-glibc22-linux/lib/libgthread-1.2.so.0.0.10
/usr/i386-glibc22-linux/lib/libgtk-1.2.so.0
/usr/i386-glibc22-linux/lib/libgtk-1.2.so.0.9.1
/usr/i386-glibc22-linux/lib/libhistory.so.4
/usr/i386-glibc22-linux/lib/libhistory.so.4.2
/usr/i386-glibc22-linux/lib/libjpeg.so.62
/usr/i386-glibc22-linux/lib/libjpeg.so.62.0.0
/usr/i386-glibc22-linux/lib/libk5crypto.so.3
/usr/i386-glibc22-linux/lib/libk5crypto.so.3.0
/usr/i386-glibc22-linux/lib/libkadm5clnt.so.4
/usr/i386-glibc22-linux/lib/libkadm5clnt.so.4.0
/usr/i386-glibc22-linux/lib/libkadm5srv.so.4
/usr/i386-glibc22-linux/lib/libkadm5srv.so.4.0
/usr/i386-glibc22-linux/lib/libkdb5.so.3
/usr/i386-glibc22-linux/lib/libkdb5.so.3.0
/usr/i386-glibc22-linux/lib/libkrb4.so.2
/usr/i386-glibc22-linux/lib/libkrb4.so.2.0
/usr/i386-glibc22-linux/lib/libkrb5.so.3
/usr/i386-glibc22-linux/lib/libkrb5.so.3.0
/usr/i386-glibc22-linux/lib/liblber.so.2
/usr/i386-glibc22-linux/lib/liblber.so.2.0.6
/usr/i386-glibc22-linux/lib/libldap.so.2
/usr/i386-glibc22-linux/lib/libldap.so.2.0.6
/usr/i386-glibc22-linux/lib/libm-2.2.4.so
/usr/i386-glibc22-linux/lib/libm.so.6
/usr/i386-glibc22-linux/lib/libmenu.so.5
/usr/i386-glibc22-linux/lib/libmenu.so.5.2
/usr/i386-glibc22-linux/lib/libmng.so.1
/usr/i386-glibc22-linux/lib/libmng.so.1.0.0
/usr/i386-glibc22-linux/lib/libmp.so.3
/usr/i386-glibc22-linux/lib/libmp.so.3.1.1
/usr/i386-glibc22-linux/lib/libncurses.so.5
/usr/i386-glibc22-linux/lib/libncurses.so.5.2
/usr/i386-glibc22-linux/lib/libnsl-2.2.4.so
/usr/i386-glibc22-linux/lib/libnsl.so.1
/usr/i386-glibc22-linux/lib/libnss1_compat-2.2.4.so
/usr/i386-glibc22-linux/lib/libnss1_dns-2.2.4.so
/usr/i386-glibc22-linux/lib/libnss1_files-2.2.4.so
/usr/i386-glibc22-linux/lib/libnss1_nis-2.2.4.so
/usr/i386-glibc22-linux/lib/libnss_compat-2.2.4.so
/usr/i386-glibc22-linux/lib/libnss_compat.so.1
/usr/i386-glibc22-linux/lib/libnss_compat.so.2
/usr/i386-glibc22-linux/lib/libnss_dns-2.2.4.so
/usr/i386-glibc22-linux/lib/libnss_dns.so.1
/usr/i386-glibc22-linux/lib/libnss_dns.so.2
/usr/i386-glibc22-linux/lib/libnss_files-2.2.4.so
/usr/i386-glibc22-linux/lib/libnss_files.so.1
/usr/i386-glibc22-linux/lib/libnss_files.so.2
/usr/i386-glibc22-linux/lib/libnss_hesiod-2.2.4.so
/usr/i386-glibc22-linux/lib/libnss_hesiod.so.2
/usr/i386-glibc22-linux/lib/libnss_nis-2.2.4.so
/usr/i386-glibc22-linux/lib/libnss_nis.so.1
/usr/i386-glibc22-linux/lib/libnss_nis.so.2
/usr/i386-glibc22-linux/lib/libnss_nisplus-2.2.4.so
/usr/i386-glibc22-linux/lib/libnss_nisplus.so.2
/usr/i386-glibc22-linux/lib/libpanel.so.5
/usr/i386-glibc22-linux/lib/libpanel.so.5.2
/usr/i386-glibc22-linux/lib/libpbm.so.9
/usr/i386-glibc22-linux/lib/libpbm.so.9.13
/usr/i386-glibc22-linux/lib/libpgm.so.9
/usr/i386-glibc22-linux/lib/libpgm.so.9.7
/usr/i386-glibc22-linux/lib/libpng.so.2
/usr/i386-glibc22-linux/lib/libpng.so.2.1.0.12
/usr/i386-glibc22-linux/lib/libpnm.so.9
/usr/i386-glibc22-linux/lib/libpnm.so.9.6
/usr/i386-glibc22-linux/lib/libpopt.so.0
/usr/i386-glibc22-linux/lib/libpopt.so.0.0.0
/usr/i386-glibc22-linux/lib/libppm.so.9
/usr/i386-glibc22-linux/lib/libppm.so.9.14
/usr/i386-glibc22-linux/lib/libproc.so.2.0.7
/usr/i386-glibc22-linux/lib/libpsres.so.1
/usr/i386-glibc22-linux/lib/libpsres.so.1.0
/usr/i386-glibc22-linux/lib/libpthread-0.9.so
/usr/i386-glibc22-linux/lib/libpthread.so.0
/usr/i386-glibc22-linux/lib/libpty.so.1
/usr/i386-glibc22-linux/lib/libpty.so.1.1
/usr/i386-glibc22-linux/lib/libreadline.so.4
/usr/i386-glibc22-linux/lib/libreadline.so.4.2
/usr/i386-glibc22-linux/lib/libresolv-2.2.4.so
/usr/i386-glibc22-linux/lib/libresolv.so.2
/usr/i386-glibc22-linux/lib/librt-2.2.4.so
/usr/i386-glibc22-linux/lib/librt.so.1
/usr/i386-glibc22-linux/lib/libsasl.so.7
/usr/i386-glibc22-linux/lib/libsasl.so.7.1.8
/usr/i386-glibc22-linux/lib/libslang.so.1
/usr/i386-glibc22-linux/lib/libslang.so.1.4.4
/usr/i386-glibc22-linux/lib/libssl.so.0.9.6b
/usr/i386-glibc22-linux/lib/libssl.so.2
/usr/i386-glibc22-linux/lib/libstdc++-2-libc6.1-1-2.9.0.so
/usr/i386-glibc22-linux/lib/libstdc++-3-libc6.2-2-2.10.0.so
/usr/i386-glibc22-linux/lib/libstdc++-libc6.1-1.so.2
/usr/i386-glibc22-linux/lib/libstdc++-libc6.2-2.so.3
/usr/i386-glibc22-linux/lib/libstdc++.so.2.7.2
/usr/i386-glibc22-linux/lib/libstdc++.so.2.7.2.8
/usr/i386-glibc22-linux/lib/libstdc++.so.2.8
/usr/i386-glibc22-linux/lib/libstdc++.so.2.8.0
/usr/i386-glibc22-linux/lib/libstdc++.so.2.9
/usr/i386-glibc22-linux/lib/libstdc++.so.2.9.dummy
/usr/i386-glibc22-linux/lib/libstdc++.so.3
/usr/i386-glibc22-linux/lib/libstdc++.so.3.0.1
/usr/i386-glibc22-linux/lib/libtermcap.so.2
/usr/i386-glibc22-linux/lib/libtermcap.so.2.0.8
/usr/i386-glibc22-linux/lib/libthread_db-1.0.so
/usr/i386-glibc22-linux/lib/libthread_db.so.1
/usr/i386-glibc22-linux/lib/libtiff.so.3
/usr/i386-glibc22-linux/lib/libtiff.so.3.5
/usr/i386-glibc22-linux/lib/libttf.so.2
/usr/i386-glibc22-linux/lib/libttf.so.2.3.0
/usr/i386-glibc22-linux/lib/libungif.so.3
/usr/i386-glibc22-linux/lib/libungif.so.3.1.0
/usr/i386-glibc22-linux/lib/libungif.so.4
/usr/i386-glibc22-linux/lib/libungif.so.4.1.0
/usr/i386-glibc22-linux/lib/libutempter.so.0
/usr/i386-glibc22-linux/lib/libutempter.so.0.5.2
/usr/i386-glibc22-linux/lib/libutil-2.2.4.so
/usr/i386-glibc22-linux/lib/libutil.so.1
/usr/i386-glibc22-linux/lib/libxml.so.1
/usr/i386-glibc22-linux/lib/libxml.so.1.8.14
/usr/i386-glibc22-linux/lib/libxrx.so.6
/usr/i386-glibc22-linux/lib/libxrx.so.6.3
/usr/i386-glibc22-linux/lib/libz.so.1
/usr/i386-glibc22-linux/lib/libz.so.1.1.3



------- Additional Comments From Salina Chu(salina.com) 2002-03-22 18:31
-------

The service team does not own an IA64 machine.
I will need to borrow the test team's IA64 machine on Monday to look at this.



------- Additional Comments From Salina Chu(salina.com) 2002-03-25 19:38
-------

I did some investigation of the problem today.
using RH 7.2 x86-compat-libs-7.2-1.src.rpm
I found that if we add 2 simple statements to the x86-compat-libs.spec 
in the %build part, you will add the /usr/lib/gconv files 
from the x86 installion to the package.
If you install the new package,
the libraries on the IA32 system under /usr/lib/gconv directory
will get installed in /usr/i386-glibc22-linux/lib/gconv directory 

Here is what I change :

-------------------------------------------------------------------------

%build
rm -f *
for lib in %{LIBRARIES} ; do
    candidates=$(ls /lib/lib$lib.so.* /usr/kerberos/lib/lib$lib.so.* 
/usr/lib/lib$lib.so.* /usr/X11R6/lib/lib$lib.so.* /lib/lib$lib-[0-9]*.so 
/usr/lib/lib$lib-[0-9]*.so /usr/X11R6/lib/lib$lib-[0-9]*.so 
/lib/lib$lib-[0-9]*.so.* /usr/lib/lib$lib-[0-9]*.so.* 
/usr/X11R6/lib/lib$lib-[0-9]*.so.* 2>/dev/null ||:)
    for file in $candidates ; do
        if [ -f $file -a ! -L $file ] ; then cp $file . ; fi
    done
done

GCONV_LIB=/usr/lib/gconv                       --------->  this is added
cp -r $GCONV_LIB .                             --------->  this is added

# we don't need the ncurses 3 things anymore...
rm -fv lib*.1.9.9*
strip -R .comment * || :
#create the soname links
/sbin/ldconfig -n -N -v .

---------------------------------------------------------------------------

However, even if the x86-compat-libs.rpm has the IA32 /usr/lib/gconv files,
we still need to set GCONV_PATH to point to /usr/i386-glibc22-linux/lib/gconv
before the IA32 version of the program will run.

If I set GCONV_PATH to the IA32 version of the library,
the IA64 version of the code will not run, we get the 
errno with the IA64 version of the code.

Part of the installation of the package adds
 /usr/i386-glibc22-linux/lib
to /etc/ld.so.conf and runs ldconfig
so that the right library will be picked up for IA32 binaries.
However, looking at ldconfig man pages, it says ldconfig works with
directories in /usr/lib and /lib, i.e. does not include /usr/lib/gconv

I am not sure if the glibc standard says we can add /usr/lib/gconv
to being able to be controlled by ldconfig.

We probably should talk to RedHat about this and see what the
"compat x86" really meant.

   



------- Additional Comments From Salina Chu(salina.com) 2002-03-25 19:43
-------

Here is web page about iconv_open

http://www.gnu.org/manual/glibc-2.2.3/html_node/libc_98.html

Comment 1 Jeff Johnson 2002-03-27 20:44:50 UTC
This appears to be more of a gettext/iconv
problem than an rpm problem. Yes the statically
linked /bin/rpm can/will load modules and libraries,
and, with a mixture of compat libraries for different
arch's, then the Wrong Thing Happens (just a guess).

Off to gettext for a 2nd opinion ...

Comment 2 Trond Eivind Glomsrxd 2002-03-27 21:21:47 UTC
These routines(iconv) are part of glibc... the gettext package just deals with
manipulating/extracting translations

Comment 3 Jakub Jelinek 2002-03-29 09:48:45 UTC
Well, primarily this is because of bogus decision to keep IA-64 64-bit libraries
in /lib, /usr/lib etc. directories as opposed to /lib64, /usr/lib64, etc.
(as done on sparc/sparc64, i386/x86_64, etc.). If IA-64 went this way,
one could just install plain i386 glibc on IA-64 box and both would work.
Unfortunately some IA-64 folks refused this layout.
The fix for this should be to rebuild x86-compat-libs, so that glibc in it
is rebuilt with either libdir /usr/i386-glibc22-linux/lib/ (as opposed to
/usr/lib/), or only gconvdir /usr/i386-glibc22-linux/lib/gconv/.

Comment 4 IBM Bug Proxy 2002-04-11 14:33:30 UTC
Concerning the iconv_open() problem I reported for IA-32 binaries running on
IA-64 Linux machines --- the problem consists of two issues.  First, IA-32
gconv conversion modules must be installed somewhere on the system.  Secondly,
IA-32 and IA-64 binaries should be able to call iconv_open() successfully
without having to resort to setting the GCONV_PATH environment variable.  The
book "ia-64 linux kernel design and implementation", by David Mosberger and
Stephane Eranian, contains an intriguing section, "11.2.3 Dealing with
absolute filesystem paths", in its chapter concerning IA-32 compatibility.
The information in that section may influence the resolution of both of these
issues.

The "11.2.3 Dealing with absolute filesystem paths" section describes Linux
kernel support for what is called an emulator prefix for absolute path names.
As described, the effect of this support is that when an IA-32 application
attempts to open a file using an absolute path such as
/specified/absolute/path/to/a/file, the kernel will first determine if the
file /emul/ia32-linux/specified/absolute/path/to/a/file exists.  If the file
under /emul/ia32-linux exists, it is opened; otherwise the originally
specified file is opened.  This mechanism seems promising to me since I
imagine that iconv_open() constructs absolute path names to conversion modules
it wants to load with dlopen().  If that is the case, I wonder whether the
IA-32 versions of the gconv modules should be installed in
/emul/ia32-linux/usr/lib/gconv.  In that case, IA-64 programs could find IA-64
gconv conversion modules in /usr/lib/gconv, and IA-32 programs could find
IA-32 gconv conversion modules in /emul/ia32-linux/usr/lib/gconv --- without
the programs having to be changed to set the GCONV_PATH environment variable.

I tried to use this mechanism on an IA-64 system I have access to, but it
did not work.  I then looked at the file include/asm/namei.h to see if the
__emul_prefix() macro was properly set, and found it to be NULL, instead of
the expected emul/ia32-linux.  A search on the web led me to believe that the
setting of this macro may have been changed in later releases of the kernel.
(The release of the kernel on my system is 2.4.9-18).

Can this seemingly architected IA-64 Linux method for allowing IA-32 and IA-64
processes to find the files they need be applied to this problem?

Comment 5 Bill Nottingham 2005-04-19 18:20:11 UTC
Closing bugs on older, no longer supported releases. Apologies for any lack of
response.

Please open a new bug if this affects currently supported releases.

Comment 6 IBM Bug Proxy 2015-06-29 06:31:06 UTC
------- Comment From cdeadmin.com 2015-06-29 06:29 EDT-------
test IT123773


Note You need to log in before you can comment on or make changes to this bug.