From patchwork Sat Dec 23 04:31:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 82787 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 502293858422 for ; Sat, 23 Dec 2023 04:32:03 +0000 (GMT) X-Original-To: newlib@sourceware.org Delivered-To: newlib@sourceware.org Received: from mail-il1-x130.google.com (mail-il1-x130.google.com [IPv6:2607:f8b0:4864:20::130]) by sourceware.org (Postfix) with ESMTPS id 9C2CA3858D33 for ; Sat, 23 Dec 2023 04:31:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9C2CA3858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9C2CA3858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::130 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703305913; cv=none; b=pHmnC+SToae2mkx+0RSUbob87zC5L2jAXk/hQRSRSbjJ2fZJBfA6Diq6Mg1zi/dsnyF99QLmofCmh9ILsghaEpr17zZ/FcgaAUFrSrKQK4UsWXd4qwkLQB6Tyz64bcndhk862P4EkuBIVlSAMxRJn3cLylKmsJAPUGFRacsYQ6k= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703305913; c=relaxed/simple; bh=N6rhcFYNpsCmKfomrVblOgoNvj/jhZiqK+ruI732UbM=; h=DKIM-Signature:Message-ID:Date:MIME-Version:To:From:Subject; b=DHezmw6bD8HtHvLttu+sR4wLhq3Nlps31p4DBeiL45YT8cJ+V+8LnDDFctXtoqH/WLxo8FtGZDFLVk1YjljWyddnziXvDLTk7HVu32L8EYaUqyn3svckRM712AEg8TLAO59WgTu80gecxV1ur84/8N5Yzq0S2ong9kmPCIbuoZc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-il1-x130.google.com with SMTP id e9e14a558f8ab-35fe9a6609eso3433255ab.2 for ; Fri, 22 Dec 2023 20:31:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703305910; x=1703910710; darn=sourceware.org; h=subject:from:to:content-language:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=sjvhESIOB213Rty66qbI/EhDcXGnhm6gXeaBSqGlLt8=; b=dS1jyu8DVlLLDVNjLkHbRVGUESNzRCHTWesFkEgvPG37EZ524KkbjlmXbmGHL/85G1 R+2PoWwZQM5u6FSjW5UclxBrRv5YvZFY0xBxru3YsX0h3gyfK4ct6mVLF2AgGC+TZ/ux 6oVT0jIrRydN8ppu9ItTv44peQm23Ambspx90LTPFP/qXE1asBbOB9O8l1K6jiE2R0oq mRf7zi4bn4Aq1sDTBStS4nvsQjkL2Dv+Pg2FRhp1QdVbmY2Wy1ENiIcbX/4jwLwydJRt 0eQfVCXKPRe+4DZ+bQFNrGsOP5QwJa3aDz7HlEJU3peRGaRjSg8pHVcy25SShaq+pKuM g7FQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703305910; x=1703910710; h=subject:from:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sjvhESIOB213Rty66qbI/EhDcXGnhm6gXeaBSqGlLt8=; b=EQCs2J7yCeE64JnInodwf+m7cmJJ91hxNZkwo81b3GCfwe/WLmn1fXS33GNEcNf8fr Al1OVQ5O5AdNSJM5FHkkj6mCduNxJYSgdMTfIC25ScT5OUlNuPPL8iaptbfkHuGfTM9t YuKgAxcV6rctHqemBA8yQzSF70yz2rheZiZ5ERFZOl8pyi1EOc26TAkgc7r208ZrhChV 2u8S7sUuytOgtT0qImnXXZVXI9cF3bBL8KJk+FLo+zXOYyMn0VPsv5ucvLbyZvJON580 X41X6fNEdOxmS1idhhVsArOYADBdn3JA/ndJTJgXUmNe/1ypnU24kllI0+/JAQ9S4RX4 jcOg== X-Gm-Message-State: AOJu0Yw8fBaamy1FCgIfgWfCj+S3AaP3TsOFoZjFE8qeSxKC19WLbPjE 4iFnGLtFALMiUvNDZmfS2y1JTzyjGkU= X-Google-Smtp-Source: AGHT+IFKfUTwV9JD1xQZdx6MYhcWRvH56b4BQHe/COV7khscUmNC2/BrEL2Fbh5udi26Yu6SBkv1+w== X-Received: by 2002:a05:6e02:1a02:b0:35f:eb24:bb54 with SMTP id s2-20020a056e021a0200b0035feb24bb54mr779386ild.99.1703305909869; Fri, 22 Dec 2023 20:31:49 -0800 (PST) Received: from [172.31.1.103] ([172.56.168.60]) by smtp.gmail.com with ESMTPSA id fh16-20020a17090b035000b0028bf79ad453sm3691910pjb.21.2023.12.22.20.31.48 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 22 Dec 2023 20:31:49 -0800 (PST) Message-ID: Date: Fri, 22 Dec 2023 21:31:47 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: newlib@sourceware.org From: Jeff Law Subject: Fix epiphany libgloss for c99/gcc-14 X-Spam-Status: No, score=-8.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_ASCII_DIVIDERS, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, 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 X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: newlib-bounces+patchwork=sourceware.org@sourceware.org So in this case we mostly need to include an internal header (epiphany-syscalls.h). In a few cases an explicit prototype is added. We've also got a return with no value in a function with a non-void return type. Finally the asm_syscall interface expects a pointer as its first argument. In a few cases we've actually got an int (file descriptor) which we just cast to a void *. It's slightly more than Jeff J's pre-approval, but I think still reasonable. Pushed to the trunk. Jeff L. commit 1df8f9f09b0999e04bc0bbd7170ac7dbfa278213 Author: Jeff Law Date: Fri Dec 22 21:29:56 2023 -0700 Fix epiphany libgloss for c99/gcc-14 So in this case we mostly need to include an internal header (epiphany-syscalls.h). In a few cases an explicit prototype is added. We've also got a return with no value in a function with a non-void return type. Finally the asm_syscall interface expects a pointer as its first argument. In a few cases we've actually got an int (file descriptor) which we just cast to a void *. It's slightly more than Jeff J's pre-approval, but I think still reasonable. diff --git a/libgloss/epiphany/_isatty.c b/libgloss/epiphany/_isatty.c index cfb1bf6e4..f05aba3c3 100644 --- a/libgloss/epiphany/_isatty.c +++ b/libgloss/epiphany/_isatty.c @@ -18,6 +18,7 @@ #include #include +#include "epiphany-syscalls.h" int _isatty (int fd) diff --git a/libgloss/epiphany/epiphany-syscalls.c b/libgloss/epiphany/epiphany-syscalls.c index e6ebcee24..4c03fe291 100644 --- a/libgloss/epiphany/epiphany-syscalls.c +++ b/libgloss/epiphany/epiphany-syscalls.c @@ -253,7 +253,7 @@ int __attribute__ ((section ("libgloss_epiphany"))) e_raise(int signum) { __asm__ __volatile__ ("wand"); //ilatst = 1 << WAND_IVT_N; //break; - return; + return 0; case SIG_USR1: ilatst = 1 << USR_SOFT_IVT_N; diff --git a/libgloss/epiphany/epiphany-syscalls.h b/libgloss/epiphany/epiphany-syscalls.h index 3af1c6f7b..b46587573 100644 --- a/libgloss/epiphany/epiphany-syscalls.h +++ b/libgloss/epiphany/epiphany-syscalls.h @@ -35,5 +35,7 @@ int asm_open(const char* FILE, int FLAGS, int MODE); void asm_exit(int STATUS); int asm_close(int CHAN); int asm_syscall(void *P1, void *P2, void *P3, int SUBFUN); +int _fstat (int, struct stat *st); + #endif diff --git a/libgloss/epiphany/fstat.c b/libgloss/epiphany/fstat.c index 5a20b57f3..d126c2de8 100644 --- a/libgloss/epiphany/fstat.c +++ b/libgloss/epiphany/fstat.c @@ -31,6 +31,7 @@ #include #include +#include "epiphany-syscalls.h" /* ------------------------------------------------------------------------- */ @@ -44,6 +45,6 @@ int __attribute__ ((section ("libgloss_epiphany"))) _fstat (int fildes, struct stat *st) { - return asm_syscall (fildes, st, NULL, SYS_fstat); + return asm_syscall ((void *)fildes, st, NULL, SYS_fstat); } /* _fstat () */ diff --git a/libgloss/epiphany/gettimeofday.c b/libgloss/epiphany/gettimeofday.c index e169385ea..36f17b8b0 100644 --- a/libgloss/epiphany/gettimeofday.c +++ b/libgloss/epiphany/gettimeofday.c @@ -31,6 +31,7 @@ #include #include #include "syscall.h" +#include "epiphany-syscalls.h" int _gettimeofday (struct timeval *tp, void *tzp) diff --git a/libgloss/epiphany/link.c b/libgloss/epiphany/link.c index d87637e39..fd0d8b9cb 100644 --- a/libgloss/epiphany/link.c +++ b/libgloss/epiphany/link.c @@ -31,6 +31,7 @@ #include #include +#include "epiphany-syscalls.h" /* ------------------------------------------------------------------------- */ diff --git a/libgloss/epiphany/lseek.c b/libgloss/epiphany/lseek.c index 64ffcdd28..65d7e52da 100644 --- a/libgloss/epiphany/lseek.c +++ b/libgloss/epiphany/lseek.c @@ -30,6 +30,7 @@ #include #include +#include "epiphany-syscalls.h" /* ------------------------------------------------------------------------- */ /*!Set a position in a file @@ -43,5 +44,5 @@ off_t __attribute__ ((section ("libgloss_epiphany"))) _lseek (int fildes, off_t offset, int whence) { - return asm_syscall (fildes, offset, whence, SYS_lseek); + return asm_syscall ((void *)fildes, (void *)offset, (void *)whence, SYS_lseek); } /* _lseek () */ diff --git a/libgloss/epiphany/stat.c b/libgloss/epiphany/stat.c index 988f28dba..f9a3872a8 100644 --- a/libgloss/epiphany/stat.c +++ b/libgloss/epiphany/stat.c @@ -31,6 +31,7 @@ #include #include +#include "epiphany-syscalls.h" /* ------------------------------------------------------------------------- */ diff --git a/libgloss/epiphany/unlink.c b/libgloss/epiphany/unlink.c index c78af284d..653f24b95 100644 --- a/libgloss/epiphany/unlink.c +++ b/libgloss/epiphany/unlink.c @@ -31,6 +31,7 @@ #include #include +#include "epiphany-syscalls.h" /* ------------------------------------------------------------------------- */