bool pretty_output;
 bool json_output;
 bool show_pinned;
+int bpf_flags;
 struct pinned_obj_table prog_table;
 struct pinned_obj_table map_table;
 
                { "pretty",     no_argument,    NULL,   'p' },
                { "version",    no_argument,    NULL,   'V' },
                { "bpffs",      no_argument,    NULL,   'f' },
+               { "mapcompat",  no_argument,    NULL,   'm' },
                { 0 }
        };
        int opt, ret;
        hash_init(map_table.table);
 
        opterr = 0;
-       while ((opt = getopt_long(argc, argv, "Vhpjf",
+       while ((opt = getopt_long(argc, argv, "Vhpjfm",
                                  options, NULL)) >= 0) {
                switch (opt) {
                case 'V':
                case 'f':
                        show_pinned = true;
                        break;
+               case 'm':
+                       bpf_flags = MAPS_RELAX_COMPAT;
+                       break;
                default:
                        p_err("unrecognized option '%s'", argv[optind - 1]);
                        if (json_output)
 
 }
 
 static int
-bpf_object__init_maps(struct bpf_object *obj)
+bpf_object__init_maps(struct bpf_object *obj, int flags)
 {
+       bool strict = !(flags & MAPS_RELAX_COMPAT);
        int i, map_idx, map_def_sz, nr_maps = 0;
        Elf_Scn *scn;
        Elf_Data *data;
                                                   "has unrecognized, non-zero "
                                                   "options\n",
                                                   obj->path, map_name);
-                                       return -EINVAL;
+                                       if (strict)
+                                               return -EINVAL;
                                }
                        }
                        memcpy(&obj->maps[map_idx].def, def,
        return false;
 }
 
-static int bpf_object__elf_collect(struct bpf_object *obj)
+static int bpf_object__elf_collect(struct bpf_object *obj, int flags)
 {
        Elf *elf = obj->efile.elf;
        GElf_Ehdr *ep = &obj->efile.ehdr;
                return LIBBPF_ERRNO__FORMAT;
        }
        if (obj->efile.maps_shndx >= 0) {
-               err = bpf_object__init_maps(obj);
+               err = bpf_object__init_maps(obj, flags);
                if (err)
                        goto out;
        }
 
 static struct bpf_object *
 __bpf_object__open(const char *path, void *obj_buf, size_t obj_buf_sz,
-                  bool needs_kver)
+                  bool needs_kver, int flags)
 {
        struct bpf_object *obj;
        int err;
 
        CHECK_ERR(bpf_object__elf_init(obj), err, out);
        CHECK_ERR(bpf_object__check_endianness(obj), err, out);
-       CHECK_ERR(bpf_object__elf_collect(obj), err, out);
+       CHECK_ERR(bpf_object__elf_collect(obj, flags), err, out);
        CHECK_ERR(bpf_object__collect_reloc(obj), err, out);
        CHECK_ERR(bpf_object__validate(obj, needs_kver), err, out);
 
        return ERR_PTR(err);
 }
 
-struct bpf_object *bpf_object__open_xattr(struct bpf_object_open_attr *attr)
+struct bpf_object *__bpf_object__open_xattr(struct bpf_object_open_attr *attr,
+                                           int flags)
 {
        /* param validation */
        if (!attr->file)
        pr_debug("loading %s\n", attr->file);
 
        return __bpf_object__open(attr->file, NULL, 0,
-                                 bpf_prog_type__needs_kver(attr->prog_type));
+                                 bpf_prog_type__needs_kver(attr->prog_type),
+                                 flags);
+}
+
+struct bpf_object *bpf_object__open_xattr(struct bpf_object_open_attr *attr)
+{
+       return __bpf_object__open_xattr(attr, 0);
 }
 
 struct bpf_object *bpf_object__open(const char *path)
        pr_debug("loading object '%s' from buffer\n",
                 name);
 
-       return __bpf_object__open(name, obj_buf, obj_buf_sz, true);
+       return __bpf_object__open(name, obj_buf, obj_buf_sz, true, true);
 }
 
 int bpf_object__unload(struct bpf_object *obj)