Fix ASAN build error 87/201587/1 accepted/tizen/unified/20190327.160533 submit/tizen/20190327.041330
authorShinwoo Kim <cinoo.kim@samsung.com>
Mon, 18 Mar 2019 04:05:53 +0000 (13:05 +0900)
committerShinwoo Kim <cinoo.kim@samsung.com>
Mon, 18 Mar 2019 04:16:09 +0000 (13:16 +0900)
commitbab3d151b74cf649fcba20c525a3ea972d70dd5f
tree785d40c342161b5209a2a0a657eb9f94eae59873
parent2c853b9f18bb7903409c1064b454dfee3411a51f
Fix ASAN build error

There is a build error with following build option for ASAN.

$ gbs build -A armv7l --include-all
  --extra-packs asan-force-options,asan-build-env --define 'asan 1'

[Build Error]
multiple definition of `child_pid'

[How to Fix]
This occurs when –fno-common flag is added to compiler (which is default in
asan-force-options) some linking may fail with error like above.

The reason of the bug is that global is defined in more than one compilation
unit without extern or static. When using default –fcommon option global
variables with the same name are merged into the same variable without
signaling errors.

When -fno-common option is enabled all global variables are treated separately
as they supposed to be. It means that each global variable should be defined
only once. Otherwise means an error in source code and is reported at linking
stage. It must be fixed by modifying each declaration as static or merging
into an extern declaration and a definition in a single .c file.

Change-Id: If913d75c4b212f129e5535eb4f332e7721611215
tests/atk_test_util.h