libbpf: Fix ELF symbol visibility update logic

Fix silly bug in updating ELF symbol's visibility.

Fixes: a46349227c ("libbpf: Add linker extern resolution support for functions and global variables")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20210507054119.270888-6-andrii@kernel.org
This commit is contained in:
Andrii Nakryiko 2021-05-06 22:41:17 -07:00 committed by Alexei Starovoitov
parent 31332ccb75
commit 247b8634e6

View file

@ -1788,7 +1788,7 @@ static void sym_update_visibility(Elf64_Sym *sym, int sym_vis)
/* libelf doesn't provide setters for ST_VISIBILITY,
* but it is stored in the lower 2 bits of st_other
*/
sym->st_other &= 0x03;
sym->st_other &= ~0x03;
sym->st_other |= sym_vis;
}