<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">On 9/30/21 9:14 PM, Mathieu Desnoyers
wrote:<br>
</div>
<blockquote type="cite" cite="mid:613136200.45770.1633007697070.JavaMail.zimbra@efficios.com">
<div style="border:solid #9C6500 1.0pt;padding:2.0pt 2.0pt 2.0pt
2.0pt">
<p class="MsoNormal" style="line-height:12.0pt;background:#FFEB9C"><b><span style="font-size:10.0pt;color:#9C6500"></span></b><span style="font-size:10.0pt;color:red">[Please note: This e-mail
is from an EXTERNAL e-mail address]<o:p></o:p></span></p>
</div>
<div>
<div style="font-family: arial, helvetica, sans-serif;
font-size: 12pt; color: #000000">
<div><span id="zwchr" data-marker="__DIVIDER__">----- On Sep
29, 2021, at 11:47 PM, lttng-dev
<a class="moz-txt-link-rfc2396E" href="mailto:lttng-dev@lists.lttng.org"><lttng-dev@lists.lttng.org></a> wrote:<br>
</span></div>
<div data-marker="__QUOTED_TEXT__">
<blockquote style="border-left:2px solid
#1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;">
<p>Hi, <br>
</p>
<p>The problem happened after upgrade to lttng-ust
2.13.0. 2.12.0 don't have this issue.</p>
<p>liburcu version: 0.13.0</p>
<p>gcc: 11.2.0<br>
<br>
</p>
<p>This is my reproduce steps, it is cross compile
enviroment based on yocto project.<br>
</p>
<ol>
<li>git clone git://git.yoctoproject.org/poky</li>
<li>. oe-init-build-env</li>
<li>echo "MACHINE='qemuarm'" >> conf/local.conf</li>
<li>echo "DEBUG_BUILD='1'" >> conf/local.conf <br>
</li>
<li>bitbake lttng-ust</li>
</ol>
<p>compile failed with error:</p>
<p>|
/work/cortexa15t2hf-neon-poky-linux-gnueabi/lttng-ust/2_2.13.0-r0/recipe-sysroot-native/usr/bin/arm-poky-linux-gnueabi/../../libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.2.0/ld:
../../../src/lib/lttng-ust/.libs/<a href="https://urldefense.com/v3/__http://liblttng-ust.so__;!!AjveYdw8EvQ!LLTouw-mBEBAY8hObF75ydNA3D3KMc0Hla12A4D4cQ-hm-F5lidnggb4zDVbAwolB77-gw$" moz-do-not-send="true">liblttng-ust.so</a>: undefined
reference to `_uatomic_link_error'<br>
| collect2: error: ld returned 1 exit status<br>
| Makefile:399: recipe for target 'test_ust_error'
failed</p>
<p>checked with "nm ../../../src/lib/lttng-ust/.libs/<a href="https://urldefense.com/v3/__http://liblttng-ust.so__;!!AjveYdw8EvQ!LLTouw-mBEBAY8hObF75ydNA3D3KMc0Hla12A4D4cQ-hm-F5lidnggb4zDVbAwolB77-gw$" moz-do-not-send="true">liblttng-ust.so</a>" | grep
atomic, we can see 'U _uatomic_link_error', but since
-Og <br>
</p>
<p>is used, liburcu don't define this function.</p>
<p>[snip]<br>
#if !defined __OPTIMIZE__ || defined
UATOMIC_NO_LINK_ERROR<br>
static inline __attribute__((always_inline, noreturn))<br>
void _uatomic_link_error(void)<br>
{<br>
#ifdef ILLEGAL_INSTR<br>
/*<br>
* generate an illegal instruction. Cannot catch
this with<br>
* linker tricks when optimizations are
disabled.<br>
*/<br>
__asm__ __volatile__(ILLEGAL_INSTR);<br>
#else<br>
__builtin_trap();<br>
#endif<br>
}<br>
#else /* #if !defined __OPTIMIZE__ || defined
UATOMIC_NO_LINK_ERROR */<br>
extern void _uatomic_link_error(void);<br>
#endif /* #else #if !defined __OPTIMIZE__ || defined
UATOMIC_NO_LINK_ERROR */<br>
</p>
<p>[snip]<br>
</p>
<p>we cannot see 'U _uatomic_link_error' in following
conditions, so compile successed:</p>
<p>1. without -Og(using -O2), + 32bit arm</p>
<p>2. -Og + 64bit arm</p>
<p>3. -Og + x86/x86-64</p>
<p><br>
</p>
<p>Do you have any idea about how to fix this? I don't
understand why only "-Og + 32bit arm" will call function
_uatomic_link_error.</p>
</blockquote>
<div><br>
</div>
<div>I suspect it depends on which optimizations are being
enabled at -Og on each architecture.<br data-mce-bogus="1">
</div>
<div>The "_uatomic_link_error()" trick indeed depends on the
compiler optimizing away<br data-mce-bogus="1">
</div>
<div>unreachable calls.<br data-mce-bogus="1">
</div>
<div><br data-mce-bogus="1">
</div>
<div>If you really intend on using "-Og" on arm32, trying
building with "-DUATOMIC_NO_LINK_ERROR".<br data-mce-bogus="1">
</div>
<div>It should take care of making sure to generate an
illegal instruction rather than rely on the linker<br data-mce-bogus="1">
</div>
<div>error.<br data-mce-bogus="1">
</div>
<div><br data-mce-bogus="1">
</div>
<div>Thanks,<br data-mce-bogus="1">
</div>
<div><br data-mce-bogus="1">
</div>
<div>Mathieu<br data-mce-bogus="1">
</div>
</div>
</div>
</div>
</blockquote>
<p>Thanks. I have tried with "-DUATOMIC_NO_LINK_ERROR". With
this, it can compile successfully.</p>
<p>Changqing<br>
</p>
<blockquote type="cite" cite="mid:613136200.45770.1633007697070.JavaMail.zimbra@efficios.com">
<div>
<div style="font-family: arial, helvetica, sans-serif;
font-size: 12pt; color: #000000">
<div data-marker="__QUOTED_TEXT__">
<div>
</div>
<div><br data-mce-bogus="1">
</div>
<blockquote style="border-left:2px solid
#1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;">
<p>Thanks</p>
<p>//Changqing<br>
</p>
<br>
_______________________________________________<br>
lttng-dev mailing list<br>
<a class="moz-txt-link-abbreviated" href="mailto:lttng-dev@lists.lttng.org">lttng-dev@lists.lttng.org</a><br>
<a href="https://urldefense.com/v3/__https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev__;!!AjveYdw8EvQ!LLTouw-mBEBAY8hObF75ydNA3D3KMc0Hla12A4D4cQ-hm-F5lidnggb4zDVbAwqteQD9FQ$" moz-do-not-send="true">https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev</a><br>
</blockquote>
</div>
<div><br>
</div>
<div data-marker="__SIG_POST__">-- <br>
</div>
<div>Mathieu Desnoyers<br>
EfficiOS Inc.<br>
<a href="https://urldefense.com/v3/__http://www.efficios.com__;!!AjveYdw8EvQ!LLTouw-mBEBAY8hObF75ydNA3D3KMc0Hla12A4D4cQ-hm-F5lidnggb4zDVbAwo9O85jiQ$" moz-do-not-send="true">http://www.efficios.com</a></div>
</div>
</div>
</blockquote>
</body>
</html>