Re: error when compiling dts preprocessed with -g3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Fri, Aug 14, 2020 at 08:13:22PM +0200, Adrian Fiergolski wrote:
> Hi,
> 
> I am using yocto to build my custom distribution targetting arm64 on
> Ubuntu 18.04.4.
> 
> I have an issue compiling dts which was preprocessed with gcc version
> 7.5.0 (I haven't tried other version) and '-g3' flag. The error message:

Huh.  It's surprising to me that -g options affect the preprocessor
behavior at all.

>     ./scripts/dtc/dtc -O dtb -o
>     arch/arm64/boot/dts/xilinx/zynqmp-falcon.dtb -b 0
>     -i/home/afiergol/fastree/falcon/poky/build/tmp/work-shared/falcon-zynqmp/kernel-source/arch/arm64/boot/dts/xilinx/
>     -i/home/afiergol/fastree/falcon/poky/build/tmp/work-shared/falcon-zynqmp/kernel-source/scripts/dtc/include-prefixes
>     -Wno-unit_address_vs_reg -Wno-unit_address_format
>     -Wno-avoid_unnecessary_addr_size -Wno-alias_paths
>     -Wno-graph_child_address -Wno-simple_bus_reg
>     -Wno-unique_unit_address -Wno-pci_device_reg  -d
>     arch/arm64/boot/dts/xilinx/.zynqmp-falcon.dtb.d.dtc.tmp
>     arch/arm64/boot/dts/xilinx/.zynqmp-falcon.dtb.dts.tmp
> 
>     Error: <built-in>:1.1-2 syntax error
>     FATAL ERROR: Unable to parse input tree
> 
> The part of a preprocessed dts causing issue:
> 
>     # 1
>     "/home/afiergol/fastree/falcon/poky/build/tmp/work-shared/falcon-zynqmp/kernel-source/arch/arm64/boot/dts/xilinx/zynqmp-falcon.dts"
>     # 1
>     "/home/afiergol/fastree/falcon/poky/build/tmp/work/falcon_zynqmp-poky-linux/linux-xlnx/5.4+gitAUTOINC+22b71b4162-r0/linux-falcon_zynqmp-standard-build//"
>     # 1 "<built-in>"
>     #define __STDC__ 1

If it's preprocessed already, why does it still have #defines?

This is the cause of the problem - the dtc lexer can hande the lines
in the preprocessor output with file/linue number information, but it
doesn't expect there to be remaining preprocessor directives.

>     #define __ASSEMBLER__ 1
>     #define __STDC_HOSTED__ 1
>     # 1 "<command-line>"
>     #define __DTS__ 1
>     # 1
>     "/home/afiergol/fastree/falcon/poky/build/tmp/work-shared/falcon-zynqmp/kernel-source/arch/arm64/boot/dts/xilinx/zynqmp-falcon.dts"
>     # 11
>     "/home/afiergol/fastree/falcon/poky/build/tmp/work-shared/falcon-zynqmp/kernel-source/arch/arm64/boot/dts/xilinx/zynqmp-falcon.dts"
>     /dts-v1/;
> 
>     # 1
>     "/home/afiergol/fastree/falcon/poky/build/tmp/work-shared/falcon-zynqmp/kernel-source/arch/arm64/boot/dts/xilinx/zynqmp.dtsi"
>     1
>     # 15
>     "/home/afiergol/fastree/falcon/poky/build/tmp/work-shared/falcon-zynqmp/kernel-source/arch/arm64/boot/dts/xilinx/zynqmp.dtsi"
>     # 1
>     "/home/afiergol/fastree/falcon/poky/build/tmp/work-shared/falcon-zynqmp/kernel-source/scripts/dtc/include-prefixes/dt-bindings/power/xlnx-zynqmp-power.h"
>     1
> 
> The full command preprocessing dts:
> 
>     gcc -O0 -g3 -fno-omit-frame-pointer
>     -L/home/afiergol/fastree/falcon/poky/build/tmp/work/falcon_zynqmp-poky-linux/linux-xlnx/5.4+gitAUTOINC+22b71b4162-r0/recipe-sysroot-native/usr/lib
>     -L/home/afiergol/fastree/falcon/poky/build/tmp/work/falcon_zynqmp-poky-linux/linux-xlnx/5.4+gitAUTOINC+22b71b4162-r0/recipe-sysroot-native/lib
>     -Wl,--enable-new-dtags
>     -Wl,-rpath-link,/home/afiergol/fastree/falcon/poky/build/tmp/work/falcon_zynqmp-poky-linux/linux-xlnx/5.4+gitAUTOINC+22b71b4162-r0/recipe-sysroot-native/usr/lib
>     -Wl,-rpath-link,/home/afiergol/fastree/falcon/poky/build/tmp/work/falcon_zynqmp-poky-linux/linux-xlnx/5.4+gitAUTOINC+22b71b4162-r0/recipe-sysroot-native/lib
>     -Wl,-rpath,/home/afiergol/fastree/falcon/poky/build/tmp/work/falcon_zynqmp-poky-linux/linux-xlnx/5.4+gitAUTOINC+22b71b4162-r0/recipe-sysroot-native/usr/lib
>     -Wl,-rpath,/home/afiergol/fastree/falcon/poky/build/tmp/work/falcon_zynqmp-poky-linux/linux-xlnx/5.4+gitAUTOINC+22b71b4162-r0/recipe-sysroot-native/lib
>     -Wl,-O1 -Wl,--allow-shlib-undefined
>     -Wl,--dynamic-linker=/home/afiergol/fastree/falcon/poky/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2
>     -E $(dtc_cpp_flags) -x assembler-with-cpp -o
>     arch/arm64/boot/dts/xilinx/.zynqmp-falcon.dtb.dts.tmp
> 
> Once the '-g3' flag is removed, the part of the preprocessed DTS looks
> like this:
> 
>     # 1
>     "/home/afiergol/fastree/falcon/poky/build/tmp/work-shared/falcon-zynqmp/kernel-source/arch/arm64/boot/dts/xilinx/zynqmp-falcon.dts"
>     # 1 "<built-in>"
>     # 1 "<command-line>"
>     # 1
>     "/home/afiergol/fastree/falcon/poky/build/tmp/work-shared/falcon-zynqmp/kernel-source/arch/arm64/boot/dts/xilinx/zynqmp-falcon.dts"
>     # 11
>     "/home/afiergol/fastree/falcon/poky/build/tmp/work-shared/falcon-zynqmp/kernel-source/arch/arm64/boot/dts/xilinx/zynqmp-falcon.dts"
>     /dts-v1/;
> 
>     # 1
>     "/home/afiergol/fastree/falcon/poky/build/tmp/work-shared/falcon-zynqmp/kernel-source/arch/arm64/boot/dts/xilinx/zynqmp.dtsi"
>     1
>     # 15
>     "/home/afiergol/fastree/falcon/poky/build/tmp/work-shared/falcon-zynqmp/kernel-source/arch/arm64/boot/dts/xilinx/zynqmp.dtsi"
>     # 1
>     "/home/afiergol/fastree/falcon/poky/build/tmp/work-shared/falcon-zynqmp/kernel-source/scripts/dtc/include-prefixes/dt-bindings/power/xlnx-zynqmp-power.h"
>     1
>     # 16
>     "/home/afiergol/fastree/falcon/poky/build/tmp/work-shared/falcon-zynqmp/kernel-source/arch/arm64/boot/dts/xilinx/zynqmp.dtsi"
>     2
>     # 1
>     "/home/afiergol/fastree/falcon/poky/build/tmp/work-shared/falcon-zynqmp/kernel-source/scripts/dtc/include-prefixes/dt-bindings/reset/xlnx-zynqmp-resets.h"
>     1
>     # 17
>     "/home/afiergol/fastree/falcon/poky/build/tmp/work-shared/falcon-zynqmp/kernel-source/arch/arm64/boot/dts/xilinx/zynqmp.dtsi"
>     2
> 
> And the device compiler succeeds.
> 
> Is it a known behaviour?

Not to me.  I don't think I've ever tried using -g3.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux