Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-3250] Glibc does not have dladdr(). #45838

Open
norio-nomura opened this issue Nov 21, 2016 · 0 comments
Open

[SR-3250] Glibc does not have dladdr(). #45838

norio-nomura opened this issue Nov 21, 2016 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. Linux Platform: Linux SDKOverlay standard library Area: Standard library umbrella

Comments

@norio-nomura
Copy link
Contributor

Previous ID SR-3250
Radar None
Original Reporter @norio-nomura
Type Bug
Environment

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

Additional Detail from JIRA
Votes 1
Component/s Standard Library
Labels Bug, Linux, SDKOverlay
Assignee None
Priority Medium

md5: 658a93e9ba02bcc5f6be291ef597711c

Issue 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

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. Linux Platform: Linux SDKOverlay standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

1 participant