elfutils gelf_getsymshndx does not error when the second parameter is non-NULL, and as of linux kernel 5.8, this seems to be a way that function is used. elfutils has this comment: "The user is not required to pass a data descriptor for an extended section index table." which I think is about not requiring the second parameter to be non-NULL, would it be possible for gelf_getsymshndx to be changed to support that behaviour, so that elftoolchain's libelf can continue to be used to build the kernel?
I have attached a patch that I believe resolves this issue, and only retrieves the extended section index when the 2nd parameter is non-NULL.
ping?
FWIW, I also ran into this issue and Ethan's patch looks good to me. I just made a slight tweak to remove the impossible
lid == NULL
check in the subsequent if statement.I attached my patch variation.
I'll be taking this up shortly.
The manual needs to be changed along with this code change.
The libelf test suite doesn't have tests for
gelf_getsymshndx()
currently. I'll need to add those later.Fixed in [r3873].
Related
Commit: [r3873]
Could you please confirm that the fix works for you?