From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from server.nextmovesoftware.com (server.nextmovesoftware.com [162.254.253.69]) by sourceware.org (Postfix) with ESMTPS id BC2B73858D32 for ; Thu, 4 Jan 2024 13:59:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BC2B73858D32 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=nextmovesoftware.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nextmovesoftware.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BC2B73858D32 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=162.254.253.69 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704376748; cv=none; b=NOmcCBRy4i9+ggoVYZEKNNdSfvBPUEFwWpUEaQ6lySAAFNqeMSabnLKXjvoxZrnq+dEbzij9+dFtDNLx5jBCE29sgOUQQJFwNz85guJQc6ucvmvuTE615/QKbhHcgX3vLn3cqd7UqtKCgbofX1wxv+D+IOBIQFr0hL3FVsfX4uY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704376748; c=relaxed/simple; bh=5Z7bxgvtl0b8voiHEIDAMkYzIrSStkaBb3sQoedUVcY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=kp+3Ah0Dbq85XaIY0ClzO8n1BPSvWXI2RygEwKB/Kuw6KCPIfuy9YrHNvmK1pxOcvyY9FOQgtPVXUNMEtLTpNcvjgcOjmaypfAJAvitq7mSHLMx4H3IfEF4bCCJsnOBH5X63jrtHQf9VW4B7Y6W0AzCPQorNaRqJ+c8gd4daoPE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nextmovesoftware.com; s=default; h=Content-Type:MIME-Version:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ArxD7c1jvqxkP7gwAF9EOwMLUUMxumikhCHZcEJHXkw=; b=Jm/JzVLIifWmA4axmWg9Cwr8By MlTDHRDVGD55SYVksKxdqhcdryckrb5VrPqEiJDXbkqIuB47Qc4JUSliKWEpKLssnHeIkaF9hj71K rYOB3oFlS8wNgpNo4zg+OgBiM/VYrshkkngfowppa0i5O1Mlw7sEnmqKsm52UdPuGlmm+MUJmbE2a iHT+XDzTxYv61EGQ3xhyE9EDPGkFm24pwW9Wt8OstZTMaAfD5AdGamkfpDPXyq3DRu6XVrV9+Iew8 HtyjS4egrC0GWFHSmoJG4dN0wMtN9vy4BUL6UfWgIn5lmFuX1QgK14D6+iATIU856w1nEozRhLVgJ HqkEEkzQ==; Received: from [185.62.158.67] (port=63756 helo=Dell) by server.nextmovesoftware.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1rLOFV-0008Mi-2M; Thu, 04 Jan 2024 08:59:05 -0500 From: "Roger Sayle" To: Cc: "'Jeff Law'" Subject: [PATCH] libgloss: Resolve compilation errors for mips. Date: Thu, 4 Jan 2024 13:59:03 -0000 Message-ID: <00ac01da3f16$2e292610$8a7b7230$@nextmovesoftware.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_00AD_01DA3F16.2E292610" X-Mailer: Microsoft Outlook 16.0 Thread-Index: Ado/FaDMhJmDMn6lTZuPX6yjHuIqfA== Content-Language: en-gb X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server.nextmovesoftware.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - nextmovesoftware.com X-Get-Message-Sender-Via: server.nextmovesoftware.com: authenticated_id: roger@nextmovesoftware.com X-Authenticated-Sender: server.nextmovesoftware.com: roger@nextmovesoftware.com X-Source: X-Source-Args: X-Source-Dir: X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This is a multipart message in MIME format. ------=_NextPart_000_00AD_01DA3F16.2E292610 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit This patch fixes some compilation issues in libgloss when building a cross-compiler for mips. This mostly requires new function prototypes, similar to the changes recently made by Jeff Law for other targets. 2024-01-04 Roger Sayle libgloss/ChangeLog * kill.c: Prototype _exit. * mips/cfe_mem.c (__libcfe_meminit): Add casts to avoid compilation warnings/errors. * mips/cma101.c: Prototype __cpu_timer_poll and __cpu_flush. * mips/syscalls.c: Prototype get_mem_info. (sbrk): Add casts to avoid compilation warnings/errors. * mips/test.c: Prototype outbyte and print. Fix return type of main. * print.c: Prototype outbyte. Make ptr argument const char*. * putnum.c: Update prototype of print to const char*. Ok? Roger -- ------=_NextPart_000_00AD_01DA3F16.2E292610 Content-Type: application/octet-stream; name="libgloss.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="libgloss.patch" diff --git a/libgloss/kill.c b/libgloss/kill.c=0A= index a0eaee75b..a53ba331a 100644=0A= --- a/libgloss/kill.c=0A= +++ b/libgloss/kill.c=0A= @@ -14,6 +14,8 @@=0A= */=0A= #include "glue.h"=0A= =0A= +extern void _exit (int);=0A= +=0A= /*=0A= * kill -- go out via exit...=0A= */=0A= diff --git a/libgloss/mips/cfe_mem.c b/libgloss/mips/cfe_mem.c=0A= index 87caabf8c..41b871eef 100644=0A= --- a/libgloss/mips/cfe_mem.c=0A= +++ b/libgloss/mips/cfe_mem.c=0A= @@ -58,7 +58,7 @@ __libcfe_meminit (void)=0A= /* If the user has provided a memory-limit function, use it to=0A= determine the end of usable memory. */=0A= if (&__libcfe_mem_limit !=3D NULL)=0A= - memtop =3D __libcfe_mem_limit ();=0A= + memtop =3D (unsigned long)__libcfe_mem_limit ();=0A= else=0A= {=0A= uint64_t start, length, type;=0A= @@ -80,7 +80,7 @@ __libcfe_meminit (void)=0A= {=0A= /* Did not find an available entry containing _end.=0A= Assume a minimal amount of memory (1MB). */=0A= - memtop =3D _end + (1 * 1024 * 1024);=0A= + memtop =3D (unsigned int)(_end + (1 * 1024 * 1024));=0A= break;=0A= }=0A= =0A= diff --git a/libgloss/mips/cma101.c b/libgloss/mips/cma101.c=0A= index e8f381864..ba58b1d5f 100644=0A= --- a/libgloss/mips/cma101.c=0A= +++ b/libgloss/mips/cma101.c=0A= @@ -133,6 +133,7 @@ set_pclock (void)=0A= return;=0A= }=0A= =0A= +extern void __cpu_timer_poll (int);=0A= #define PCLOCK_WAIT(x) __cpu_timer_poll((x) * pclock)=0A= =0A= /* NOTE: On the Cogent CMA101 board the LCD controller will sometimes=0A= @@ -178,6 +179,7 @@ lcd_display (int line, const char *msg)=0A= extern unsigned int __buserr_count(void);=0A= extern void __default_buserr_handler(void);=0A= extern void __restore_buserr_handler(void);=0A= +extern void __cpu_flush(void);=0A= =0A= /* Allow the user to provide his/her own defaults. */=0A= unsigned int __sizemem_default;=0A= diff --git a/libgloss/mips/syscalls.c b/libgloss/mips/syscalls.c=0A= index 3ab543674..4661b97be 100644=0A= --- a/libgloss/mips/syscalls.c=0A= +++ b/libgloss/mips/syscalls.c=0A= @@ -5,6 +5,7 @@=0A= #include "regs.S"=0A= =0A= extern char _end[];=0A= +extern void *get_mem_info (void*);=0A= =0A= /* FIXME: This is not ideal, since we do a get_mem_info() call for=0A= every sbrk() call. */=0A= @@ -31,8 +32,8 @@ sbrk (nbytes)=0A= /* NOTE: The value returned from the get_mem_info call is the amount=0A= of memory, and not the address of the (last byte + 1) */=0A= =0A= - if (((size_t)heap_ptr >=3D heap_start) && ((size_t)heap_ptr < = (heap_start + mem.size))) {=0A= - avail =3D (heap_start + mem.size) - (size_t)heap_ptr;=0A= + if ((heap_ptr >=3D heap_start) && (heap_ptr < (heap_start + = mem.size))) {=0A= + avail =3D (unsigned int)((heap_start + mem.size) - heap_ptr);=0A= base =3D heap_ptr;=0A= } /* else will fail since "nbytes" will be greater than zeroed = "avail" value */=0A= =0A= diff --git a/libgloss/mips/test.c b/libgloss/mips/test.c=0A= index a99347914..b580ea933 100644=0A= --- a/libgloss/mips/test.c=0A= +++ b/libgloss/mips/test.c=0A= @@ -1,4 +1,7 @@=0A= -main()=0A= +extern int outbyte(unsigned char byte);=0A= +extern void print (const char *);=0A= +=0A= +int main()=0A= {=0A= outbyte ('&');=0A= outbyte ('@');=0A= @@ -9,5 +12,5 @@ main()=0A= =0A= print ("\r\nDone...");=0A= =0A= - return;=0A= + return 0;=0A= }=0A= diff --git a/libgloss/print.c b/libgloss/print.c=0A= index 76d543b67..3b7f91606 100644=0A= --- a/libgloss/print.c=0A= +++ b/libgloss/print.c=0A= @@ -14,11 +14,13 @@=0A= */=0A= #include "glue.h"=0A= =0A= +extern int outbyte (char x);=0A= +=0A= /*=0A= * print -- do a raw print of a string=0A= */ =0A= void=0A= -print (char *ptr)=0A= +print (const char *ptr)=0A= {=0A= while (*ptr) {=0A= outbyte (*ptr++);=0A= diff --git a/libgloss/putnum.c b/libgloss/putnum.c=0A= index 6e1051e24..1720098bd 100644=0A= --- a/libgloss/putnum.c=0A= +++ b/libgloss/putnum.c=0A= @@ -14,7 +14,7 @@=0A= */=0A= #include "glue.h"=0A= =0A= -extern void print (char *ptr);=0A= +extern void print (const char *ptr);=0A= =0A= /*=0A= * putnum -- print a 32 bit number in hex=0A= ------=_NextPart_000_00AD_01DA3F16.2E292610--