From ded713e90dde1eba60a9c9156e4c00a734039142 Mon Sep 17 00:00:00 2001 From: herman ten brugge Date: Wed, 8 Nov 2023 19:58:26 +0100 Subject: [PATCH] Ignore as_needed in ld_add_file_list After the change to DT_NEEDED I get warnings for some functions. The reason is that libc.so on my machine contains: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) ) Before the change to DT_NEEDED we solved the symbols because the /lib64/libc.so.6 file has as DT_NEEDED set for ld-linux-x86-64.so.2 The above AS_NEEDED section was not followed so symbols in this file gives a warning. Currently fixed by including AS_NEEDED files. --- tccelf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tccelf.c b/tccelf.c index 0110152d..abcfb10d 100644 --- a/tccelf.c +++ b/tccelf.c @@ -3877,8 +3877,9 @@ static int ld_add_file_list(TCCState *s1, const char *cmd, int as_needed) if (ret) goto lib_parse_error; } else { - /* TODO: Implement AS_NEEDED support. Ignore it for now */ - if (!as_needed) { + /* TODO: Implement AS_NEEDED support. */ + /* DT_NEEDED is not used any more so ignore as_needed */ + if (1 || !as_needed) { ret = ld_add_file(s1, filename); if (ret) goto lib_parse_error;