jhalfs-2639 optimization patch

Jeremy Byron rjjbyron at shaw.ca
Fri May 5 00:59:15 PDT 2006


Manuel,

Just saw earlier that you merged the optimization code into jhalfs..
Awesome.

I'm sorry I didn't have time to do it sooner, but I implemented some of
the ideas I mentioned previously and have attached a patch against
jhalfs-2639 for you to review when you get a chance.

I'm still in the process of running a test build with it, but the
generated Makefiles look as expected.

Changes:
  - optimization levels -> optimization modes to reduce confusion with
    command-line addition
  - added optimization level to command-line to mimic test level
    - 0: disabled, 1: ch6 only, 2: ch5 && ch6
  - tweaked validation to include OPTIMIZATION=2
  - moved optimization mode configurations to common/opt_config.d/<mode>
    - modes are loaded by a loop in common/opt_config
    - allows inheritance (more or less)
    - opt_config could otherwise get very big and hard to edit
      (especially if people have 9-10+ variables for each mode)
  - added ACTIVE_OPT_VARS variable to enable desired variables
    - the internal code just loops through the configurable list rather
      than naming then explicitly in the code
    - makes it easy to add others at the configuration level
      without messing with the internal code
  - moved the zlib hack out of wrt_optimize()
    - uses the inheritance method to append " -fPIC" to the default
    - users shouldn't have to edit internal code to remove a hard-coded
      option; it is really out of place in that function, IMO.
    - the hack gets uglier when more variables are used
  - disabled optimization by default (default should be as per LFS)
    - removed the '-march=pentium4' from the default so people
      can get a stripped -O3 build without changing anything
      if they have a different architecture.
    - could/(should?) possibly remove the "-s" from the default too
      since stripping is optional in the books (but didn't).  Thoughts?
  - cleaned up comments to reflect changes
  - fixed my stupidity in comments (ie: s/cat ".."/echo ".."/) ..doh.

Limitations:
  - No ?LFS optimization support still
  - No default optimization mode from command-line

Future?:
  - ditch the excessive preloaded env variables
    - change to opt_config.d/modeOne_modeTwo:
      ----
      inherits modeOne

      cflags   "-O3"
      cxxflags cflags
      ...and so on.
      ----
    - read only the appropriate mode config file from
      common/opt_config.d/ as needed by current package
    - the inheritance would then need to be handled internally
      by the code parsing the file
  - Add {C{,XX},LD}_EXTRA_FLAGS if needed.. others?

Looks like more than it is, really.  Sorry for the long read.

Regards,
Jeremy.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: jhalfs-2639-optimization.patch
URL: <http://lists.linuxfromscratch.org/pipermail/alfs-discuss/attachments/20060505/77a9d389/attachment.ksh>


More information about the alfs-discuss mailing list