Re: [PATCH v1] Add TLS variable debug support for AIX [ 64-bit XCOFF files only]

Aditya Kamath <[email protected]> Mon, 3 Aug 2026 11:04:20 +0000
Newsgroups gmane.comp.gdb.patches
Message-ID <LV8PR15MB6488EA9A6761B30855C2E391D6D52@LV8PR15MB6488.namprd15.prod.outlook.com>
--_000_LV8PR15MB6488EA9A6761B30855C2E391D6D52LV8PR15MB6488namp_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi Ulrich and community members,

Thank you for your feedback.

>This doesn't look right to me.  The issue is not so much the
>"TLS model", which is mostly a matter of optimization.  The
>issue is more fundamental: thread-local variables defined in
>libraries loaded with dlopen *cannot* be accessed directly
>relative to the thread pointer, because the storage for
>those is only allocated at dlopen time and not statically
>known at compile or link time.


>Ideally, you should be able to implement full support (by
>accessing the AIX libc equivalent of the DTV).  If that is
>not possible for some reason, then you should at least
>restrict the implementation to variables guaranteed to
>work (e.g. by checking whether the objfile passsed to
>fetch_tls_load_module_address corresponds to the main
>executable or an initially loaded library).

Thanks for letting me know this. I have implemented it in two patches and s=
ent the same.


v1-0002-Add-TLS-support-for-shared-libraries-in-AIX.patch

v2-0001-Add-TLS-variable-debug-support-for-AIX-64-bit-XCO.patch

Where

v2-0001-Add-TLS-variable-debug-support-for-AIX-64-bit-XCO.patch  - Now just=
 blocks shared library thread local variable computation


v1-0002-Add-TLS-support-for-shared-libraries-in-AIX.patch - Where we comput=
e thread local variable for shared library.


Let me know what you think and kindly give me feedback for the same.


Have a nice day.


Thanks and regards,

Aditya.

--_000_LV8PR15MB6488EA9A6761B30855C2E391D6D52LV8PR15MB6488namp_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"=
>
</head>
<body>
<div style=3D"direction: ltr; font-family: &quot;&amp;quot;Aptos Light&quot=
;, &quot;Aptos&amp;quot;&quot;, Arial, Helvetica, sans-serif; font-size: 12=
pt; color: rgb(0, 0, 0);">
Hi Ulrich and community members,</div>
<div style=3D"direction: ltr; font-family: &quot;&amp;quot;Aptos Light&quot=
;, &quot;Aptos&amp;quot;&quot;, Arial, Helvetica, sans-serif; font-size: 12=
pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style=3D"direction: ltr; font-family: &quot;&amp;quot;Aptos Light&quot=
;, &quot;Aptos&amp;quot;&quot;, Arial, Helvetica, sans-serif; font-size: 12=
pt; color: rgb(0, 0, 0);">
Thank you for your feedback.<br>
<br>
&gt;This doesn't look right to me.&nbsp; The issue is not so much the<br>
&gt;&quot;TLS model&quot;, which is mostly a matter of optimization.&nbsp; =
The<br>
&gt;issue is more fundamental: thread-local variables defined in<br>
&gt;libraries loaded with dlopen *cannot* be accessed directly<br>
&gt;relative to the thread pointer, because the storage for<br>
&gt;those is only allocated at dlopen time and not statically<br>
&gt;known at compile or link time.<br>
<br>
<br>
&gt;Ideally, you should be able to implement full support (by<br>
&gt;accessing the AIX libc equivalent of the DTV).&nbsp; If that is<br>
&gt;not possible for some reason, then you should at least<br>
&gt;restrict the implementation to variables guaranteed to<br>
&gt;work (e.g. by checking whether the objfile passsed to<br>
&gt;fetch_tls_load_module_address corresponds to the main<br>
&gt;executable or an initially loaded library).<br>
</div>
<div style=3D"direction: ltr; font-family: &quot;&amp;quot;Aptos Light&quot=
;, &quot;Aptos&amp;quot;&quot;, Arial, Helvetica, sans-serif; font-size: 12=
pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style=3D"direction: ltr; font-family: &quot;&amp;quot;Aptos Light&quot=
;, &quot;Aptos&amp;quot;&quot;, Arial, Helvetica, sans-serif; font-size: 12=
pt; color: rgb(0, 0, 0);">
Thanks for letting me know this. I have implemented it in two patches and s=
ent the same.</div>
<div style=3D"direction: ltr; font-family: &quot;&amp;quot;Aptos Light&quot=
;, &quot;Aptos&amp;quot;&quot;, Arial, Helvetica, sans-serif; font-size: 12=
pt; color: rgb(0, 0, 0);">
<br>
</div>
<p style=3D"direction: ltr; line-height: normal; margin: 0px;"><span style=
=3D"font-family: &quot;&amp;quot;Aptos Light&quot;, &quot;Aptos&amp;quot;&q=
uot;, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">=
v1-0002-Add-TLS-support-for-shared-libraries-in-AIX.patch</span></p>
<p style=3D"direction: ltr; line-height: normal; margin: 0px;"><span style=
=3D"font-family: &quot;&amp;quot;Aptos Light&quot;, &quot;Aptos&amp;quot;&q=
uot;, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">=
v2-0001-Add-TLS-variable-debug-support-for-AIX-64-bit-XCO.patch&nbsp;</span=
></p>
<div style=3D"direction: ltr; font-family: &quot;&amp;quot;Aptos Light&quot=
;, &quot;Aptos&amp;quot;&quot;, Arial, Helvetica, sans-serif; font-size: 12=
pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style=3D"direction: ltr; font-family: &quot;&amp;quot;Aptos Light&quot=
;, &quot;Aptos&amp;quot;&quot;, Arial, Helvetica, sans-serif; font-size: 12=
pt; color: rgb(0, 0, 0);">
Where&nbsp;</div>
<p style=3D"direction: ltr; line-height: normal; margin: 0px;"><span style=
=3D"font-family: &quot;&amp;quot;Aptos Light&quot;, &quot;Aptos&amp;quot;&q=
uot;, Arial, Helvetica, sans-serif; font-size: 12pt;">v2-0001-Add-TLS-varia=
ble-debug-support-for-AIX-64-bit-XCO.patch &nbsp;- Now just blocks shared
 library thread local variable computation</span></p>
