<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 22, 2016 at 12:18 PM, Mark Hatle <span dir="ltr">&lt;<a href="mailto:mark.hatle@windriver.com" target="_blank">mark.hatle@windriver.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 3/22/16 7:21 AM, Bruce Ashfield wrote:<br>
&gt;<br>
&gt;<br>
&gt; On Tue, Mar 22, 2016 at 8:12 AM, Hongxu Jia &lt;<a href="mailto:hongxu.jia@windriver.com">hongxu.jia@windriver.com</a><br>
</span><span class="">&gt; &lt;mailto:<a href="mailto:hongxu.jia@windriver.com">hongxu.jia@windriver.com</a>&gt;&gt; wrote:<br>
&gt;<br>
&gt;     Since CFLAGS CPPFLAGS CXXFLAGS has been unset, variable DEBUG_FLAGS could<br>
&gt;     not been passed to compiler, so we explicitly add DEBUG_FLAGS to CC to<br>
&gt;     replace build path with target path.<br>
&gt;<br>
&gt;<br>
&gt; Can you be more explicit here ? What is typically contained in DEBUG_FLAGS ? The<br>
&gt; kernel builds its own compiler line and flags, so anything you are setting from this<br>
&gt; environment, should not be leaking into the kernel build.<br>
&gt;<br>
&gt; .. which leaves me wondering, what exactly is in DEBUG_FLAGS, and how is it<br>
&gt; actually fixing the QA issue ?<br>
<br>
</span>The specific debug flag in question is being added to remap the on-disk path to<br>
the path we want the items to look like from a debugging point of view.<br>
<br>
The typical format of DEBUG_FLAGS is something like:<br>
<br>
DEBUG_FLAGS ?= &quot;-g -feliminate-unused-debug-types&quot;<br>
<br>
This was recently updated to include the remapping:<br>
<br>
 DEBUG_FLAGS ?= &quot;-g -feliminate-unused-debug-types \<br>
                 -fdebug-prefix-map=${WORKDIR}=/usr/src/debug \<br>
                 -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \<br>
                 -fdebug-prefix-map=${STAGING_DIR_HOST}= \<br>
