xlate_init_fd(3E)

xlate_init_fd, xlate_init_elf, xlate_named_init_fd, xlate_named_init_elf - Opens translation section

As shipped in IRIX 6.5.15. Last changed in IRIX 6.5.5.

NAME
     xlate_init_fd, xlate_init_elf, xlate_named_init_fd,
     xlate_named_init_elf - Opens translation section

SYNOPSIS
     #include <elf.h>
     #include <libelf.h>
     #include <dwarf.h>
     #include <libdwarf.h>
     #include <cmplrs/xlate.h>
     #include <libXlate.h>

     int xlate_init_fd(int fd,
       int open_debug_table,
       xlate_table_con  *returned_table_pointer);

     int xlate_init_elf(Elf *elf_handle,
       int open_debug_table,
       xlate_table_con *returned_table_pointer);

     int xlate_named_init_fd(int fd,
       const char * xlate_section_name,
       xlate_table_con  *returned_table_pointer);

     int xlate_named_init_elf(Elf *elf_handle,
       const char * xlate_section_name,
       xlate_table_con *returned_table_pointer);

IMPLEMENTATION
     IRIX systems

DESCRIPTION
     xlate_init_fd and xlate_init_elf are used to get (open) a handle on an
     Elf section containing translation information.  The handle allows you
     to call any of the consumer functions.

     xlate_init_fd accepts the following arguments:

     fd      Specifies an IRIX file-descriptor which must be open for
             reading on an Elf object file.

     open_debug_table
             Specifies which translation section to open.  If
             XLATE_OPEN_STD_TABLE (0), then the first section with sh_type
             SHT_MIPS_XLATE is opened.  If XLATE_OPEN_STD_TABLE (1), then
             the first section with sh_type SHT_MIPS_XLATE_DEBUG is opened.
             XLATE_OPEN_STD_TABLE is the table normally opened by debuggers
             and other applictions needing to do address translations.
             Only sections with Elf section type SHT_MIPS_XLATE,
             SHT_MIPS_XLATE_DEBUG, or SHT_MIPS_XLATE_OLD can be opened.

     returned_table_pointer
             Specifies a pointer to a consumer table handle.  If the call
             to xlate_init_fd is successful, the handle pointed to is set a
             valid consumer library handle.

     xlate_init_elf accepts the following arguments:

     elf_handle
             Specifies a valid open pointer on an existing Elf object as
             returned by elf_begin(3e), and it must allow read access.

     open_debug_table
             Specifies which translation section to open.  If
             XLATE_OPEN_STD_TABLE (0), then the first section with sh_type
             SHT_MIPS_XLATE is opened.  If XLATE_OPEN_STD_TABLE (1), then
             the first section with sh_type SHT_MIPS_XLATE_DEBUG is opened.
             XLATE_OPEN_STD_TABLE is the table normally opened by debuggers
             and other applictions needing to do address translations.
             Only sections with Elf section type SHT_MIPS_XLATE,
             SHT_MIPS_XLATE_DEBUG, or SHT_MIPS_XLATE_OLD can be opened.

     returned_table_pointer
             Specifies a pointer to a consumer table handle.  If the call
             to xlate_init_fd is successful, the handle pointed to is set
             to a valid consumer library handle.

     xlate_named_init_fd accepts the following arguments:

     fd      Specifies an IRIX file-descriptor which must be open for
             reading on an Elf object file.

     xlate_section_name
             Specifies which translation section to open.  The normal
             string passed in is .MIPS.Xlate, which is the name of the net
             (composed) address translation table used by debuggers and
             other applictions needing to do address translations.  Any Elf
             section with sh_type SHT_MIPS_XLATE, SHT_MIPS_XLATE_DEBUG, or
             SHT_MIPS_XLATE_OLD may be opened.

     returned_table_pointer
             Pointer to a consumer table handle.  If the call to
             xlate_init_fd is successful, the handle pointed to is set a
             valid consumer library handle.

     xlate_named_init_elf accepts the following arguments:

     elf_handle
             Specifies a valid open pointer on an existing Elf object as
             returned by elf_begin(3e), and it must allow read access.

     xlate_section_name
             Specifies which translation section to open.  The normal
             string passed in is .MIPS.Xlate which is the name of the net
             (composed) address translation table used by debuggers and
             other applictions needing to do address translations.  Any Elf
             section with sh_type SHT_MIPS_XLATE, SHT_MIPS_XLATE_DEBUG, or
             SHT_MIPS_XLATE_OLD may be opened.

     returned_table_pointer
             Pointer to a consumer table handle.  If the call to
             xlate_init_fd is successful, the handle pointed to is set to a
             valid consumer library handle.

     Specify -lelfutil -lelf on the link command line to link in the xlate
     functions.

     You must install the compiler_eoe.hdr.internal subsystem to get the
     headers necessary to work with the xlate functions and leb128
     functions they call.

