Print this page
10908 Simplify SMAP relocations with krtld
@@ -2178,19 +2178,29 @@
static void
free_module_data(struct module *mp)
{
struct module_list *lp, *tmp;
+ hotinline_desc_t *hid, *next;
int ksyms_exported = 0;
lp = mp->head;
while (lp) {
tmp = lp;
lp = lp->next;
kobj_free((char *)tmp, sizeof (*tmp));
}
+ /* release hotinlines */
+ hid = mp->hi_calls;
+ while (hid != NULL) {
+ next = hid->hid_next;
+ kobj_free(hid->hid_symname, strlen(hid->hid_symname) + 1);
+ kobj_free(hid, sizeof (hotinline_desc_t));
+ hid = next;
+ }
+
rw_enter(&ksyms_lock, RW_WRITER);
if (mp->symspace) {
if (vmem_contains(ksyms_arena, mp->symspace, mp->symsize)) {
vmem_free(ksyms_arena, mp->symspace, mp->symsize);
ksyms_exported = 1;
@@ -3032,13 +3042,23 @@
}
if (sp->st_shndx == SHN_UNDEF) {
resolved = 0;
+ /*
+ * Skip over sdt probes and smap calls,
+ * they're relocated later.
+ */
if (strncmp(name, sdt_prefix, strlen(sdt_prefix)) == 0)
continue;
+#if defined(__x86)
+ if (strcmp(name, "smap_enable") == 0 ||
+ strcmp(name, "smap_disable") == 0)
+ continue;
+#endif /* defined(__x86) */
+
/*
* If it's not a weak reference and it's
* not a primary object, it's an error.
* (Primary objects may take more than
* one pass to resolve)