From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 653FE3858D20; Tue, 18 Jul 2023 04:39:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 653FE3858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689655183; bh=g1Km7HvFDjg0EGM/sI6wgI1luHVDWzPs1aFcOx9GJS8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=OBQN+OLjcnQUCEyRob+f0InSszbH7Vqsk40X9K12Rn9ab+ngjbkftUhY5Oit0FPPi km+/yNjwcOfbcsbrLEm2nQd5yPV6RFJWEUO0kmIhRJzOWSAGQkevdudMnUHwNzY/dV eqseD0qgt4rcL3zpodNZLV3VODlwU4+IktbXvzT8= From: "wangwen at microsoft dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/110709] how to handle the initialization of global struct data for position independent executable application. Date: Tue, 18 Jul 2023 04:39:42 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 12.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: wangwen at microsoft dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110709 --- Comment #3 from wangwen at microsoft dot com --- when the global pointer variety has an initialized value which is not NULL, then the value should be an address, so the initialized value should be recalculated when dynamically loaded. Now the problem is the array member and pointer member of struct data will = be place at same section, then the loader would not know how to calculate the initialized value, because it has no idea the value is an address or is nor= mal data. it is a long story if you are interested in how the problem is brought up. I pasted the link where we are trying to solve it. https://github.com/azure-rtos/threadx/issues/230=