THREAD SAFETY
     The xlate functions are thread safe.  This means that if distinct
     xlate_table_con and xlate_table_pro handles are used in distinct
     threads to call xlate functions simultaneously in multiple threads,
     the threads will not interfere.

     However, using a particular xlate_table_con handle or a particular
     xlate_table_pro handle to call xlate functions simultaneously in
     multiple threads is not supported and may cause unpredictable results.

FILES
     /usr/include/libXlate.h
     /usr/include/cmplrs/xlate.h
     /usr/include/elf.h
     /usr/include/dwarf.h
     /usr/include/libdwarf.h
     /usr/lib/libelfutil.a

DIAGNOSTICS
     These return XLATE_TB_STATUS_NO_ERROR (0) on success.  In case of
     error, a negative number is returned indicating the error.  In case of
     error, nothing is returned through the pointer arguments which would
     return values on successful call (values might have been changed thru
     these pointers but any such changes are not meaningful).

     If the requested section does not exist, XLATE_TB_STATUS_NO_XLATE is
     returned.  This is not really an error, just an indication that there
     is no such section and there is no value returned through
     returned_table_pointer.

     XLATE_TB_STATUS_SECTION_TOO_SMALL
             The translation section is too small to be real or there is
             less space in the section than the translation section data
             says it contains.

     XLATE_TB_STATUS_INCONSISTENT_64_BIT_INFO
             The translation section is marked as a 64-bit section but the
             a.out or DSO is marked as 32-bit (or vice versa).

     XLATE_TB_STATUS_BAD_TABLEKIND
             The tablekind in the translation section is not one of the
             predefined values: something is corrupted or an obsolete
             tablekind thought not to exist does exist.

     XLATE_TB_STATUS_NOT_ELF
             elf_kind(3e) on the file says the file is not a plain Elf
             file.

     XLATE_TB_STATUS_ELF_IDENT_BAD
             elf_getident(3e) returns an invalid Elf ident value.  The file
             is apparently not a valid Elf file.

     XLATE_TB_STATUS_ELF_SHDR_BAD
             elf32_getshdr(3e), or elf64_getshdr(3e) could not find a
             section in the Elf file that should be there. Corruption (file
             or data) is occurring.  The file is apparently not a valid Elf
             file.

     XLATE_TB_STATUS_NO_XLATE
             Normal return when there is no translation section of the
             requested type.

     XLATE_TB_STATUS_NO_XLATE_DATA
             There is a translation section but the section is empty!
             Something is wrong with the Elf file.

     XLATE_TB_STATUS_ALLOC_FAIL
             A call to malloc() or realloc() failed.

     XLATE_TB_STATUS_SECTION_TOO_BIG
             The translation section is so large ( > 31 bits in the size)
             that it cannot be handled by the 32-bit version of the
             library.  This is quite unlikely since translation sections
             should be much smaller than the text they refer to and text
             sections do not get that big (as of this writing).  The
             application must be rebuilt as a 64-bit application and linked
             against a 64-bit version of this library.

     XLATE_TB_STATUS_EDHR_BAD
             A call to elf32_getehdr(3) or elf64_getehdr(3) (whichever is
             appropriate) failed.  The object file is damaged or the
             library has a bug.

     XLATE_TB_STATUS_STRPTR_BAD
             A call to elf_strptr(3) failed.  No section name strings could
             be found.  The object file is specially stripped or damaged or
             the library has a bug.

NOTES
     For any of these calls to succeed the section contents must also be a
     valid translate section.

     If there are multiple sections of an Elf object file meeting the
     section name and section type criteria above, then one of the sections
     is opened.

SEE ALSO
     libelfutil(5), open(2), xlate(4), xlate_get_info(3e),
     xlate_address(3e), xlate_get_reg_rule(3e),
     xlate_get_all_reg_rules(3e), xlate_expand_reg_info(3e),
     xlate_finish(3e), xlate_pro_init(3e), xlate_pro_finish(3e),
     xlate_address(3e)

     This man page is available only online.