From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Matt Wette Newsgroups: gmane.lisp.guile.user Subject: Re: Embedding stuff in ELF section of compiled module Date: Sat, 9 Nov 2024 10:31:17 -0800 Message-ID: References: <8734k0tp4x.fsf@laura> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34064"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sat Nov 09 19:31:55 2024 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1t9qFX-0008n6-8S for guile-user@m.gmane-mx.org; Sat, 09 Nov 2024 19:31:55 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t9qF4-0002PY-QL; Sat, 09 Nov 2024 13:31:28 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t9qF0-0002PH-IS for guile-user@gnu.org; Sat, 09 Nov 2024 13:31:23 -0500 Original-Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t9qEz-0003LI-4d for guile-user@gnu.org; Sat, 09 Nov 2024 13:31:22 -0500 Original-Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-7ea8c4ce232so2845546a12.0 for ; Sat, 09 Nov 2024 10:31:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731177079; x=1731781879; darn=gnu.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=z8u5zqObJPVFrkTRuU034AgDy9DRuBIMPQHSU305wag=; b=K7l04FF/4UGGFFhWAoOPWT+vkt+8Uld2tiW+zp8mevjbQ4m9Td8C55Df7CjM34Oh9N Y7WrggjmjLS5ytXch1qPuhKmwNXmexpS/nEWWuaLqVPsj/fWt/v/9Tn4Q0XHB4lXTanK vLA59qdjbeGrCY10zR7emE06M7dKaCQA5XuWumNRRakupvx//rHvZP6kd9J3IOUWm4Lq QldFvEUgaPjfSSRtA0FDXOLq9RUqI/+tZdsl98MObi3Inf23f1BGSgno+VkMqN3U5tf2 gysTao0f59OfVXpXHXbD71YGfoFw4K/HaKa2SXxyNMIDLsO0r08uQzTzCW92+USQt3cH f6Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731177079; x=1731781879; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=z8u5zqObJPVFrkTRuU034AgDy9DRuBIMPQHSU305wag=; b=KI1lJNmnmoVovv4wpi5NLF684Ip8lVlA8alFIgMiGsgF53mI4dMZb5T0t9zzPFqCrq 0TTaiwiO+9dOaCqD7wpe478R+yKwukHyhU+yDD/b7DdTPt8Wp/qIHzCB63pShzG3Fo1k XMRBA0kK9qIFjrLpOEntzILgoiXRKeS7ND5MeDGYgBlDcpWwJ7/QE0zVBYLjrAEut3pQ dhBuKqa4QhJuP0BERVLa0LPjOSqfCMJ5lIxf07W3txoF04WgxVy0Y6U8MwLND1mVaOG4 3Ec1RxiC8kCdimCk6/sdcnVzctjDCkL4nUjljqFIqOX9WvYQWyRseJwwiL6jqD+2Em86 5Lww== X-Gm-Message-State: AOJu0YwaJ1lJRzOxOcM8mwNkKzWpoL7eurVPx12se9lut6IDFUCzYYDc id7X3E4ss+0dfXoSgUTno/mz/YP9ox5stLR3CHxPH6v8rjAK8rfbc7coHg== X-Google-Smtp-Source: AGHT+IEVrV9+xC6KqmNV2TN2mBqzsZl9WieG5J/XvCDNJE50BRPSqzG0wVW93wtCcvGafwUgwZ7+HQ== X-Received: by 2002:a17:90b:2743:b0:2e2:d87f:3cc with SMTP id 98e67ed59e1d1-2e9b1777659mr8803237a91.23.1731177078992; Sat, 09 Nov 2024 10:31:18 -0800 (PST) Original-Received: from [192.168.2.155] (64-52-138-37.championbroadband.com. [64.52.138.37]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e99a541da0sm8537674a91.13.2024.11.09.10.31.18 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 09 Nov 2024 10:31:18 -0800 (PST) Content-Language: en-US In-Reply-To: <8734k0tp4x.fsf@laura> Received-SPF: pass client-ip=2607:f8b0:4864:20::535; envelope-from=matt.wette@gmail.com; helo=mail-pg1-x535.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:19882 Archived-At: On 11/9/24 7:15 AM, Olivier Dion wrote: > Hi, > > TLDR; Is there a way to embed a bytevector into a ELF section of a > compiled module (.go)? > > I have a case where I want to generate bytevectors that follow an ABI > for event description of static tracepoints. I would like this > bytevector to be put into a know ELF section of the compiled module so > that external tools can reference it by parsing the ELF file, > i.e. without running Guile. I personnaly don't care about none-ELF > systems, so I'm fine if this solution is Linux only. > > I guess this is similar to embedding something else like an audio/image > for a video game. > > So, is there any way for adding section to the compiled ELF, something > along like: > > (embed-bytevector ".my_section" > #vu8(bytes ...)) > > If not, I wonder if this is something that could be appreciated for > other users as well? > > Thanks, > Olivier > You could look at `objcopy' to add a section to the .go file (outside of Guile). Otherwise, dig into the code in share/guile/3.0/system/vm/elf.scm. Matt