public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Dimitar Dimitrov <dimitar@dinux.eu>
To: newlib@sourceware.org
Cc: Dimitar Dimitrov <dimitar@dinux.eu>
Subject: [PATCH v2 2/2] libgloss: pru: Trim crt0-minrt.o
Date: Wed,  3 Jan 2024 19:56:55 +0200	[thread overview]
Message-ID: <20240103175655.1394938-2-dimitar@dinux.eu> (raw)
In-Reply-To: <20240103175655.1394938-1-dimitar@dinux.eu>

Strip a few more instructions from crt0-minrt.S:
  - Remove "halt" and rely on the infinite loop after main()'s return.
  - Remove main()'s argc and argv argument initialization.  Host loader
    does not set them, and typical firmware does not use them, either.
  - Remove the __dso_handle symbol.

This should be safe because the default crt0.S is fully standards
compliant.  Whereas crt0-minrt.S has been documented from the beginning
to intentionally miss features in order to reduce firmware size, while
still enabling typical PRU firmware to operate.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
---
 libgloss/pru/crt0-minrt.S | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/libgloss/pru/crt0-minrt.S b/libgloss/pru/crt0-minrt.S
index 60647d372..fa5e80af4 100644
--- a/libgloss/pru/crt0-minrt.S
+++ b/libgloss/pru/crt0-minrt.S
@@ -38,22 +38,9 @@ _start:
 
 	/* DATA and BSS are handled by the loader, so nothing to do here. */
 
-	/* Just in case main() tries to access argc, argv[] and envp. */
-	zero	r14, 3 * 4
-
-	/* Call main. */
+	/* Call main. Assume argc and argv are not used with -minrt! */
 	call	main
 
 	/* We should never reach here. */
 _crt_exit:
-	halt
 	jmp	_crt_exit
-
-	/* PRU obviously has no shared libraries, but dso_handle
-	   helps to achieve better GCC test coverage. Besides,
-	   it should be free with minrt. */
-	.section .data
-	.global __dso_handle
-	.weak __dso_handle
-__dso_handle:
-	.long	0
-- 
2.43.0


  reply	other threads:[~2024-01-03 17:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-02  8:24 [PATCH 1/2] libgloss: merge pru into top-level Makefile Dimitar Dimitrov
2024-01-02  8:24 ` [PATCH 2/2] libgloss: pru: Trim crt0-minrt.o Dimitar Dimitrov
2024-01-02 13:15 ` [PATCH 1/2] libgloss: merge pru into top-level Makefile Mike Frysinger
2024-01-03 17:56 ` [PATCH v2 " Dimitar Dimitrov
2024-01-03 17:56   ` Dimitar Dimitrov [this message]
2024-01-03 21:48   ` Mike Frysinger

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=20240103175655.1394938-2-dimitar@dinux.eu \
    --to=dimitar@dinux.eu \
    --cc=newlib@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).