DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 5576Is7c3405767 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 5576Is7c3405767 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=uOOjLdZp X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 77C56385B512 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1749277132; bh=+IDF3BGDgXxbWq9FOn5tvhKeCNVXKJImOBUb8zGqAIY=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=uOOjLdZpnN/s25tzcGSSLm2RQibiBpgx/ROzvuIYW25S+o/sPV1D5Ok3SSIL0FhRl 2zHq6OaOhCqD2OFpWuVAQdkwzbjF34nHRf1Mhoh5QoMgwG+xAKWE9mHs0Vt7FznX6o QtV+bEqeDIr3am/scV16dWMURamA4MlPf2AEWf/0= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A9080385841D ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A9080385841D ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1749277073; cv=none; b=iezF6XAHp3M9Jjp0AYG4chLLTfrBFZXAeERZr7CN6DWorfsOgQ9vT+L/4mE06+hl6Vnar0ZjZ//fiV96e74LYRr0sfiDSYSxwbf5aKxrdGAo/JIzpg3Asnxd5dqVBCoh5oQFsajhBlT3X0PNfeUNq5NzXnM26xHUisEemQDwYyM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1749277073; c=relaxed/simple; bh=3fKupA18gWH5Ju+jlpBmYOtOUfOLKA/wOooS4OJJ4C4=; h=DKIM-Signature:Message-Id:From:To:Subject:Date:MIME-Version; b=LAutgNLC4Tq9/pIFInyZ+1Ma/Gbav4is73/3CTAiiEUI2qX03u4eUwD1VMe44YViTHNGKyL+cqmZh6JQ5yx0oD0MsuXdRk7WaHoUJto/Qd+VlnGeTMMTSlve0kyGavGmTZSNxxSl+AIws7XGECWPHoMvJpT6rBaqLbug5dZ7C3w= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A9080385841D X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749277073; x=1749881873; h=mime-version:content-transfer-encoding:user-agent:date:subject:to :from:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=3fKupA18gWH5Ju+jlpBmYOtOUfOLKA/wOooS4OJJ4C4=; b=e238Vzvq2OqzMkhru9jlTR4Nm6KsmTun8EzHJFPtDFVk/pmtA5LUMRJw8tYWT31tVW TBcDs1yxY8A9U0lGV5CnznU4iQApTl9kjYdN9OsteSekk/KFPsGHvbtwMwu6elxdn1nN yPXniMfPbsZ4fBa919JCyG9snEuMzKq6mOBKL84FNz0+cY6vkbbWHlnYUUAAx4tbE82d rjs82eDWjelEjYxxb0NXo6gZtz+kNz9z87mCD7kM25YeVn2jv44qXjMrryrKpSzSYxsZ I2pivw4tt2hACf5iUdMS3471ixOT8sUEtWBaBSrJe14uW4hkzIrG/YW72o5+wed4PHM3 n5XQ== X-Gm-Message-State: AOJu0YwbBVP8YHgLlTxYz9cwDmrqBtzqnTIjV287qh4DUnoFyJ/BL25y i3X31SmBZUqhgYlxEe0wcK2/wTDa405ifcifLgWl5TW7kK2tnz+G0U/Y078O1w== X-Gm-Gg: ASbGncu3mcmomWG3XuYdA+SccUWpOtns7zZL0kW9XPgDRYyT5CuD7BDi9Xi17xQMPUg j0QlC11Tmh101mIUIbnUwTP9OL6Ej6e7qnpB1v2qIskcRwtyQaEBJhRDbeWztOO0pUGi6mIiRGp 3xzOd5SQsOUXdpqunC6PzW6AB4OFfeRjASDg/u457G7kV6++Z0b1n4WIRExoTl5GELNmC2kbypn q+ejkLtpdErsea1ivopvOJD7GfclODmtv3nPdgrsie8kcMeCeZqcUpJO7pyH8vaSpjWQjoFxLfB TQ73Nj5bdu3izlnUa4b4DrHpadp9RP+fAwGQ0KCP0oK5xh9RAiPwtUsqNU7xz1v0RDsVDkcyX1q 2vg== X-Google-Smtp-Source: AGHT+IFxWGhSrXc3R/36XRj1dDJUrD/e/0vX2pmJ9Yhl7sHlVJMi6YCJqasD4uk8ZlvdxSEdIk75qw== X-Received: by 2002:a05:6a00:1815:b0:740:67aa:94ab with SMTP id d2e1a72fcca58-74827cfce72mr9367382b3a.0.1749277072616; Fri, 06 Jun 2025 23:17:52 -0700 (PDT) Message-Id: <1749211000852.785937412.3467708457@ezweb.ne.jp> To: cygwin AT cygwin DOT com Subject: PE format conformance issues in rebase.exe results incompatibility with LLVM-lld Date: Sat, 07 Jun 2025 06:17:48 +0000 X-Mailer: Vivaldi Mail User-Agent: Vivaldi Mail/7.4.3684.38 MIME-Version: 1.0 X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 List-Id: General Cygwin discussions and problem reports List-Archive: List-Post: List-Help: List-Subscribe: , From: kikairoya via Cygwin Reply-To: kikairoya Content-Type: text/plain; charset="utf-8" Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 5576Is7c3405767 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. 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