return "rodata";
        else if (str_has_suffix(name, ".bss"))
                return "bss";
+       else if (str_has_suffix(name, ".extern"))
+               return "externs"; /* extern is a C keyword */
        else
                return NULL;
 }
                sec_ident = "bss";
        else if (strcmp(sec_name, ".rodata") == 0)
                sec_ident = "rodata";
+       else if (strcmp(sec_name, ".extern") == 0)
+               sec_ident = "externs"; /* extern is a C keyword */
        else
                return 0;
 
 
                        return -ESRCH;
                }
 
-               if (mmaped)
+               /* externs shouldn't be pre-setup from user code */
+               if (mmaped && (*map)->libbpf_type != LIBBPF_MAP_EXTERN)
                        *mmaped = (*map)->mmaped;
        }
 
                size_t mmap_sz = bpf_map_mmap_sz(map);
                int prot, map_fd = bpf_map__fd(map);
                void **mmaped = s->maps[i].mmaped;
-               void *remapped;
 
                if (!mmaped)
                        continue;
                 * as per normal clean up procedure, so we don't need to worry
                 * about it from skeleton's clean up perspective.
                 */
-               remapped = mmap(*mmaped, mmap_sz, prot, MAP_SHARED | MAP_FIXED,
-                               map_fd, 0);
-               if (remapped == MAP_FAILED) {
+               *mmaped = mmap(map->mmaped, mmap_sz, prot,
+                               MAP_SHARED | MAP_FIXED, map_fd, 0);
+               if (*mmaped == MAP_FAILED) {
                        err = -errno;
                        *mmaped = NULL;
                        pr_warn("failed to re-mmap() map '%s': %d\n",