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 25045386F802 for ; Fri, 10 May 2024 20:17:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 25045386F802 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 25045386F802 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715372236; cv=none; b=ZMahO/AP54A6wFcQQMaiKAaj8GJ/a0YHH1GPQTOcgqv0/f94H3vfUQP/9Kehafa0JePRb6+S8UK7ADeSXFe/8PigEyssaeUZzBKSBljX9Dyn+o78YuOBpbyB+52ADB7ca3sDpVfSB8FWzCCrLQQjJbtWUJzer7rRB/q5i5AnMRY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715372236; c=relaxed/simple; bh=m70YYVCtl1h7kh3Qo0VKpSemVPDY+9H2lWOTGpS96aA=; h=DKIM-Signature:Message-ID:Subject:From:To:Date:MIME-Version; b=tc+sYe4F8/HA4xrHDHvTJg2ib9goObtt+xlUl06pP+0jfpQa7gh3e5JAO3T/hwdSQYAEQjlT1/0Wxvh5koxFJcNYSgo0XyBMQoMI+56D/vCTZohGmJFkgK2lOU5+6PwEPHk0f33TuslBqd8KpzChwUiB477GlVbLWCvxYZRfSgo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715372234; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dyPHTrsRu/w4HYKKhUi0ryNKXwoJc42xd/gazdbkUbU=; b=H6/7fGtbP1TH91+uinN0mi4DUb7d++s4ffy69H3VNgFMJVrnNUgQrOePqvzMRS1pOxgmMW TTKOjdypw50js24uNj35+tqkYhbGrl7ey+PpQUmohKRtxTuUwwmrOpDC0R4KDg4+/gAC3n Z0paOiyvhz9Y8fuAVbLYuFp2XWOtmMs= Received: from mail-vk1-f199.google.com (mail-vk1-f199.google.com [209.85.221.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-270-SrN5zubKPS2SZwJvpgYFFw-1; Fri, 10 May 2024 16:17:13 -0400 X-MC-Unique: SrN5zubKPS2SZwJvpgYFFw-1 Received: by mail-vk1-f199.google.com with SMTP id 71dfb90a1353d-4df1af88a1eso1263257e0c.3 for ; Fri, 10 May 2024 13:17:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715372233; x=1715977033; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=dyPHTrsRu/w4HYKKhUi0ryNKXwoJc42xd/gazdbkUbU=; b=XK5q2xZp1vzwPzzhj0FAxENrFyHj96HFX91zDnW4KDpIm44aczN/LGOqhZlq+Tfb0w No8dljH6sXvb2Ea1R1TB9bXB+ieDNNLyGJ3SFjxpAdPEhrb1IYVTUQWDfWeHx/BOODUl WUaXvdde6TsA7+m+DhDiQ2BsXC1c2ea7QboB01oy+mlNMtdEyUxY4JRnX1gsJLtByUI3 IWWvB4qBr9nZQzgUZiwQ3CpagQ3NGYf+IOnSEJNR598H898WhDwKm2sUrz8iCkRJP8Sw /i++wqUIh4rIq0beqTyu6bk3hbn+XQ6vLD03FveGjgjdTsF0oNxul52U0IRz3RMaiiWU OsGg== X-Forwarded-Encrypted: i=1; AJvYcCUzHJowcwwJxFXDg799brD/nJZD6GhAOeE+sVaMNyFsAOFMbHbdKgNTKd+/W1besRokBQXNk2LRyA15R02p3E8= X-Gm-Message-State: AOJu0YyAMILBoA64z7TJl5pTCyrJnEKg2tMdnsCq/32D/OrUZzjGx0bV sdcdBDNtc8zeNT0YASzG+3vKGkBsMe9oTvqiS7B+EC+YSErEbkZpY6gdu8MVydwSO/G2FS/w5mN /af5K9wDONkukuqBXJKfT2A7E/bzNSfXomDVI2gvClb5SnaWfn9xe X-Received: by 2002:a05:6122:922:b0:4d3:39c3:717c with SMTP id 71dfb90a1353d-4df88286086mr3761808e0c.1.1715372231409; Fri, 10 May 2024 13:17:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFcGyflnVnErPhRVLVDu3AjmadH9zNRrjYHeCDO3z6ySmorjgK687z4TzQGc+3CXO7ri9cMPA== X-Received: by 2002:a05:6122:922:b0:4d3:39c3:717c with SMTP id 71dfb90a1353d-4df88286086mr3761776e0c.1.1715372231008; Fri, 10 May 2024 13:17:11 -0700 (PDT) Received: from t14s.localdomain (c-76-28-97-5.hsd1.ma.comcast.net. [76.28.97.5]) by smtp.gmail.com with ESMTPSA id af79cd13be357-792bf27fdf8sm211525085a.44.2024.05.10.13.17.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 13:17:10 -0700 (PDT) Message-ID: <7fee40c1649f53f2e2270084bfceac51f6ff7a36.camel@redhat.com> Subject: Re: Debug info on macOS From: David Malcolm To: Gerd =?ISO-8859-1?Q?M=F6llmann?= , jit@gcc.gnu.org Cc: Andrea Corallo Date: Fri, 10 May 2024 16:17:09 -0400 In-Reply-To: References: User-Agent: Evolution 3.44.4 (3.44.4-2.fc36) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,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 List-Id: On Fri, 2024-05-10 at 15:46 +0200, Gerd M=C3=B6llmann wrote: > Hi, >=20 > I'm developing Emacs using its native compilation on macOS, which is > based on libgccjit. >=20 > In this context, I'm currently failing to get .eln files (=3D .so, > .dylib, > .dll depending on the platform) with debug info. This has probably > its > roots in the special handling of DWARF under macOS, a long-winded > story > leading to dSYM bundles... >=20 > My question is: can I somehow configure libgccjit in a way that keeps > the .o file that was used to produce the resulting .dylib, like it > keeps/writes the various intermediate files that one can get? >=20 > If that's possible, my hope would be to extract the debug info from > the > .o using dsymutil and use that with the .dylib. [CCing Andrea Corallo for his Emacs expertise] I confess I've not done any compilation on macOS and am not familiar with the tools, formats and "special handling of DWARF under macOS" you mention. As I understand it, Emacs is using libgccjit to do ahead-of-time compilation, presumably compiling the optimized ELisp code to machine code as a shared library. Is Emacs using gcc_jit_context_compile_to_file with GCC_JIT_OUTPUT_KIND_DYNAMIC_LIBRARY, or is it doing something more complicated? If that's what it's doing, you might want to take a look at=C2=A0playback::context::compile in gcc/jit-playback.cc (and try stepping through it in the debugger). In particular, the playback::compile_to_file::postprocess implementation of the playback::context::postprocess vfunc is responsible for taking a .s in a tempdir and turning it into the desired output. Perhaps there's some macOS-specific special-casing needed there? You might also find it useful to look at the overview of how libgccjit's internals here: https://gcc.gnu.org/onlinedocs/jit/internals/index.html#overview-of-code-st= ructure Hope this is helpful Dave