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.129.124]) by sourceware.org (Postfix) with ESMTPS id BA0FA3858C2C for ; Fri, 1 Dec 2023 12:09:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BA0FA3858C2C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BA0FA3858C2C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701432586; cv=none; b=mDynwg8ffBwG2IBJljfk2YwoDyfZYwQLJXa7mbSpx/UPoBz8hEmvegJjDygU9ZWQW4m0thMTHB23B0XDsCj+y+IlP6J2oZKOrN4I715yjsKllOuyaaiE5nPg06A2HhjnXj1tfABYl5BYaIJprSCFS/q23Z5Tr1mzhoy8knQAS24= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701432586; c=relaxed/simple; bh=29C5ZgSDutcCvjKM/TXmELgM6mLJ8glGCqumoDwcDG8=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=xwBPojNYBIgBYb/fzMEQoR143idd8NLFTrdbnNz2l9+36iMsIHkT0TTzPoRChHTf91ZyR2TAfsFgXKSqMzBDa04CowWdHUu2YAQONb6flJil93Qa8cf+fAgtRLXQbbd4CSd+ke5E/cmMUtGm6DvzPLb8q9DP3jX0gCZGziC80Vo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701432585; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HKSItbUjfjQRcSwIhxEGicFrJbkZ+slI2k4JPRpO2Cs=; b=dCsS7oCafxM9f1KkVzqrgSDIumMJY112RiK8G0NGWwjbe8DfpWZ03LS/fB4+y+F85dsY1D 0iHO8Q3QkjSrHdIdO984aimoDbog6hKJGOy3YNJTo+mMejtFKxuShOnVqeUAOOM2nxeOTh anXzDUAdavy4kmF/RHpfymTugWo0BjA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-191-BDClDe4zOdyFVqPUhEgKPA-1; Fri, 01 Dec 2023 07:09:42 -0500 X-MC-Unique: BDClDe4zOdyFVqPUhEgKPA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D371A811E7B; Fri, 1 Dec 2023 12:09:41 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.195.157]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 947DC1121307; Fri, 1 Dec 2023 12:09:41 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 3B1C9c1N609039 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 1 Dec 2023 13:09:39 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 3B1C9b3t609038; Fri, 1 Dec 2023 13:09:37 +0100 Date: Fri, 1 Dec 2023 13:09:36 +0100 From: Jakub Jelinek To: Jan Hubicka Cc: Andreas Schwab , Richard Biener via Gcc , Florian Weimer , Richard Biener , Jonathan Yong <10walls@gmail.com>, Nathan Sidwell Subject: Re: libgcov, fork, and mingw (and other targets without the full POSIX set) Message-ID: Reply-To: Jakub Jelinek References: <878r6es634.fsf@oldenburg.str.redhat.com> <8734wms3ks.fsf@oldenburg.str.redhat.com> <87il5idwr3.fsf@igel.home> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.4 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,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 List-Id: On Fri, Dec 01, 2023 at 01:03:01PM +0100, Jan Hubicka via Gcc wrote: > > On Dez 01 2023, Richard Biener via Gcc wrote: > > > > > Hmm, so why's it then referenced and not "GCed"? > > > > This has nothing to do with garbage collection. It's just the way > > libgcc avoids having too many source files. It would be exactly the > > same if every function were in its own file. > > THe ifdef machinery makes every function to go insto its own .o file > which are then archived. So if user code never calls to fork, the .o > file with fork wrapper should not be picked by linker and we should not > have link error. > > If user code calls fork, then the .o file with wrapper should be picked > and we will get linker error on missing fork. So I think it ought to > work as it is now. Does mingw linker behave somehow differently with > archives? Or is there problem with a libgcov being DLL or something? The problem is that the changes to switch to modern C result in calls to unprototyped function being an error rather than just warning as before. int foo (void) { return fork (); } warning: implicit declaration of function ‘fork’ [-Wimplicit-function-declaration] previously, now error: implicit declaration of function ‘fork’ [-Wimplicit-function-declaration] (by default in C99+). So, as has been discussed earlier, either we should use __builtin_fork () rather than fork (), or we need in configure to test for fork prototype and if missing, prototype it ourselves, or ensure _gcov_fork.o is not compiled on targets which don't have fork prototyped. Jakub