From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 9F20E3858D37 for ; Thu, 31 Aug 2023 19:43:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9F20E3858D37 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693511013; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=CQ6n9BsTnvJY21GeWVIGshorX/1dYSWGDLUje4afdIs=; b=XX1jpVMcHmQyxoFjxYM9zoDNQXVGIPMEh1dOaPnIGXTvsCehsKCJygZkRerq1NH3b4kew4 b5HyMXyD0Lczch1UxjrvN4w09FAR3c5vvdZ5MC0tZt90EsPnr8hK7wH1/BDH5yK6gPaIsm phorSaTPCgcW27YD3kZidsfhP25eqKI= Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-402-uz2kRC7sPM6OuAnch1LFIg-1; Thu, 31 Aug 2023 15:43:29 -0400 X-MC-Unique: uz2kRC7sPM6OuAnch1LFIg-1 Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2bcda0aa7ffso15057431fa.1 for ; Thu, 31 Aug 2023 12:43:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693511008; x=1694115808; 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=CQ6n9BsTnvJY21GeWVIGshorX/1dYSWGDLUje4afdIs=; b=hp+Hcapbkg7mXozwvQoiXUtQE/5fg6jaSC291iNUnG2VoHszKUblBS6H4jTOyTs4kC VatVilqM9RIs8qExKZnuUF7B7e/swR83fswrIsx3vyXfQGGqZv8/whNIs2wNNQnSSIn8 73AypXFtjqjySEnnSVDLh/CHBMsgjNYXaYP6fp5ZxUCecLn4NyFf7E3q343Vmy5VWgdr GTrfjx3uWnQ8L/J/Oxgm6AwrDKyJA7pFPrmnMK1aDYkxtGXDDUi30ZUPc5fyljG7tnzL T/o4iXXPEk9xMczMNnikw5tFFIY0Nc5OLUQ4IVInu6MyScrUaoGUDYQFR1d/SynaBZgo TlQA== X-Gm-Message-State: AOJu0Yzrx1/OI7oRzVOAsKQpetE7nkAhuCtRn/bIg1vRN5w27HJMFXd1 Sqo7ZYrcJgXfI5I9LVe2HOUSTk3hpmcpAt8V5VpnjAFp3Mh0ydvrMmU/A0aXDuO8bLaPnxBQRt7 TvtZXDRFCvyS4JUIfo19IPQ+6lI0VKApg1rH14q8= X-Received: by 2002:a2e:7015:0:b0:2b5:9d78:213e with SMTP id l21-20020a2e7015000000b002b59d78213emr182000ljc.22.1693511008553; Thu, 31 Aug 2023 12:43:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFUi60ate8Oku9X5MRWFPMWp7XGCiQ6qqd5dshFkkaqaeQLijg4hYVk1ExBxMlyAtbBwGxV2V6EV2r3XmzUmbc= X-Received: by 2002:a2e:7015:0:b0:2b5:9d78:213e with SMTP id l21-20020a2e7015000000b002b59d78213emr181995ljc.22.1693511008242; Thu, 31 Aug 2023 12:43:28 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Thu, 31 Aug 2023 20:43:17 +0100 Message-ID: Subject: Re: [PATCH] libstdc++: Use GLIBCXX_CHECK_LINKER_FEATURES for cross-builds (PR111238) To: Christophe Lyon Cc: GCC Patches , libstdc++@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,URI_HEX autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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. 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. > 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.