Changeset View
Changeset View
Standalone View
Standalone View
libexec/rtld-elf/rtld.c
Show First 20 Lines • Show All 1,471 Lines • ▼ Show 20 Lines | digest_notes(Obj_Entry *obj, Elf_Addr note_start, Elf_Addr note_end) | ||||
for (note = (const Elf_Note *)note_start; (Elf_Addr)note < note_end; | for (note = (const Elf_Note *)note_start; (Elf_Addr)note < note_end; | ||||
note = (const Elf_Note *)((const char *)(note + 1) + | note = (const Elf_Note *)((const char *)(note + 1) + | ||||
roundup2(note->n_namesz, sizeof(Elf32_Addr)) + | roundup2(note->n_namesz, sizeof(Elf32_Addr)) + | ||||
roundup2(note->n_descsz, sizeof(Elf32_Addr)))) { | roundup2(note->n_descsz, sizeof(Elf32_Addr)))) { | ||||
if (note->n_namesz != sizeof(NOTE_FREEBSD_VENDOR) || | if (note->n_namesz != sizeof(NOTE_FREEBSD_VENDOR) || | ||||
note->n_descsz != sizeof(int32_t)) | note->n_descsz != sizeof(int32_t)) | ||||
continue; | continue; | ||||
if (note->n_type != NT_FREEBSD_ABI_TAG && | if (note->n_type != NT_FREEBSD_ABI_TAG && | ||||
note->n_type != NT_FREEBSD_FEATURE_CTL && | |||||
note->n_type != NT_FREEBSD_NOINIT_TAG) | note->n_type != NT_FREEBSD_NOINIT_TAG) | ||||
continue; | continue; | ||||
note_name = (const char *)(note + 1); | note_name = (const char *)(note + 1); | ||||
if (strncmp(NOTE_FREEBSD_VENDOR, note_name, | if (strncmp(NOTE_FREEBSD_VENDOR, note_name, | ||||
sizeof(NOTE_FREEBSD_VENDOR)) != 0) | sizeof(NOTE_FREEBSD_VENDOR)) != 0) | ||||
continue; | continue; | ||||
switch (note->n_type) { | switch (note->n_type) { | ||||
case NT_FREEBSD_ABI_TAG: | case NT_FREEBSD_ABI_TAG: | ||||
/* FreeBSD osrel note */ | /* FreeBSD osrel note */ | ||||
p = (uintptr_t)(note + 1); | p = (uintptr_t)(note + 1); | ||||
p += roundup2(note->n_namesz, sizeof(Elf32_Addr)); | p += roundup2(note->n_namesz, sizeof(Elf32_Addr)); | ||||
obj->osrel = *(const int32_t *)(p); | obj->osrel = *(const int32_t *)(p); | ||||
dbg("note osrel %d", obj->osrel); | dbg("note osrel %d", obj->osrel); | ||||
break; | |||||
case NT_FREEBSD_FEATURE_CTL: | |||||
/* FreeBSD ABI feature control note */ | |||||
p = (uintptr_t)(note + 1); | |||||
p += roundup2(note->n_namesz, sizeof(Elf32_Addr)); | |||||
obj->fctl0 = *(const uint32_t *)(p); | |||||
dbg("note fctl0 %#x", obj->fctl0); | |||||
break; | break; | ||||
case NT_FREEBSD_NOINIT_TAG: | case NT_FREEBSD_NOINIT_TAG: | ||||
/* FreeBSD 'crt does not call init' note */ | /* FreeBSD 'crt does not call init' note */ | ||||
obj->crt_no_init = true; | obj->crt_no_init = true; | ||||
dbg("note crt_no_init"); | dbg("note crt_no_init"); | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 4,112 Lines • Show Last 20 Lines |