From nobody Sun Apr 28 03:49:54 2024 X-Original-To: toolchain@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VRssv2vY2z5HnfV for ; Sun, 28 Apr 2024 03:49:55 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VRssv1ZPrz4mQ9 for ; Sun, 28 Apr 2024 03:49:55 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1714276195; a=rsa-sha256; cv=none; b=ROYrulJMYGo+CSGbkRH9QYGmWbrm2qrtlhaohBtcO0F2+1MzjnbLOSdv77K+tzgAS/jDPO jCsgM5NR7IhPiw8GLpg+kmosb3b4jTt0/MWHs0BwzceScFo0jZbaW1Z1MfmXj/MevKigwM /+1MkseG68pIByxpMpWCZJRNEYDXorRIGW7QZGOs0Htd6Pnjk7TvA3IGpVhTEmpfEOwZvn mHL8c1J67nJaosRQoCfxi3k3YmBQaAUoMeZioxPu3I9sTCDfifyNCfmy+HArbCuYlFfQDX Kf3F0y8hOqdxd4ngSq/SQRQmzmPdJLzYKtGUInSPR4qz6JC2fm9ZtaqFSIdFew== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714276195; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YIVP5jt0MmlpFaCMgrDdCRcGrTHj0d94ocUtunlabik=; b=hIz1gAJEgQbOHPQyTqPVfgAWGdl/zOOy4ZWRGPEMR17pBXUYt/ayIqHfs9tY1v8B0OOh/B Y5BrARr/UaF94PczxE+tpa6q2rkwzNbCNmKkb5O12YME/kuomSsAC71K+DZHAHThgQEZeR EK6IqF8s5RDGvWUFsJMCtQsIv03T8QJwnt7TA8LQrpUe66RSkmXu21cfhkHZWoQtjFk6Yg NwtNJnmslW61Ht3i4fEXfERuBAV4kgs+XQ32U1y4NtJwVgqrJl3edUtkEyr04oZt3OautV pI2NeOHdH21yYL/6+sQorHfgsbm1q2iKrMfSuFzUFLZTWViwNwhnXa9uRgL/IA== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VRssv17Gzz18Nk for ; Sun, 28 Apr 2024 03:49:55 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 43S3nta8004571 for ; Sun, 28 Apr 2024 03:49:55 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 43S3ntZG004570 for toolchain@FreeBSD.org; Sun, 28 Apr 2024 03:49:55 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: toolchain@FreeBSD.org Subject: [Bug 278551] lang/gcc: exceptions do not work in statically linked binaries Date: Sun, 28 Apr 2024 03:49:54 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Ports & Packages X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: marklmi26-fbsd@yahoo.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: toolchain@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Maintenance of FreeBSD s integrated toolchain List-Archive: https://lists.freebsd.org/archives/freebsd-toolchain List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: freebsd-toolchain@freebsd.org Sender: owner-freebsd-toolchain@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D278551 --- Comment #21 from Mark Millard --- (In reply to Mohammed Goder from comment #20) Niether With proper command line options the trivial test case variant below works just fine on FreeBSD. // File: lang-gcc-g++-exception-handling.cpp // On FreeBSD: // Works: g++13 -static -Wl,--eh-frame-hdr lang-gcc-g++-exception-handling.= cpp -o lang-gcc-g++-exception-handling && ./lang-gcc-g++-exception-handling // FAILS: g++13 -static lang-gcc-g++-exception-handling.= cpp -o lang-gcc-g++-exception-handling && ./lang-gcc-g++-exception-handling int main(int argc, char *argv[]) { try { throw (int)0; } catch (int i) { return 0; } return 1; } Such is also true with -static-libgcc -static-libstdc++ added to the command lines. I do not know if -Wl,--eh-frame-hdr should be implicit/automatic for FreeBSD. My test context was based on: # uname -apKU FreeBSD aarch64-main-pbase 15.0-CURRENT FreeBSD 15.0-CURRENT #5 main-n269589-9dcf39575efb-dirty: Sun Apr 21 01:42:00 PDT 2024=20=20=20=20 root@aarch64-main-pbase:/usr/obj/BUILDs/main-CA76-nodbg-clang/usr/main-src/= arm64.aarch64/sys/GENERIC-NODBG-CA76 arm64 aarch64 1500018 1500018 # ~/fbsd-based-on-what-commit.sh -C /usr/ports 62a76b7dc95a (HEAD -> main, freebsd/main, freebsd/HEAD) graphics/mahotas: Update to 1.4.15 Author: Wen Heping Commit: Wen Heping CommitDate: 2024-04-22 00:04:50 +0000 branch: main merge-base: 62a76b7dc95aa8c2a74b06f92b0a8b752e3b1848 merge-base: CommitDate: 2024-04-22 00:04:50 +0000 n661234 (--first-parent --count for merge-base) I'll note that the same is true for: // File: lang-gcc-g++-exception-handling-with-threads.cpp // On FreeBSD: // Works: g++13 -static -Wl,--eh-frame-hdr -pthread lang-gcc-g++-exception-handling-with-threads.cpp -o lang-gcc-g++-exception-handling-with-threads && ./lang-gcc-g++-exception-handling-with-threads // FAILS: g++13 -static -pthread lang-gcc-g++-exception-handling-with-threads.cpp -o lang-gcc-g++-exception-handling-with-threads && ./lang-gcc-g++-exception-handling-with-threads #include "iostream" #include "cstdio" #include "pthread.h" #include "pthread_np.h" void* kernel(void* par) { printf("kernel\n"); return NULL; } int main(int argc, const char* const* args){ pthread_t thread; pthread_create( &thread, NULL, kernel, NULL ); pthread_join(thread, NULL); printf("FreeBSD doesn't reach here.\n"); return 0; } --=20 You are receiving this mail because: You are the assignee for the bug.=