I got a linking error while building u-boot-2016-rc2. Basically, the error message says that the linker script has a syntax error. It's very weird.
The error only happens when my board configuration file has comment lines with double slashes (e.g. //). The block comments (/* ... */) are all OK. If I use double forward slashes for commenting out macros in my board config, those lines appear at the top of the linker script. It seems the preprocessor didn't ignore double forward slash comment lines.
To around this problem, I could do the followings:
1. Remove all double forward slash comment lines in my board config file.
2. Or, I need to remove the double slashes while generating a linker script. The below is the what I did instead of replace double slashes to block comments.
Makefile snippet to around the issue
u-boot.lds: $(LDSCRIPT) prepare FORCE
$(call if_changed_dep,cpp_lds)
$(Q)sed '/^\/\// d' u-boot.lds > u-boot.lds.tmp;rm u-boot.lds;mv u-boot.lds.tmp u-boot.lds
The problem solved!