Uploaded image for project: 'Swift'
  1. Swift
  2. SR-3250

Glibc does not have `dladdr()`.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: Standard Library
    • Labels:
    • Environment:

      Swift version 3.0.2 (swift-3.0.2-PREVIEW-1)

      Description

      # swift
      Welcome to Swift version 3.0.2 (swift-3.0.2-PREVIEW-1). Type :help for assistance.
        1> :type lookup dlsym
      no type was found matching 'dlsym'
        1> :type lookup dladdr
      no type was found matching 'dladdr'
        1> import Glibc
        2> :type lookup dlsym 
      @discardableResult func dlsym(_ __handle: Swift.UnsafeMutableRawPointer!, _ __name: Swift.UnsafePointer<Swift.Int8>) -> Swift.UnsafeMutableRawPointer!
        2> :type lookup dladdr 
      no type was found matching 'dladdr'
        2>  
      

      It seems that Glibc was imported without defining `__USE_GNU`.
      /usr/include/dlfcn.h:

      #ifdef __USE_GNU
      /* Structure containing information about object searched using
         `dladdr'.  */
      typedef struct
      {
        const char *dli_fname;        /* File name of defining object.  */
        void *dli_fbase;              /* Load address of that object.  */
        const char *dli_sname;        /* Name of nearest symbol.  */
        void *dli_saddr;              /* Exact value of nearest symbol.  */
      } Dl_info;
      
      /* Fill in *INFO with the following information about ADDRESS.
         Returns 0 iff no shared object's segments contain that address.  */
      extern int dladdr (const void *__address, Dl_info *__info)
           __THROW __nonnull ((2));
      

      Ubuntu have

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              norio_nomura Norio Nomura
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: