-
Notifications
You must be signed in to change notification settings - Fork 200
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
add stubs for dlopen, dlsym, etc. #443
Changes from 1 commit
3a14878
ff16bac
78629b7
3e11e7b
b4b59f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -573,6 +573,10 @@ difftime | |
dirfd | ||
dirname | ||
div | ||
dlclose | ||
dlerror | ||
dlopen | ||
dlsym | ||
dprintf | ||
drand48 | ||
drem | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1499,6 +1499,15 @@ | |
#define RRFIXEDSZ NS_RRFIXEDSZ | ||
#define RRQ 01 | ||
#define RS_HIPRI 0x01 | ||
#define RTLD_DEFAULT ((void *)0) | ||
#define RTLD_DI_LINKMAP 2 | ||
#define RTLD_GLOBAL 256 | ||
#define RTLD_LAZY 1 | ||
#define RTLD_LOCAL 0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isn't it straightforward to use a non-zero value? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dicej ping There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I didn't notice these comments earlier. The values in these files come straight from libc-top-half/musl/include/dlfcn.h, which appears to remain unchanged since it was imported from musl libc. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Today I learned that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unless you want to decide the default right now, we can postpone the decision by making it a non-zero value. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just pushed an update changing it to a non-zero value. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure I understand how we can make both of these non-zero. This is a binary choice between global or local symbol binding, its not possible to choose neither. The question is what the default should be when neither is specified and the answer has to be one or the other. I suggest we go with that musl's defaults for now given that we are largely a port of musl here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh wait, I understand now. Please ignore my last comment. Having |
||
#define RTLD_NEXT ((void *)-1) | ||
#define RTLD_NODELETE 4096 | ||
#define RTLD_NOLOAD 4 | ||
#define RTLD_NOW 2 | ||
#define RUSAGE_CHILDREN 2 | ||
#define RUSAGE_SELF 1 | ||
#define R_OK (4) | ||
|
@@ -2044,6 +2053,7 @@ | |
#define _Complex_I (0.0f+1.0fi) | ||
#define _DIRENT_H | ||
#define _DIRENT_HAVE_D_TYPE | ||
#define _DLFCN_H | ||
#define _ENDIAN_H | ||
#define _ERRNO_H | ||
#define _ERR_H | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -509,6 +509,10 @@ difftime | |
dirfd | ||
dirname | ||
div | ||
dlclose | ||
dlerror | ||
dlopen | ||
dlsym | ||
dprintf | ||
drand48 | ||
drem | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include <stdint.h> | ||
dicej marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
#include <dlfcn.h> | ||
|
||
#define EXPORT __attribute__((visibility("default"))) __attribute__((used)) | ||
dicej marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#define WEAK __attribute__((__weak__)) | ||
dicej marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
static const char *error = 0; | ||
dicej marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
EXPORT WEAK int dlclose(void *library) { | ||
error = "dlclose not implemented"; | ||
dicej marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return -1; | ||
} | ||
|
||
EXPORT WEAK char *dlerror(void) { | ||
const char *var = error; | ||
error = 0; | ||
return (char*) var; | ||
} | ||
|
||
EXPORT WEAK void *dlopen(const char *name, int flags) { | ||
error = "dlopen not implemented"; | ||
return 0; | ||
} | ||
|
||
EXPORT WEAK void *dlsym(void *library, const char *name) { | ||
error = "dlsym not implemented"; | ||
return 0; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this make sense w/o dlinfo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dicej ping
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I don't know why this is defined unconditionally in dlfcn.h. We could move it into the
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
block in that file if desired.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just pushed an update to address this.