[lttng-dev] with -Og option, lttng-ust compile failed on 32bit arm

Changqing Li changqing.li at windriver.com
Wed Sep 29 23:47:33 EDT 2021


The problem happened after upgrade to lttng-ust 2.13.0.  2.12.0 don't 
have this issue.

liburcu version: 0.13.0

gcc: 11.2.0

This is my reproduce steps, it is cross compile enviroment based on 
yocto project.

 1. git clone git://git.yoctoproject.org/poky
 2. . oe-init-build-env
 3. echo "MACHINE='qemuarm'" >> conf/local.conf
 4. echo "DEBUG_BUILD='1'" >> conf/local.conf
 5. bitbake lttng-ust

compile failed with error:

../../../src/lib/lttng-ust/.libs/liblttng-ust.so: undefined reference to 
| collect2: error: ld returned 1 exit status
| Makefile:399: recipe for target 'test_ust_error' failed

checked with "nm ../../../src/lib/lttng-ust/.libs/liblttng-ust.so" | 
grep atomic, we can see 'U _uatomic_link_error',  but since -Og

is used,  liburcu don't define this function.

#if !defined __OPTIMIZE__  || defined UATOMIC_NO_LINK_ERROR
static inline __attribute__((always_inline, noreturn))
void _uatomic_link_error(void)
          * generate an illegal instruction. Cannot catch this with
          * linker tricks when optimizations are disabled.
         __asm__ __volatile__(ILLEGAL_INSTR);
#else /* #if !defined __OPTIMIZE__  || defined UATOMIC_NO_LINK_ERROR */
extern void _uatomic_link_error(void);
#endif /* #else #if !defined __OPTIMIZE__  || defined 


we cannot see 'U _uatomic_link_error' in following conditions, so 
compile successed:

1.  without -Og(using -O2),  + 32bit arm

2. -Og + 64bit arm

3. -Og + x86/x86-64

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.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.lttng.org/pipermail/lttng-dev/attachments/20210930/72a225c2/attachment.htm>

More information about the lttng-dev mailing list