<br>
The idea is the WORKDIR is replaced with &#39;/usr/src/debug&#39; inside of the binary<br>
and any debug symbol references.  This makes it much easier for the system to<br>
work with supplied debug sources/symbols.<br>
<br>
I&#39;m not sure you want to use DEBUG_FLAGS since anything can be put in there....<br>
<br>
Application space code should always use the DEBUG_FLAGS, or I think it&#39;s likely<br>
a bug.<br>
<br>
The kernel though should probably define it&#39;s own flag(s).  Most likely you&#39;ll<br>
want something simple like:<br>
<br>
-fdebug-prefix-map=${WORKDIR}=/usr/src/debug<br></blockquote><div><br><br></div><div>I can see that.<br><br></div><div>What outputs of the kernel build need this remapping ? The userspace parts ?<br></div><div>Something else ?<br><br></div><div>The point is that we patch the kernel build, or make a specific Kconfig option, or<br></div><div>something similar to that, versus leaking our build flags into the kernel build or<br></div><div>&quot;bad things can happen&quot;.<br><br></div><div>So I&#39;m sure the solution in the build is the same, but passing flags via a general<br></div><div>mechanism like I saw in the patch is generally not a good idea.<br><br></div><div>Bruce<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Then all of the internal references to WORKDIR will be replaced with<br>
&#39;/usr/src/debug&#39; which cross gdb can &#39;map&#39; or on-target will actually look in<br>
that location.  (A corresponding &#39;-dbg&#39; package should be provided with the<br>
matching compilation sources at the local specified.)<br>
<br>
--Mark<br>
<span class=""><br>
&gt; Bruce<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;     [YOCTO #7058]<br>
&gt;<br>
&gt;     Signed-off-by: Hongxu Jia &lt;<a href="mailto:hongxu.jia@windriver.com">hongxu.jia@windriver.com</a><br>
</span>&gt;     &lt;mailto:<a href="mailto:hongxu.jia@windriver.com">hongxu.jia@windriver.com</a>&gt;&gt;<br>
<div><div class="h5">&gt;     ---<br>
&gt;      meta/classes/kernel.bbclass | 4 ++--<br>
&gt;      1 file changed, 2 insertions(+), 2 deletions(-)<br>
&gt;<br>
&gt;     diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass<br>
&gt;     index c3eab50..d357ccf 100644<br>
&gt;     --- a/meta/classes/kernel.bbclass<br>
&gt;     +++ b/meta/classes/kernel.bbclass<br>
&gt;     @@ -207,7 +207,7 @@ kernel_do_compile() {<br>
&gt;                     copy_initramfs<br>
&gt;<br>
&gt;     use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio<br>
&gt;             fi<br>
&gt;     -       oe_runmake ${KERNEL_IMAGETYPE_FOR_MAKE} ${KERNEL_ALT_IMAGETYPE}<br>
&gt;     CC=&quot;${KERNEL_CC}&quot; LD=&quot;${KERNEL_LD}&quot; ${KERNEL_EXTRA_ARGS} $use_alternate_initrd<br>
&gt;     +       oe_runmake ${KERNEL_IMAGETYPE_FOR_MAKE} ${KERNEL_ALT_IMAGETYPE}<br>
&gt;     CC=&quot;${KERNEL_CC} ${DEBUG_FLAGS}&quot; LD=&quot;${KERNEL_LD}&quot; ${KERNEL_EXTRA_ARGS}<br>
&gt;     $use_alternate_initrd<br>
&gt;             if test &quot;${KERNEL_IMAGETYPE_FOR_MAKE}.gz&quot; = &quot;${KERNEL_IMAGETYPE}&quot;; then<br>
&gt;                     gzip -9c &lt; &quot;${KERNEL_IMAGETYPE_FOR_MAKE}&quot; &gt; &quot;${KERNEL_OUTPUT}&quot;<br>
&gt;             fi<br>
&gt;     @@ -216,7 +216,7 @@ kernel_do_compile() {<br>
&gt;      do_compile_kernelmodules() {<br>
&gt;             unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE<br>
&gt;             if (grep -q -i -e &#39;^CONFIG_MODULES=y$&#39; ${B}/.config); then<br>
&gt;     -               oe_runmake -C ${B} ${PARALLEL_MAKE} modules<br>
&gt;     CC=&quot;${KERNEL_CC}&quot; LD=&quot;${KERNEL_LD}&quot; ${KERNEL_EXTRA_ARGS}<br>
&gt;     +               oe_runmake -C ${B} ${PARALLEL_MAKE} modules CC=&quot;${KERNEL_CC}<br>
&gt;     ${DEBUG_FLAGS}&quot; LD=&quot;${KERNEL_LD}&quot; ${KERNEL_EXTRA_ARGS}<br>
&gt;<br>
&gt;                     # Module.symvers gets updated during the<br>
&gt;                     # building of the kernel modules. We need to<br>
&gt;     --<br>
&gt;     1.9.1<br>
&gt;<br>
&gt;     --<br>
&gt;     _______________________________________________<br>
&gt;     Openembedded-core mailing list<br>
&gt;     <a href="mailto:Openembedded-core@lists.openembedded.org">Openembedded-core@lists.openembedded.org</a><br>
</div></div>&gt;     &lt;mailto:<a href="mailto:Openembedded-core@lists.openembedded.org">Openembedded-core@lists.openembedded.org</a>&gt;<br>
<div class="HOEnZb"><div class="h5">&gt;     <a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core" rel="noreferrer" target="_blank">http://lists.openembedded.org/mailman/listinfo/openembedded-core</a><br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; &quot;Thou shalt not follow the NULL pointer, for chaos and madness await thee at its<br>
&gt; end&quot;<br>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">&quot;Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end&quot;</div>
</div></div>