www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2025/07/17/20:38:01

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 56I0c0kT1751477
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 56I0c0kT1751477
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=nUNX54gD
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EED6C385F01C
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1752799079;
bh=pKK80x8Afxj00OS7dTQZS89LvlKGPkmtGxrMFNtpsKk=;
h=Date:To:cc:Subject:In-Reply-To:References:List-Id:
List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:
From:Reply-To:From;
b=nUNX54gDJkDWncGwQSOnyMZlfiLcN5AG9UJOh3hMyy67vFRocthLFiyoCDpTFn3Xb
6LvVNMjx+TuM0OWMnLggK5YD+JYztKCU8f/QVZBHQ+fKCij1qXiQBna+zm+cJiPyk+
weJDSTfnwZh29L6MhENqpiOcl9RQH0AK0rst3Nx0=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 283183853834
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 283183853834
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1752798991; cv=none;
b=kRI7mvaFbqpERLdNWZMBIjn4mX7SwTxIu4QW8nNV//vmw6FKcPsDLTvXK2/H8uVUNYUywKKQE1P/Uxu64mUnR0OF4I/NPkKrdlQS26ojXu7oE4AH+ccp0n31f+KaCd3qsFWkz2k22ItKTAqi2nMrSHDvUITXS0+Khh1Uc2b14PA=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1752798991; c=relaxed/simple;
bh=r2+aiy/1fhGYsvmKe5UAzryy7UtMsVorkrMrW7WygRU=;
h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version;
b=dxsSmDkzbkor+BNY8PeSHb8brinMG7BesxU/joM2obNiQO+T/sKCIDSOCCekSQpJgQVBXtiIlcqZ/4UF2rw/QFoPMSiV6ZU8RPSoRmDoHFUWvk/UAODxEZalH9ZFyJFr8tuNp6yXA+SjYcQyrgyo0K3pyVpc4gJh4anRB5eSRVw=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 283183853834
Date: Thu, 17 Jul 2025 17:36:30 -0700 (PDT)
X-X-Sender: jeremyd AT resin DOT csoft DOT net
To: kikairoya <kikairoya AT gmail DOT com>
cc: cygwin AT cygwin DOT com
Subject: Re: PE format conformance issues in rebase.exe results incompatibility
with LLVM-lld
In-Reply-To: <1749211000852.785937412.3467708457@ezweb.ne.jp>
Message-ID: <4c738bdf-be6e-38b6-897f-85b2e214636b@jdrake.com>
References: <1749211000852 DOT 785937412 DOT 3467708457 AT ezweb DOT ne DOT jp>
MIME-Version: 1.0
X-Content-Filtered-By: Mailman/MimeDel 2.1.30
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Jeremy Drake via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Jeremy Drake <cygwin AT jdrake DOT com>
Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 56I0c0kT1751477

On Sat, 7 Jun 2025, kikairoya via Cygwin wrote:

> Dear Cygwin team,
>
> I’ve found that rebase.exe makes certain assumptions that do not conform
> to the PE specification.
>
> 1. Incorrect handling of COFF File Header position
> When checking the 'Characteristics' field in the COFF File Header,
> rebase.exe assumes this field is always at a fixed offset. However, the
> PE specification states that the COFF File Header is located immediately
> after the PE signature in the image file.
>
> https://cygwin.com/cgit/cygwin-apps/rebase/tree/rebase.c#n1739
> At this point, the code should perform a relative seek of 18 bytes, not
> an absolute seek with SEEK_SET.
>
> This causes incompatibility with DLLs linked using LLVM's lld, which
> uses a PE stub of a different size. As a result, such DLLs cannot be
> rebased.
>
>
> 2. Limiting file size too conservatively
> https://cygwin.com/cgit/cygwin-apps/rebase/tree/pechecksum.c#n81
>
> Here, the image size is limited to 1 GiB, while the PE specification
> allows for up to 2 GiB.  Large DLLs with debug information (e.g.,
> `cygLLVM*.dll`, `cygclang-cpp*.dll`, etc.) can easily exceed the 1 GiB
> limit.
>
>
> I hope these issues can be addressed to improve compatibility with
> LLVM-based toolchains and enhance the robustness of development
> workflows.


Would you like to make a patch for these?  There may be another issue
because peflags says "checksum update failed" on a small lld-created exe
even when not modifying the binary.

>
> Regards,
>
> --
> Tomohiro Kashiwada (@kikairoya)
>

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019