<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>139</bug_id>
          
          <creation_ts>2010-07-22 07:50:22 +0000</creation_ts>
          <short_desc>Set default gcc instruction generation to TARGET_ARCH on target</short_desc>
          <delta_ts>2020-03-24 15:14:08 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>devtools / tool chain</component>
          <version>2.5</version>
          <rep_platform>All</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Low</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>Future</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Joshua Lock - Disabled">josh</reporter>
          <assigned_to name="Khem Raj">raj.khem</assigned_to>
          <cc>dl9pf</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>ross.burton</cc>
    
    <cc>sgw</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>9041</commentid>
    <comment_count>0</comment_count>
      <attachid>21</attachid>
    <who name="Joshua Lock - Disabled">josh</who>
    <bug_when>2010-07-22 07:50:22 +0000</bug_when>
    <thetext>Created attachment 21
MeeGo&apos;s patch to use Atom optimisations by default in GCC

It would be useful if the cross compiler shipped with meta-toolchain defaulted to generating instructions for the CPU type of the cross-compilation target.

Currently we export CFLAGS=&quot;-march=${BASE_PACKAGE_ARCH}&quot; in the environment set up script for meta-toolchain but there&apos;s probably a nicer way to do this.

MeeGo patches GCC to use Atom optimizations by default (see attached patch), however this tactic wouldn&apos;t work well for the multiple architectures Poky targets.

Some preliminary investigation by Richard suggests that modifying SUBTARGET32_DEFAULT_CPU could be the right approach, but more investigation is required.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>11175</commentid>
    <comment_count>1</comment_count>
    <who name="Nitin Kamble">nitin.a.kamble</who>
    <bug_when>2010-12-14 20:33:06 +0000</bug_when>
    <thetext>I will look into this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>11758</commentid>
    <comment_count>2</comment_count>
    <who name="Julie Fleischer">julie.n.fleischer</who>
    <bug_when>2011-02-14 17:37:16 +0000</bug_when>
    <thetext>Jessica may have a fix.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>21031</commentid>
    <comment_count>3</comment_count>
    <who name="Nitin Kamble">nitin.a.kamble</who>
    <bug_when>2012-05-02 22:47:01 +0000</bug_when>
    <thetext>this may be already fixed in the current code</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>21307</commentid>
    <comment_count>4</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-05-11 10:58:57 +0000</bug_when>
    <thetext>No, its not already fixed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>27457</commentid>
    <comment_count>5</comment_count>
    <who name="Radu Moisan">radu.moisan</who>
    <bug_when>2012-11-14 23:06:12 +0000</bug_when>
    <thetext>Any news about this?
Richard, Nitin can anyone of you guys give me an ideea of what the workload is for this feature? I&apos;ll go with 5 days for now so we can schedule it and update appropriate once I have handle on it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>27465</commentid>
    <comment_count>6</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-11-15 10:18:38 +0000</bug_when>
    <thetext>I think the gcc-cross-canadian problem has been solved since the environment scripts contain the relavent information and that is probably as good as we&apos;re going to get. You&apos;ll need to use those scripts since there are other key variables set there.

This bug was left open as this problem still exists for the &quot;on target&quot; gcc where if you just use &quot;gcc&quot; on the target, you will not get optimised binaries for that platform. I&apos;m adjusting the bug to reflect this. The patch Joshua attached is still relavent for this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76574</commentid>
    <comment_count>7</comment_count>
    <who name="Khem Raj">raj.khem</who>
    <bug_when>2017-09-06 13:50:16 +0000</bug_when>
    <thetext>We could configure target gcc using --with-cpu=native which should generate code for the same processor flavor that GCC itself is running on</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85435</commentid>
    <comment_count>8</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2019-10-24 15:03:07 +0000</bug_when>
    <thetext>We did start to do this for some platforms:

http://git.yoctoproject.org/cgit.cgi/poky/tree/meta/recipes-devtools/gcc/gcc-target.inc

EXTRA_OECONF_append_armv6 = &quot; --with-arch=armv6${ARMFPARCHEXT}&quot;
EXTRA_OECONF_append_armv7a = &quot; --with-arch=armv7-a${ARMFPARCHEXT}&quot;
EXTRA_OECONF_append_armv7ve = &quot; --with-arch=armv7ve${ARMFPARCHEXT}&quot;
EXTRA_OECONF_append_arc = &quot; --with-cpu=${TUNE_PKGARCH}&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85436</commentid>
    <comment_count>9</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2019-10-24 15:04:03 +0000</bug_when>
    <thetext>If native would work on the target, that would be a better alternative.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85458</commentid>
    <comment_count>10</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-10-28 15:31:34 +0000</bug_when>
    <thetext>No expert on GCC building here.  Would changing that bundle of --with-arch assignments to --with-cpu=native be sufficient?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86726</commentid>
    <comment_count>11</comment_count>
    <who name="Khem Raj">raj.khem</who>
    <bug_when>2020-03-16 21:14:10 +0000</bug_when>
    <thetext>(In reply to comment #10)
&gt; No expert on GCC building here.  Would changing that bundle of --with-arch
&gt; assignments to --with-cpu=native be sufficient?

--with-arch=native could work on x86_64 only, perhaps it should be done like what we have done with ARM ones, this, however, would mean if someone was to recompile a package natively then it won&apos;t use same options as used during cross-compile but perhaps thats acceptable compromise.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86733</commentid>
    <comment_count>12</comment_count>
    <who name="Khem Raj">raj.khem</who>
    <bug_when>2020-03-17 07:17:52 +0000</bug_when>
    <thetext>patch to add march=native for x86_64 is on ml</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86790</commentid>
    <comment_count>13</comment_count>
    <who name="Khem Raj">raj.khem</who>
    <bug_when>2020-03-24 15:14:08 +0000</bug_when>
    <thetext>I think we can close it now as the patch is in core</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>21</attachid>
            <date>2010-07-22 07:50:22 +0000</date>
            <delta_ts>2010-07-22 07:50:22 +0000</delta_ts>
            <desc>MeeGo&apos;s patch to use Atom optimisations by default in GCC</desc>
            <filename>gcc45-use-atom.patch</filename>
            <type>text/plain</type>
            <size>2785</size>
            <attacher name="Joshua Lock - Disabled">josh</attacher>
            
              <data encoding="base64">ZGlmZiAtTmF1cnAgZ2NjLTQuNS4wLW9yaWcvZ2NjL2NvbmZpZy9pMzg2L2kzODYuYyBnY2MtNC41
LjAvZ2NjL2NvbmZpZy9pMzg2L2kzODYuYw0KLS0tIGdjYy00LjUuMC1vcmlnL2djYy9jb25maWcv
aTM4Ni9pMzg2LmMJMjAxMC0wNC0yMyAwNDo0MzoyNC4wMDAwMDAwMDAgLTA0MD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