Message ID | 7598c8ae-b123-4c47-8157-0ec11d78749c@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <newlib-bounces+patchwork=sourceware.org@sourceware.org> 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 E6491385DC2B for <patchwork@sourceware.org>; Thu, 14 Dec 2023 14:47:10 +0000 (GMT) X-Original-To: newlib@sourceware.org Delivered-To: newlib@sourceware.org Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by sourceware.org (Postfix) with ESMTPS id C7CB33858D35 for <newlib@sourceware.org>; Thu, 14 Dec 2023 14:46:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C7CB33858D35 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 C7CB33858D35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::530 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702565221; cv=none; b=oQ4eaf/K5+hwT7JOYgcOJ7+dzUlICemkEwd0uq+gQJdNWVMmsnYjw6Y6glF119GwJ2SVQs6EiZTp1Rwb3UUJO9FExjFskJSc3oLopquzqGlG3Xw0o64vsudBjC87MpRVzxlAPT22hO70M+e5yQx3koRfKiUbFxyWitkaPVnReBw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702565221; c=relaxed/simple; bh=XGin2yVvaeS0yNDloO2aFyNa8Kcb5+0VkUQQ8kskmqg=; h=DKIM-Signature:Message-ID:Date:MIME-Version:To:From:Subject; b=fOgLRu8bkPlRByZjZoOgRYbQq3aT+R0Uk16AQPZurZe4EOs4wbSRiE+toFfxNw8+QidC0oVbz6VuLIYTTztQ/y/YngGrJ5bsbBSsI37oPQamgrvxdsJCAA46bk4SQqUrMNVWz1je6xqjFg9Ixrear6HHIJZFfXkphtE4jQzYpng= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-5c68da9d639so4716237a12.3 for <newlib@sourceware.org>; Thu, 14 Dec 2023 06:46:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702565217; x=1703170017; 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=OWC+RP7pOjdc7F1/4+nDQPsFTLNLjP+f/KiOe4RBINI=; b=bf+XLYAUrKuTpgwX3AC92YRITfKHZLYBulYgMsn81d0+DSOtIYnARC8YFE4ShgeCrQ X4f7qIRFu9vPKKm4UWT2Hz7HfsxoSvZrcSig4vbVEzgNA5VBpAP8jnatfQWvODn5Pq2M 6mlOl+yHy47rbpTcaSTI0eulEafT6+KPSO9Q0Ufu9IflU/ODGhhsCdLRzau1Z+HcieP1 zLbgop7Ee+0zodWuYMCkmRx04VI6ImtlH0FhKUawSbjoa0MzWKMlZSca4rq+veTlSWzo GFsL7K8FphVXfMQL0/jwPgy4C7dBhs0KQEH/ykX8ARjdcZHqvRrTdV2l8uqDckllFXho i5dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702565217; x=1703170017; 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=OWC+RP7pOjdc7F1/4+nDQPsFTLNLjP+f/KiOe4RBINI=; b=nJjeeGVEO/6XV9tmtHDD5slDAhuwsZR1yJM0vBOtX9ntwaxxwrTz/B1FgxZnpt4uno r/bPxjuuG/wSBKHEySLOPuv/XLTnfGvCWCTZc6ZLWKg0G6K9QH0orsNgHd/ZNPwYV9aO 9lTPmjBhDGiB6KjImuywbpY/AJW3wQ+dUQm1nxIyudvc5U7ktd6c5xrm76ny2b8QGUTT IITJk/gvhCma0H/tem2VC33xLqejA5h1NVP+R09pUlBnlgYx3uPv3HVL0Dcd27Hq0QKW vrT/beUNMIcmbqQEbDxfOfxAXSbV7hVIHyyamW6zi8KjpfRBi60vD2xBDZSceIX2HZ5r 6Qeg== X-Gm-Message-State: AOJu0Yx4iue/d4KgM4+nCcBTCvt3uBk6vioKyDOGoP1b/DybnsTDw8bE Mp9bby1M71BcII6Iyg7T4sotlP/H684= X-Google-Smtp-Source: AGHT+IF8Vq8nVhEj/niW9tQJdlmv439Ys+ZzcJ+bAJxTVJd7uj5SGkglOVfjLWn3bNRsc10roNHtEg== X-Received: by 2002:a17:903:5cc:b0:1d3:692a:5e48 with SMTP id kf12-20020a17090305cc00b001d3692a5e48mr414771plb.95.1702565217399; Thu, 14 Dec 2023 06:46:57 -0800 (PST) Received: from [172.31.0.109] ([136.36.72.243]) by smtp.gmail.com with ESMTPSA id l15-20020a170902f68f00b001c9c5a1b477sm12565952plg.169.2023.12.14.06.46.55 for <newlib@sourceware.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 Dec 2023 06:46:56 -0800 (PST) Content-Type: multipart/mixed; boundary="------------pmfq10N0O1ucpH1oyBh09ffF" Message-ID: <7598c8ae-b123-4c47-8157-0ec11d78749c@gmail.com> Date: Thu, 14 Dec 2023 07:46:52 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: newlib@sourceware.org From: Jeff Law <jeffreyalaw@gmail.com> Subject: Fix fr30 libgloss build X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, 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 <newlib.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/newlib>, <mailto:newlib-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/newlib/> List-Post: <mailto:newlib@sourceware.org> List-Help: <mailto:newlib-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/newlib>, <mailto:newlib-request@sourceware.org?subject=subscribe> Errors-To: newlib-bounces+patchwork=sourceware.org@sourceware.org |
Series |
Fix fr30 libgloss build
|
|
Commit Message
Jeff Law
Dec. 14, 2023, 2:46 p.m. UTC
gcc-14 will default to c99 and as a result a fair amount of old code in newlib (particularly libgloss) is failing to build. I don't offhand know how many patches will be necessary to fix the various failures. I'll just pick them off one by one from my tree. This particular patch works around the return-mismatch problem syscalls.c for fr30. That file is a bit odd in that most functions are declared as returning an integer, but the implementations look like: > int > _read (file, ptr, len) > int file; > char * ptr; > int len; > { > asm ("ldi:8 %0, r0" :: "i" (SYS_read) : "r0"); > asm ("int #10"); > > return; > } Note the lack of a value on the "return" statement. The assumption is that the interrupt handler implementing syscalls will put the return value into the proper register, so falling off the end of the C function or returning with no value works in the expected way. It's not good code, but it probably works. Working from that assumption I decided to just use a pragma to disable the upgraded diagnostic from GCC -- essentially preserving existing behavior. This is the only fr30 specific issue that needs to be resolved and the only issue (so far) I've seen of this specific nature. OK for the trunk? jeff
Comments
Looks fine. Feel free to push. -- Jeff J. On Thu, Dec 14, 2023 at 9:47 AM Jeff Law <jeffreyalaw@gmail.com> wrote: > > gcc-14 will default to c99 and as a result a fair amount of old code in > newlib (particularly libgloss) is failing to build. I don't offhand > know how many patches will be necessary to fix the various failures. > I'll just pick them off one by one from my tree. > > This particular patch works around the return-mismatch problem > syscalls.c for fr30. > > That file is a bit odd in that most functions are declared as returning > an integer, but the implementations look like: > > > int > > _read (file, ptr, len) > > int file; > > char * ptr; > > int len; > > { > > asm ("ldi:8 %0, r0" :: "i" (SYS_read) : "r0"); > > asm ("int #10"); > > > > return; > > } > > > Note the lack of a value on the "return" statement. The assumption is > that the interrupt handler implementing syscalls will put the return > value into the proper register, so falling off the end of the C function > or returning with no value works in the expected way. It's not good > code, but it probably works. > > Working from that assumption I decided to just use a pragma to disable > the upgraded diagnostic from GCC -- essentially preserving existing > behavior. > > This is the only fr30 specific issue that needs to be resolved and the > only issue (so far) I've seen of this specific nature. > > OK for the trunk? > > jeff >
diff --git a/libgloss/fr30/syscalls.c b/libgloss/fr30/syscalls.c index 2558556b6..36702b03d 100644 --- a/libgloss/fr30/syscalls.c +++ b/libgloss/fr30/syscalls.c @@ -5,6 +5,8 @@ #include <sys/stat.h> #include "../syscall.h" +#pragma GCC diagnostic ignored "-Wreturn-mismatch" + int _read (file, ptr, len) int file;