<html><body><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 <lttng-dev@lists.lttng.org> 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/liblttng-ust.so: 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/liblttng-ust.so" | 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><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>lttng-dev@lists.lttng.org<br>https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev<br></blockquote></div><div><br></div><div data-marker="__SIG_POST__">-- <br></div><div>Mathieu Desnoyers<br>EfficiOS Inc.<br>http://www.efficios.com</div></div></body></html>