From patchwork Mon Jul 8 04:01:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hau Hsu X-Patchwork-Id: 57196 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 3B33C386181B for ; Mon, 8 Jul 2024 04:02:32 +0000 (GMT) X-Original-To: newlib@sourceware.org Delivered-To: newlib@sourceware.org Received: from mail-ot1-x32a.google.com (mail-ot1-x32a.google.com [IPv6:2607:f8b0:4864:20::32a]) by sourceware.org (Postfix) with ESMTPS id 87EB7385E027 for ; Mon, 8 Jul 2024 04:02:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 87EB7385E027 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sifive.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 87EB7385E027 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::32a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720411335; cv=none; b=B1Ivvano5Ccimw0tprduddsCXA8f+mC9Tw38BrSte4T8EEM6+/HyOljxTSz/UvvIOs9+rwPgT33vZrtKOlZkbb9NJybbHyRbubTGHFZl3LTLvDwupFUq6sDius3ed01Xovt39FBlQ01vwRVfrMFXCtdayLqgxgtV3y+HcKh9jMI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720411335; c=relaxed/simple; bh=Yo1VnN2LPTPZ3Y/4OjWjpeA60e34pfpgtaOq3M/+FXo=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=bJwwHRJPzQfFqS2vQ0nA3jZHxubas3Wibn4eQ6R7xipcOfJAXYMZIub9+zHifCPgsxTsQQOrDVBoVbS8WCLSSpnmP6CnH54vSiXnhSRlvvyduSX6O+i40ZHsS7Td8z/5EktlveXvSUwtDxgSz+IGFG4cyoj2Xezo9yo3NK7JVTM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ot1-x32a.google.com with SMTP id 46e09a7af769-7036815bde7so510540a34.3 for ; Sun, 07 Jul 2024 21:02:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1720411332; x=1721016132; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=T9WWVV2oAd2Y70GngSrtGG84DgBJBIwjwzj667l6GGs=; b=H/83fqKhM6vsOHltBUB0l7ehPT0qR6yTJcJZKIDkuztV0m1+ff4+F0OhkSaejO+gNn t6JRkIbF/C0ye5PMh74x0hKKVAzBO/ZJsaumkcNNq97z2pKXbOEgqOwN1/+JUhKBO8H2 G0oJnzc30ldaxtSqW9Pe5UzMBTYb+gittihaT5uxYzfFjxjyN3WIbs5YgHmxndPvM62H Vw0lo7lePIa6mlkrFFRuQoTActoHt5YmyITPb9dGE7hnwOt4JZ/Z7tmHwUN30IwyUN7f v62eZTL76bgNjbPJvX/3gI7EsImrjWygo+L+jJ8NjTLxV8qrMQ5zpSQbVvy4BlT42KDX pMKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720411332; x=1721016132; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=T9WWVV2oAd2Y70GngSrtGG84DgBJBIwjwzj667l6GGs=; b=nDwA5HsoygR+h86YAYtWJspF9sReQN+08H7fU6veM2EeDW/JzTxFfw/NNHUYMd0s5v kAy5bH0GfIkcGOFZalB3Gd/UDqXB2bbdNasVkAdM+IjKkbU6+nPVEMbd4zij3BUQSUXk Erl7w7yvStYpXo9BZS4YwSQTUXLL18TmJDGwIS4laahIarf15jQtP/ZW+o9hBhvytVDN FuCt1ogU8Kd9Y6wI+nW5Mu8iZjlGkmQ8eft74RA56j3JGyxIMPDimHQZmuAliWH4z7Gl uuUjnMr6OBjTFVivWHdoe91k6+ASGV5BVmhgE1yMDNkpo931TJODNdBakD6SzgypXR/3 piVQ== X-Gm-Message-State: AOJu0YwvnBy2+f6lWhPYxEomB/Q0kBA9L6kR/hKskLKehHWMQIiPGypf OzbQ+Wwo67M/ocTBYEjFBO+earW21jcnLvaQOEUAf05BnI0ivTh8NFoZegs8GbKoa5Hd6v9nbQC UHdqLL/AhqpKHIUe2nBY+g6/IJso2QRyQvifIgdF939QdJknCdHtP5JN3l0nvJrvITE5qOgMzTU Yvh63RO/nIXMdy35MlGpcTbaILs/mphlS5Og== X-Google-Smtp-Source: AGHT+IEGhhzlJh/SgvaHbAGZIpawl8uyl5Ml1YbBX6YSDX8wYeKan/vmZ0Mvtprfk+ch484lU1yfpQ== X-Received: by 2002:a05:6830:108b:b0:703:5ddb:c416 with SMTP id 46e09a7af769-7035ddbc7b0mr7423622a34.38.1720411331886; Sun, 07 Jul 2024 21:02:11 -0700 (PDT) Received: from sw05.internal.sifive.com ([4.53.31.132]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b3413ad37sm890550b3a.148.2024.07.07.21.02.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Jul 2024 21:02:11 -0700 (PDT) From: Hau Hsu To: newlib@sourceware.org, kito.cheng@gmail.com, hau.hsu@sifive.com Subject: [PATCH 0/2] fix undefined reference to `__ssputws_r' Date: Mon, 8 Jul 2024 12:01:55 +0800 Message-Id: <20240708040157.3770926-1-hau.hsu@sifive.com> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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 *Issue* When compile a simple C++ hello world, we got undefined reference to `__ssputws_r' error with NEWLIB_NANO_FORMATTED_IO after upgrading to newlib-4.4 in risc-v toolchain: svfwprintf.c:(.text._svfwprintf_r+0x8e): undefined reference to `__ssputws_r' *Cause* This is because commit "v{fs}printf/v{fs}wprintf: create external output helpers" introduces a new file ssputws_r.c for a wide-char-oriented helper function. But this file will not be built when newlib_nano_formated_io is enabled. The problem is that the function __ssputws_r() is used by svfwprintf(), which is compiled no matter whether newlib_nano_formated_io is enabled. *Fix* This patch fix the issue by building ssputws_r.c regardless of whether newlib_nano_formated_io is enabled. *Problem of the previous fix* Note that we also reverts a previouls patch that tries to fix the same link error: Because we got other errors after applying this patch: undefined reference to `putwc' ... undefined reference to `getwc' ... undefined reference to `swprintf' The previous patch removes wchar_t functions from NEWLIB_NANO_FORMATTED_IO, but in the newlib/README says: > --enable-newlib-nano-formatted-io > This option does not affect wide-char formatted I/O functions Thus I think we shouldn't remove wchar_t functions from newlib_nano_formated_io. Similar bug report: * https://inbox.sourceware.org/newlib/ed0b48da6c6c4beaacd9fad63efaddc0@syntacore.com/t/ Hau Hsu (2): Revert "libc/stdio: Remove wchar_t functions from NEWLIB_NANO_FORMATTED_IO" libc/stdio: fix undefined reference to `__ssputws_r' newlib/Makefile.in | 1004 ++++++++++++++++---------------- newlib/libc/stdio/Makefile.inc | 54 +- 2 files changed, 528 insertions(+), 530 deletions(-)