<p style=3D"direction: ltr; line-height: normal; margin: 0px;"><span style=
=3D"font-family: &quot;&amp;quot;Aptos Light&quot;, &quot;Aptos&amp;quot;&q=
uot;, Arial, Helvetica, sans-serif; font-size: 12pt;"><br>
</span></p>
<p style=3D"direction: ltr; margin-top: 0px; margin-bottom: 0px;"><span sty=
le=3D"font-family: &quot;&amp;quot;Aptos Light&quot;, &quot;Aptos&amp;quot;=
&quot;, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);=
">v1-0002-Add-TLS-support-for-shared-libraries-in-AIX.patch - Where
 we compute thread local variable for shared library.</span></p>
<p style=3D"direction: ltr; margin-top: 0px; margin-bottom: 0px;"><span sty=
le=3D"font-family: &quot;&amp;quot;Aptos Light&quot;, &quot;Aptos&amp;quot;=
&quot;, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);=
"><br>
</span></p>
<p style=3D"direction: ltr; margin-top: 0px; margin-bottom: 0px;"><span sty=
le=3D"font-family: &quot;&amp;quot;Aptos Light&quot;, &quot;Aptos&amp;quot;=
&quot;, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);=
">Let me know what you think and kindly give me feedback for the
 same.</span></p>
<p style=3D"direction: ltr; margin-top: 0px; margin-bottom: 0px;"><span sty=
le=3D"font-family: &quot;&amp;quot;Aptos Light&quot;, &quot;Aptos&amp;quot;=
&quot;, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);=
"><br>
</span></p>
<p style=3D"direction: ltr; margin-top: 0px; margin-bottom: 0px;"><span sty=
le=3D"font-family: &quot;&amp;quot;Aptos Light&quot;, &quot;Aptos&amp;quot;=
&quot;, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);=
">Have a nice day.</span></p>
<p style=3D"direction: ltr; margin-top: 0px; margin-bottom: 0px;"><span sty=
le=3D"font-family: &quot;&amp;quot;Aptos Light&quot;, &quot;Aptos&amp;quot;=
&quot;, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);=
"><br>
</span></p>
<p style=3D"direction: ltr; margin-top: 0px; margin-bottom: 0px;"><span sty=
le=3D"font-family: &quot;&amp;quot;Aptos Light&quot;, &quot;Aptos&amp;quot;=
&quot;, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);=
">Thanks and regards,</span></p>
<p style=3D"direction: ltr; margin-top: 0px; margin-bottom: 0px;"><span sty=
le=3D"font-family: &quot;&amp;quot;Aptos Light&quot;, &quot;Aptos&amp;quot;=
&quot;, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);=
">Aditya.</span></p>
</body>
</html>

--_000_LV8PR15MB6488EA9A6761B30855C2E391D6D52LV8PR15MB6488namp_--