From: Rodrigo Campos <rodrigo@sdfg.com.ar>
To: "Willy Tarreau" <w@1wt.eu>, "Thomas Weißschuh" <linux@weissschuh.net>
Cc: linux-kernel@vger.kernel.org, Rodrigo Campos <rodrigo@sdfg.com.ar>
Subject: [PATCH 1/4] tools/nolibc/string: export strlen()
Date: Mon, 29 Jan 2024 15:15:13 +0100 [thread overview]
Message-ID: <20240129141516.198636-2-rodrigo@sdfg.com.ar> (raw)
In-Reply-To: <20240129141516.198636-1-rodrigo@sdfg.com.ar>
As with commit 8d304a374023, "tools/nolibc/string: export memset() and
memmove()", gcc -Os without -ffreestanding may fail to compile with:
cc -fno-asynchronous-unwind-tables -fno-ident -s -Os -nostdlib -lgcc -static -o test test.c
/usr/bin/ld: /tmp/cccIasKL.o: in function `main':
test.c:(.text.startup+0x1e): undefined reference to `strlen'
collect2: error: ld returned 1 exit status
As on the aforementioned commit, this patch adds a section to export
this function so compilation works on those cases too.
Signed-off-by: Rodrigo Campos <rodrigo@sdfg.com.ar>
---
tools/include/nolibc/string.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/include/nolibc/string.h b/tools/include/nolibc/string.h
index a01c69dd495f..ed15c22b1b2a 100644
--- a/tools/include/nolibc/string.h
+++ b/tools/include/nolibc/string.h
@@ -123,7 +123,7 @@ char *strcpy(char *dst, const char *src)
* thus itself, hence the asm() statement below that's meant to disable this
* confusing practice.
*/
-static __attribute__((unused))
+__attribute__((weak,unused,section(".text.nolibc_strlen")))
size_t strlen(const char *str)
{
size_t len;
--
2.43.0
next prev parent reply other threads:[~2024-01-29 14:15 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-29 14:15 [PATCH 0/4] tools/nolibc: Misc fixes for strlcpy() and strlcat() Rodrigo Campos
2024-01-29 14:15 ` Rodrigo Campos [this message]
2024-01-29 14:15 ` [PATCH 2/4] tools/nolibc: Fix strlcat() return code and size usage Rodrigo Campos
2024-02-11 10:48 ` Willy Tarreau
2024-02-12 23:16 ` Rodrigo Campos
2024-02-13 5:27 ` Rodrigo Campos
2024-02-13 6:20 ` Rodrigo Campos
2024-02-13 7:02 ` Willy Tarreau
2024-02-14 15:19 ` Rodrigo Campos
2024-02-13 6:04 ` Rodrigo Campos
2024-02-14 15:34 ` Rodrigo Campos
2024-02-14 22:03 ` Rodrigo Campos
2024-02-14 22:47 ` Rodrigo Campos
2024-02-18 10:22 ` Willy Tarreau
2024-02-18 10:20 ` Willy Tarreau
2024-02-18 19:33 ` Rodrigo Campos
2024-01-29 14:15 ` [PATCH 3/4] tools/nolibc: Fix strlcpy() " Rodrigo Campos
2024-02-11 11:08 ` Willy Tarreau
2024-02-11 11:14 ` Willy Tarreau
2024-02-14 15:50 ` Rodrigo Campos
2024-02-14 15:55 ` Willy Tarreau
2024-01-29 14:15 ` [PATCH 4/4] selftests/nolibc: Add tests for strlcat() and strlcpy() Rodrigo Campos
2024-02-11 11:09 ` Willy Tarreau
2024-02-14 15:52 ` Rodrigo Campos
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240129141516.198636-2-rodrigo@sdfg.com.ar \
--to=rodrigo@sdfg.com.ar \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@weissschuh.net \
--cc=w@1wt.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®