From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by sourceware.org (Postfix) with ESMTPS id 1EA6F3858298 for ; Fri, 1 Sep 2023 08:27:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1EA6F3858298 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-522dd6b6438so2236370a12.0 for ; Fri, 01 Sep 2023 01:27:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693556841; x=1694161641; darn=gcc.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=7iJqBsecWKeUcBM8hUsr6qqgePsxAwydstuGLr565rk=; b=I483AE5OIHJ0qG/PEzscZXJCwWAb6sYOS4o0fPDjAzNJzp3zhfNWrez61qzN/paxbL yFxgxqs6u1eBigglLQ/qgO1gbQeFLhx9IaFQUb+1yM/RjX4qJDWOhiv5BqGgjKpNIzoc NBPcRF753dIEdJQ9FCfuWD2e72B5DUY9FAgT2csDxnMcq0YSP1M0nyVUJ6B8p5Y6P2Fc JDmIwbkyMuewcg9aD/Ced9RNH3pi9vC/dNMB5IwkzALqxpmC8H0Q9vsQvHKF59ZkaCC9 udhhfKDrEpHlHiGoojTMTfGssvWYHs+Y2+He2zZkwvxOEA3va/ReX9ucN3RNJSSQlK9p EpVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693556841; x=1694161641; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=7iJqBsecWKeUcBM8hUsr6qqgePsxAwydstuGLr565rk=; b=U2cNnZ+uEBANeVNnynFX2dok80mIiUovZT942lgLe4sZmy85DXehbeoipvQ3ezS8mi WBzma2xbvA0PyMxkt2iWNhRcO/hsCl2UzWPUAgqlljvCnMUEBa6tNb3nZsZCYQqUeslx pfUUg4DBMywcpPUvVCPQG8stwpdDNyHaWV/4CTsDVY0WowpNkVnsPml7XIpl5k1EnHzj cK8/RXTdgbwDQZYEqz0JhRB+mQ3mWJ8ct9wv8OpaiQ//iuSgLxEw5C7/lLgJbkdW+L9c mmIpkZNrAiSpEri+qUVswSJ3GPfrWFWcmn4J+SVGp24gVPHmqAEjgb67D3A14JA0iwtu injg== X-Gm-Message-State: AOJu0YxcnRpoilv0mHNiA/Wz9E3LFlDs2B5FQkOROLoRUNDliOOTFOS5 2vZk6PR3ZRl5/hfjqlVMMSNr8YUHlXYNnBsh4KBdZQ== X-Google-Smtp-Source: AGHT+IFbYTkqKBpyAZpj1ShaS6fh1vuMiA6sWN3WZZyqYaWB348J8EMGl6RY1a8jadDvDDsRLPMu2pyXDom/Tg8pP2E= X-Received: by 2002:aa7:c555:0:b0:523:c35:c209 with SMTP id s21-20020aa7c555000000b005230c35c209mr1227727edr.12.1693556840771; Fri, 01 Sep 2023 01:27:20 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Christophe Lyon Date: Fri, 1 Sep 2023 10:27:12 +0200 Message-ID: Subject: Re: [PATCH] libstdc++: Use GLIBCXX_CHECK_LINKER_FEATURES for cross-builds (PR111238) To: Jonathan Wakely Cc: GCC Patches , libstdc++@gcc.gnu.org Content-Type: multipart/alternative; boundary="000000000000e6cd08060447ed3f" X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,URI_HEX 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: --000000000000e6cd08060447ed3f Content-Type: text/plain; charset="UTF-8" On Thu, 31 Aug 2023 at 21:43, Jonathan Wakely wrote: > On Thu, 31 Aug 2023 at 18:42, Jonathan Wakely wrote: > > > > On Thu, 31 Aug 2023 at 16:26, Christophe Lyon > > wrote: > > > > > > As discussed in PR104167 (comments #8 and below), and PR111238, using > > > -Wl,-gc-sections in the libstdc++ testsuite for arm-eabi > > > (cross-toolchain) avoids link failures for a few tests: > > > > > > 27_io/filesystem/path/108636.cc > > > > I think this one probably just needs { dg-require-filesystem-ts "" } > > because there's no point testing that we can link to the > > std::filesystem definitions if some of those definitions are unusable > > on the target. > > > > // { dg-additional-options "-Wl,--gc-sections" { target gc_sections } } > > > > For the rest of them, does the attached patch help? > > I've tested the patch for an arm-eabi cross compiler, and it fixes the > linker errors. > Indeed, I just checked too, thanks! > It doesn't change the fact that almost any use of the std::filesystem > APIs will hit the linker errors and so require users to link with > --gc-sections (or provide stubs for the missing functions) but that's > for users to deal with (if anybody using newlib targets is even making > use of those std::filesystem APIs anyway). With the patch to tzdb.cc > we don't need to change how libstdc++ is tested for the arm-eabi cross > target. > I think it's better to keep the current status (ie. drop my patch proposal), so that we are aware of similar issues in the future. I'd say this should be documented, not sure where? Actually it might also be worth considering removing -gc-sections from native builds, if there's no clear reason to use it ;-) Thanks, Christophe > > > If arm-eabi > > doesn't define _GLIBCXX_HAVE_READLINK then there's no point even > > trying to call filesystem::read_symlink. We can avoid a useless > > dependency on it by reusing the same preprocessor condition that > > filesystem::read_symlink uses. > > > > > std/time/clock/gps/1.cc > > > std/time/clock/gps/io.cc > > > std/time/clock/tai/1.cc > > > std/time/clock/tai/io.cc > > > std/time/clock/utc/1.cc > > > std/time/clock/utc/io.cc > > > std/time/clock/utc/leap_second_info.cc > > > std/time/exceptions.cc > > > std/time/format.cc > > > std/time/time_zone/get_info_local.cc > > > std/time/time_zone/get_info_sys.cc > > > std/time/tzdb/1.cc > > > std/time/tzdb/leap_seconds.cc > > > std/time/tzdb_list/1.cc > > > std/time/zoned_time/1.cc > > > std/time/zoned_time/custom.cc > > > std/time/zoned_time/io.cc > > > std/time/zoned_traits.cc > > > > > > This patch achieves this by calling GLIBCXX_CHECK_LINKER_FEATURES in > > > cross-build cases, like we already do for native builds. We keep not > > > doing so in Canadian-cross builds. > > > > > > However, this would hide the fact that libstdc++ somehow forces the > > > user to use -Wl,-gc-sections to avoid undefined references to chdir, > > > mkdir, chmod, pathconf, ... so maybe it's better to keep the status > > > quo and not apply this patch? > > > > I'm undecided about this for now, but let's wait for HP's cris-elf > > testing anyway. > > --000000000000e6cd08060447ed3f--