mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04:00
libdtrace: Generalize handling of data models a bit
Make it easier to support data models other than ILP32 and LP64 by avoiding constructs which assume that it must be one or the other. No functional change intended. MFC after: 2 weeks Sponsored by: Innovate UK
This commit is contained in:
parent
f934e629dc
commit
096a5c6cd2
3 changed files with 11 additions and 5 deletions
|
|
@ -1378,7 +1378,7 @@ main(int argc, char *argv[])
|
|||
argv[0], optarg);
|
||||
return (usage(stderr));
|
||||
}
|
||||
g_oflags &= ~DTRACE_O_LP64;
|
||||
g_oflags &= ~DTRACE_O_MODEL_MASK;
|
||||
g_oflags |= DTRACE_O_ILP32;
|
||||
break;
|
||||
|
||||
|
|
@ -1389,7 +1389,7 @@ main(int argc, char *argv[])
|
|||
argv[0], optarg);
|
||||
return (usage(stderr));
|
||||
}
|
||||
g_oflags &= ~DTRACE_O_ILP32;
|
||||
g_oflags &= ~DTRACE_O_MODEL_MASK;
|
||||
g_oflags |= DTRACE_O_LP64;
|
||||
break;
|
||||
|
||||
|
|
@ -1460,8 +1460,7 @@ main(int argc, char *argv[])
|
|||
* files. We ignore certain errors since we'll catch them later when
|
||||
* we actually process the object files.
|
||||
*/
|
||||
if (g_mode == DMODE_LINK &&
|
||||
(g_oflags & (DTRACE_O_ILP32 | DTRACE_O_LP64)) == 0 &&
|
||||
if (g_mode == DMODE_LINK && (g_oflags & DTRACE_O_MODEL_MASK) == 0 &&
|
||||
elf_version(EV_CURRENT) != EV_NONE) {
|
||||
int fd;
|
||||
Elf *elf;
|
||||
|
|
|
|||
|
|
@ -1073,8 +1073,14 @@ dt_vopen(int version, int flags, int *errp,
|
|||
if (flags & ~DTRACE_O_MASK)
|
||||
return (set_open_errno(dtp, errp, EINVAL));
|
||||
|
||||
if ((flags & DTRACE_O_LP64) && (flags & DTRACE_O_ILP32))
|
||||
switch (flags & DTRACE_O_MODEL_MASK) {
|
||||
case 0: /* native model */
|
||||
case DTRACE_O_ILP32:
|
||||
case DTRACE_O_LP64:
|
||||
break;
|
||||
default:
|
||||
return (set_open_errno(dtp, errp, EINVAL));
|
||||
}
|
||||
|
||||
if (vector == NULL && arg != NULL)
|
||||
return (set_open_errno(dtp, errp, EINVAL));
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ typedef struct dtrace_aggdata dtrace_aggdata_t;
|
|||
#define DTRACE_O_NOSYS 0x02 /* do not load /system/object modules */
|
||||
#define DTRACE_O_LP64 0x04 /* force D compiler to be LP64 */
|
||||
#define DTRACE_O_ILP32 0x08 /* force D compiler to be ILP32 */
|
||||
#define DTRACE_O_MODEL_MASK (DTRACE_O_LP64 | DTRACE_O_ILP32)
|
||||
#define DTRACE_O_MASK 0x0f /* mask of valid flags to dtrace_open */
|
||||
|
||||
extern dtrace_hdl_t *dtrace_open(int, int, int *);
|
||||
|
|
|
|||
Loading…
Reference in a new issue