libbpf_android: allow bpf w/o maps section
Currently, if a bpf program object has no map section, this error is propagated, and the program will fail to load. However, it is desirable to have programs without any map. Bug: 140330870 Test: load program w/ bpf w/o maps section Change-Id: Ia53c699212a8cb962e3c2db562921880fef0cce0
This commit is contained in:
parent
be15fa1edd
commit
c0905b4880
1 changed files with 1 additions and 0 deletions
|
@ -390,6 +390,7 @@ static int createMaps(const char* elfPath, ifstream& elfFile, vector<unique_fd>&
|
|||
string fname = pathToFilename(string(elfPath), true);
|
||||
|
||||
ret = readSectionByName("maps", elfFile, mdData);
|
||||
if (ret == -2) return 0; // no maps to read
|
||||
if (ret) return ret;
|
||||
md.resize(mdData.size() / sizeof(struct bpf_map_def));
|
||||
memcpy(md.data(), mdData.data(), mdData.size());
|
||||
|
|
Loading…
Reference in a new issue