devicetree-compiler.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: Adrian Fiergolski
	<adrian.fiergolski-/A8SZzjb9pj2eFz/2MeuCQ@public.gmane.org>
Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: error when compiling dts preprocessed with -g3
Date: Thu, 20 Aug 2020 20:27:34 +1000	[thread overview]
Message-ID: <20200820102734.GR271315@yekko.fritz.box> (raw)
In-Reply-To: <f03fc1a5-14c9-5f87-84ee-0936f7e13ad2-/A8SZzjb9pj2eFz/2MeuCQ@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 6091 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2020-08-20 10:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-14 18:13 error when compiling dts preprocessed with -g3 Adrian Fiergolski
     [not found] ` <f03fc1a5-14c9-5f87-84ee-0936f7e13ad2-/A8SZzjb9pj2eFz/2MeuCQ@public.gmane.org>
2020-08-20 10:27   ` David Gibson [this message]
     [not found]     ` <20200820102734.GR271315-l+x2Y8Cxqc4e6aEkudXLsA@public.gmane.org>
2020-08-20 11:32       ` Adrian Fiergolski
     [not found]         ` <594ead88-fd44-76ac-8c63-6337ac77a032-/A8SZzjb9pj2eFz/2MeuCQ@public.gmane.org>
2021-06-08  4:18           ` David Gibson
2021-06-08 10:47             ` Adrian Fiergolski
     [not found]               ` <3f28c86d-064d-ec68-e8de-f1dcd38c08ca-/A8SZzjb9pj2eFz/2MeuCQ@public.gmane.org>
2021-10-12 13:16                 ` Adrian Fiergolski
     [not found]                   ` <f6ac309b-c3af-583e-1bce-e869fa129b3f-/A8SZzjb9pj2eFz/2MeuCQ@public.gmane.org>
2021-10-12 13:38                     ` Rob Herring
     [not found]                       ` <CAL_JsqK52nM1LwjBYJ+iEWYEipimaJ=8vA-Nw5SSJ7x+OAxGXg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-10-12 14:47                         ` Adrian Fiergolski
     [not found]                           ` <c28927c6-4fd1-f047-7c04-d54af609e699-/A8SZzjb9pj2eFz/2MeuCQ@public.gmane.org>
2021-10-12 16:50                             ` Rob Herring
     [not found]                               ` <CAL_Jsq+q-vNyUok3O7To0KCSG=hcGzHnf4k7tTr=0J3VFUSVjg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-10-14  9:39                                 ` Adrian Fiergolski
     [not found]                                   ` <84be5fc0-0199-aec5-e739-610ba6cf0409-/A8SZzjb9pj2eFz/2MeuCQ@public.gmane.org>
2021-10-14 22:00                                     ` Richard Purdie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200820102734.GR271315@yekko.fritz.box \
    --to=david-xt8fgy+axnrb3ne2bgzf6laj5h9x9tb+@public.gmane.org \
    --cc=adrian.fiergolski-/A8SZzjb9pj2eFz/2MeuCQ@public.gmane.org \
    --cc=devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).