projects
/
m6w6
/
ext-psi
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
marshal: array return values
[m6w6/ext-psi]
/
src
/
types
/
decl.c
diff --git
a/src/types/decl.c
b/src/types/decl.c
index 85d93d40cd63243cb93c6e3a15c240f27a8b314c..40d8c251f0e484123277dfda6b97f4c517fbb97c 100644
(file)
--- a/
src/types/decl.c
+++ b/
src/types/decl.c
@@
-66,7
+66,9
@@
void psi_decl_free(struct psi_decl **d_ptr)
void psi_decl_dump(int fd, struct psi_decl *decl)
{
void psi_decl_dump(int fd, struct psi_decl *decl)
{
- psi_decl_abi_dump(fd, decl->abi);
+ if (decl->abi) {
+ psi_decl_abi_dump(fd, decl->abi);
+ }
dprintf(fd, " ");
/* FIXME: functions returning arrays */
psi_decl_arg_dump(fd, decl->func, 0);
dprintf(fd, " ");
/* FIXME: functions returning arrays */
psi_decl_arg_dump(fd, decl->func, 0);
@@
-85,6
+87,9
@@
void psi_decl_dump(int fd, struct psi_decl *decl)
dprintf(fd, ", ...");
}
}
dprintf(fd, ", ...");
}
}
+ if (decl->func->var->array_size) {
+ dprintf(fd, ")[%zu]", decl->func->var->array_size);
+ }
if (decl->redir) {
dprintf(fd, ") __asm__ (\"%s\");", decl->redir);
} else {
if (decl->redir) {
dprintf(fd, ") __asm__ (\"%s\");", decl->redir);
} else {
@@
-93,7
+98,7
@@
void psi_decl_dump(int fd, struct psi_decl *decl)
}
static inline bool psi_decl_validate_func(struct psi_data *data,
}
static inline bool psi_decl_validate_func(struct psi_data *data,
- struct psi_decl *decl, struct psi_decl_arg *func
, void *dl
)
+ struct psi_decl *decl, struct psi_decl_arg *func)
{
struct psi_func_redir *redir;
{
struct psi_func_redir *redir;
@@
-107,6
+112,14
@@
static inline bool psi_decl_validate_func(struct psi_data *data,
decl->sym = redir->func;
}
}
decl->sym = redir->func;
}
}
+ if (!decl->sym) {
+ size_t i = 0;
+ void *dl;
+
+ while (!decl->sym && psi_plist_get(data->file.dlopened, i++, &dl)) {
+ decl->sym = dlsym(dl, decl->redir ?: func->var->name);
+ }
+ }
if (!decl->sym) {
#ifndef RTLD_NEXT
# define RTLD_NEXT ((void *) -1l)
if (!decl->sym) {
#ifndef RTLD_NEXT
# define RTLD_NEXT ((void *) -1l)
@@
-114,7
+127,7
@@
static inline bool psi_decl_validate_func(struct psi_data *data,
#ifndef RTLD_DEFAULT
# define RTLD_DEFAULT ((void *) 0)
#endif
#ifndef RTLD_DEFAULT
# define RTLD_DEFAULT ((void *) 0)
#endif
- decl->sym = dlsym(
dl ?:
RTLD_DEFAULT, decl->redir ?: func->var->name);
+ decl->sym = dlsym(RTLD_DEFAULT, decl->redir ?: func->var->name);
if (!decl->sym) {
data->error(data, func->token, PSI_WARNING,
"Failed to locate symbol '%s(%s)': %s",
if (!decl->sym) {
data->error(data, func->token, PSI_WARNING,
"Failed to locate symbol '%s(%s)': %s",
@@
-132,7
+145,7
@@
bool psi_decl_validate(struct psi_data *data, struct psi_decl *decl,
if (!psi_decl_validate_nodl(data, decl, scope)) {
return false;
}
if (!psi_decl_validate_nodl(data, decl, scope)) {
return false;
}
- if (!psi_decl_validate_func(data, decl, decl->func
, scope->dlopened
)) {
+ if (!psi_decl_validate_func(data, decl, decl->func)) {
return false;
}
return false;
}