Wind River Support Network

HomeDefectsLIN6-11060
Fixed

LIN6-11060 : wrlinux6, compile with -imacros, __FILE__ will not expand correctly

Created: Apr 1, 2016    Updated: Dec 3, 2018
Resolved Date: Jun 22, 2016
Found In Version: 6.0.0.16
Fix Version: 6.0.0.30
Severity: Standard
Applicable for: Wind River Linux 6
Component/s: Toolchain

Description

Customer use wrlinux6 RCPL 16 cav_octeon3 BSP.
Their project configured with the following options:
wrlinux-6/wrlinux/configure --enable-multilib=lib32 --enable-board=cav_octeon3 --enable-build=production --enable-kernel=standard --enable-rootfs=glibc_small --with-template=feature/initramfs,feature/build_libc --enable-jobs=16 --enable-parallel-pkgbuilds=16 --with-rcpl-version=0016

They found a bug in SDK toolchain.
if compile with -imacros, the __FILE__ macro is not be expanded correctly.

Here is a simple way to reproduce it:
---------------
# echo "int main() { return }" > foo.c
# touch foo.h
# mips64_n32_octeon3-target-linux-gnu-gcc -imacros foo.h foo.c 
<command-line>: In function ‘main’:
<command-line>:1:21: error: expected expression before ‘}’ token
----------------

With a x86 gcc, it can be correctly expanded:
------------------
xxxxx@sha-csolx1:/build/xxxxx/testapp$ echo "int main() { return }" > foo.c
xxxxx@sha-csolx1:/build/xxxxx/testapp$ touch foo.h
xxxxx@sha-csolx1:/build/xxxxx/testapp$ gcc -imacros foo.h foo.c
foo.c: In function ‘main’:
foo.c:1:21: error: expected expression before ‘}’ token
-------------------

I can reproduce this issue in my side.
And I also checked if use -imacros, the preprocessed source code is not correct, __FILE__ is expanded to command-line.

Steps to Reproduce

# echo "int main() { return }" > foo.c
# touch foo.h
# mips64_n32_octeon3-target-linux-gnu-gcc -imacros foo.h foo.c 
<command-line>: In function ‘main’:
<command-line>:1:21: error: expected expression before ‘}’ token

Other Downloads


Live chat
Online