[PATCH 03/13] elf: dont pass fd to _dl_process_pt_xx
Adhemerval Zanella Netto
adhemerval.zanella@linaro.org
Wed Mar 29 17:10:16 GMT 2023
On 18/03/23 13:51, Stas Sergeev via Libc-alpha wrote:
> It is not used in these functions.
> rtld.c:rtld_setup_main_map() does the same.
>
> The test-suite was run on x86_64/64 and showed no regressions.
>
> Signed-off-by: Stas Sergeev <stsp2@yandex.ru>
> ---
> elf/dl-load.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/elf/dl-load.c b/elf/dl-load.c
> index fcb39a78d4..ab8b648687 100644
> --- a/elf/dl-load.c
> +++ b/elf/dl-load.c
> @@ -1379,10 +1379,10 @@ cannot enable executable stack as shared object requires");
> switch (ph[-1].p_type)
> {
> case PT_NOTE:
> - _dl_process_pt_note (l, fd, &ph[-1]);
> + _dl_process_pt_note (l, -1, &ph[-1]);
> break;
> case PT_GNU_PROPERTY:
> - _dl_process_pt_gnu_property (l, fd, &ph[-1]);
> + _dl_process_pt_gnu_property (l, -1, &ph[-1]);
> break;
> }
>
It allows both _dl_process_pt_note and _dl_process_pt_gnu_property to know
if the called where rtld code during statup code or dlopen. But you are
right that it is not used.
However this does not accomplish anything, a better refactor would to just
remove the argument altogether. It at least would simplify the interface
and allow slight better code generation.
More information about the Libc-alpha
mailing list