1. 04 2月, 2017 1 次提交
    • A
      kbuild: modversions: add infrastructure for emitting relative CRCs · 56067812
      Ard Biesheuvel 提交于
      This add the kbuild infrastructure that will allow architectures to emit
      vmlinux symbol CRCs as 32-bit offsets to another location in the kernel
      where the actual value is stored. This works around problems with CRCs
      being mistaken for relocatable symbols on kernels that self relocate at
      runtime (i.e., powerpc with CONFIG_RELOCATABLE=y)
      
      For the kbuild side of things, this comes down to the following:
      
       - introducing a Kconfig symbol MODULE_REL_CRCS
      
       - adding a -R switch to genksyms to instruct it to emit the CRC symbols
         as references into the .rodata section
      
       - making modpost distinguish such references from absolute CRC symbols
         by the section index (SHN_ABS)
      
       - making kallsyms disregard non-absolute symbols with a __crc_ prefix
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      56067812
  2. 11 12月, 2016 1 次提交
  3. 29 11月, 2016 2 次提交
  4. 10 11月, 2016 1 次提交
  5. 01 11月, 2016 1 次提交
  6. 23 10月, 2016 1 次提交
  7. 09 9月, 2016 1 次提交
    • S
      kbuild: allow architectures to use thin archives instead of ld -r · a5967db9
      Stephen Rothwell 提交于
      ld -r is an incremental link used to create built-in.o files in build
      subdirectories. It produces relocatable object files containing all
      its input files, and these are are then pulled together and relocated
      in the final link. Aside from the bloat, this constrains the final
      link relocations, which has bitten large powerpc builds with
      unresolvable relocations in the final link.
      
      Alan Modra has recommended the kernel use thin archives for linking.
      This is an alternative and means that the linker has more information
      available to it when it links the kernel.
      
      This patch enables a config option architectures can select, which
      causes all built-in.o files to be built as thin archives. built-in.o
      files in subdirectories do not get symbol table or index attached,
      which improves speed and size. The final link pass creates a
      built-in.o archive in the root output directory which includes the
      symbol table and index. The linker then uses takes this file to link.
      
      The --whole-archive linker option is required, because the linker now
      has visibility to every individual object file, and it will otherwise
      just completely avoid including those without external references
      (consider a file with EXPORT_SYMBOL or initcall or hardware exceptions
      as its only entry points). The traditional built works "by luck" as
      built-in.o files are large enough that they're going to get external
      references. However this optimisation is unpredictable for the kernel
      (due to above external references), ineffective at culling unused, and
      costly because the .o files have to be searched for references.
      Superior alternatives for link-time culling should be used instead.
      
      Build characteristics for inclink vs thinarc, on a small powerpc64le
      pseries VM with a modest .config:
      
                                        inclink       thinarc
      sizes
      vmlinux                        15 618 680    15 625 028
      sum of all built-in.o          56 091 808     1 054 334
      sum excluding root built-in.o                   151 430
      
      find -name built-in.o | xargs rm ; time make vmlinux
      real                              22.772s       21.143s
      user                              13.280s       13.430s
      sys                                4.310s        2.750s
      
      - Final kernel pulled in only about 6K more, which shows how
        ineffective the object file culling is.
      - Build performance looks improved due to less pagecache activity.
        On IO constrained systems it could be a bigger win.
      - Build size saving is significant.
      
      Side note, the toochain understands archives, so there's some tricks,
      $ ar t built-in.o          # list all files you linked with
      $ size built-in.o          # and their sizes
      $ objdump -d built-in.o    # disassembly (unrelocated) with filenames
      
      Implementation by sfr, minor tweaks by npiggin.
      Signed-off-by: NStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: NMichal Marek <mmarek@suse.com>
      a5967db9
  8. 08 8月, 2016 1 次提交
    • A
      [kbuild] handle exports in lib-y objects reliably · 7f2084fa
      Al Viro 提交于
      Collect the symbols exported by anything that goes into lib.a and
      add an empty object (lib-exports.o) with explicit undefs for each
      of those to obj-y.
      
      That allows to relax the rules regarding the use of exports in
      lib-* objects - right now an object with export can be in lib-*
      only if we are guaranteed that there always will be users in
      built-in parts of the tree, otherwise it needs to be in obj-*.
      As the result, we have an unholy mix of lib- and obj- in lib/Makefile
      and (especially) in arch/*/lib/Makefile.  Moreover, a change in
      generic part of the kernel can lead to mysteriously missing exports
      on some configs.  With this change we don't have to worry about
      that anymore.
      
      One side effect is that built-in.o now pulls everything with exports
      from the corresponding lib.a (if such exists).  That's exactly what
      we want for linking vmlinux and fortunately it's almost the only thing
      built-in.o is used in.  arch/ia64/hp/sim/boot/bootloader is the only
      exception and it's easy to get rid of now - just turn everything in
      arch/ia64/lib into lib-* and don't bother with arch/ia64/lib/built-in.o
      anymore.
      
      [AV: stylistic fix from Michal folded in]
      Acked-by: NMichal Marek <mmarek@suse.cz>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      7f2084fa
  9. 08 6月, 2016 1 次提交
  10. 20 4月, 2016 2 次提交
  11. 30 3月, 2016 2 次提交
    • N
      kbuild: de-duplicate fixdep usage · e4aca459
      Nicolas Pitre 提交于
      The generation and postprocessing of automatic dependency rules is
      duplicated in rule_cc_o_c, rule_as_o_S and if_changed_dep. Since
      this is not a trivial one-liner action, it is now abstracted under
      cmd_and_fixdep to simplify things and make future changes in this area
      easier.
      
      In the rule_cc_o_c and rule_as_o_S cases that means the order of some
      commands has been altered, namely fixdep and related file manipulations
      are executed earlier, but they didn't depend on those commands that now
      execute later.
      Signed-off-by: NNicolas Pitre <nico@linaro.org>
      e4aca459
    • N
      kbuild: record needed exported symbols for modules · 9895c03d
      Nicolas Pitre 提交于
      Kernel modules are partially linked object files with some undefined
      symbols that are expected to be matched with EXPORT_SYMBOL() entries
      from elsewhere.
      
      Each .tmp_versions/*.mod file currently contains two line of text
      separated by a newline character. The first line has the actual module
      file name while the second line has a list of object files constituting
      that module. Those files are parsed by modpost (scripts/mod/sumversion.c),
      scripts/Makefile.modpost, scripts/Makefile.modsign, etc.  Only the
      modpost utility cares about the second line while the others retrieve
      only the first line.
      
      Therefore we can add a third line to record the list of undefined symbols
      aka required EXPORT_SYMBOL() entries for each module into that file
      without breaking anything. Like for the second line, symbols are separated
      by a blank and the list is terminated with a newline character.
      
      To avoid needless build overhead, the undefined symbols extraction is
      performed only when CONFIG_TRIM_UNUSED_KSYMS is selected.
      Signed-off-by: NNicolas Pitre <nico@linaro.org>
      Acked-by: NRusty Russell <rusty@rustcorp.com.au>
      9895c03d
  12. 05 3月, 2016 1 次提交
  13. 29 2月, 2016 1 次提交
  14. 25 11月, 2015 1 次提交
    • M
      kbuild: Allow to specify composite modules with modname-m · cf4f2193
      Michal Marek 提交于
      This allows to write
      
        drm-$(CONFIG_AGP) += drm_agpsupport.o
      
      without having to handle CONFIG_AGP=y vs. CONFIG_AGP=m. Only support
      this syntax for modules, since built-in code depending on something
      modular cannot work and init/Makefile actually relies on the current
      semantics. There are a few drivers which adapted to the current
      semantics out of necessity; these are fixed to also work when the
      respective subsystem is modular.
      
      Acked-by: Peter Chen <peter.chen@freescale.com> [chipidea]
      Signed-off-by: NMichal Marek <mmarek@suse.com>
      cf4f2193
  15. 29 1月, 2015 1 次提交
  16. 02 10月, 2014 1 次提交
  17. 19 8月, 2014 1 次提交
    • M
      kbuild: handle multi-objs dependency appropriately · c8589d1e
      Masahiro Yamada 提交于
      The comment in scripts/Makefile.build says as follows:
      
        We would rather have a list of rules like
              foo.o: $(foo-objs)
        but that's not so easy, so we rather make all composite objects depend
        on the set of all their parts
      
      This commit makes it possible!
      
      For example, assume a Makefile like this
      
        obj-m = foo.o bar.o
        foo-objs := foo1.o foo2.o
        bar-objs := bar1.o bar2.o
      
      Without this patch, foo.o depends on all of
      foo1.o foo2.o bar1.o bar2.o.
      It looks funny that foo.o is regenerated when bar1.c is updated.
      
      Now we can handle the dependency of foo.o and bar.o separately.
      Signed-off-by: NMasahiro Yamada <yamada.m@jp.panasonic.com>
      Signed-off-by: NMichal Marek <mmarek@suse.cz>
      c8589d1e
  18. 30 4月, 2014 1 次提交
  19. 17 4月, 2014 1 次提交
  20. 10 4月, 2014 1 次提交
  21. 14 2月, 2014 1 次提交
  22. 20 3月, 2013 1 次提交
    • J
      genksyms: pass symbol-prefix instead of arch · d70f82ac
      James Hogan 提交于
      Pass symbol-prefix to genksyms instead of arch, so that the decision
      what symbol prefix to use is kept in one place.
      
      Basically genksyms used to take a -a $ARCH argument and it used that to
      determine whether to add an underscore symbol prefix. It's now changed
      to take a -s $SYMBOL_PREFIX argument so that the caller decides whether
      a symbol prefix is required. The build system then uses
      CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX to determine whether to pass the
      argument.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      d70f82ac
  23. 08 10月, 2012 1 次提交
    • D
      X.509: Add simple ASN.1 grammar compiler · 4520c6a4
      David Howells 提交于
      Add a simple ASN.1 grammar compiler.  This produces a bytecode output that can
      be fed to a decoder to inform the decoder how to interpret the ASN.1 stream it
      is trying to parse.
      
      Action functions can be specified in the grammar by interpolating:
      
      	({ foo })
      
      after a type, for example:
      
      	SubjectPublicKeyInfo ::= SEQUENCE {
      		algorithm		AlgorithmIdentifier,
      		subjectPublicKey	BIT STRING ({ do_key_data })
      		}
      
      The decoder is expected to call these after matching this type and parsing the
      contents if it is a constructed type.
      
      The grammar compiler does not currently support the SET type (though it does
      support SET OF) as I can't see a good way of tracking which members have been
      encountered yet without using up extra stack space.
      
      Currently, the grammar compiler will fail if more than 256 bytes of bytecode
      would be produced or more than 256 actions have been specified as it uses
      8-bit jump values and action indices to keep space usage down.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      4520c6a4
  24. 26 1月, 2012 1 次提交
  25. 31 8月, 2011 1 次提交
  26. 19 5月, 2011 1 次提交
  27. 17 5月, 2011 3 次提交
  28. 02 5月, 2011 1 次提交
  29. 29 4月, 2011 1 次提交
  30. 28 4月, 2011 1 次提交
    • S
      kbuild: implement several W= levels · 28bc20dc
      Sam Ravnborg 提交于
      Building a kernel with "make W=1" produces far too much noise to be
      useful.
      
      Divide the warning options in three groups:
      
          W=1 - warnings that may be relevant and does not occur too often
          W=2 - warnings that occur quite often but may still be relevant
          W=3 - the more obscure warnings, can most likely be ignored
      
      When building the whole kernel, those levels produce:
      
      W=1 - 4859 warnings
      W=2 - 1394 warnings
      W=3 - 86666 warnings
      
      respectively. Warnings have been counted with Geert's script at
      
      http://www.kernel.org/pub/linux/kernel/people/geert/linux-log/linux-log-summary.pl
      
      Many warnings occur from .h files so fixing one file may have a nice
      effect on the total number of warnings.
      
      With these changes I am actually tempted to try W=1 now and then.
      Previously there was just too much noise.
      
      Borislav:
      
      - make the W= levels exclusive
      - move very noisy and making little sense for the kernel warnings to W=3
      - drop -Woverlength-strings due to useless warning message
      - copy explanatory text for the different warning levels to 'make help'
      - recount warnings per level
      Signed-off-by: NSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: NBorislav Petkov <bp@alien8.de>
      Cc: Dave Jones <davej@redhat.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: NMichal Marek <mmarek@suse.cz>
      28bc20dc
  31. 20 4月, 2011 1 次提交
  32. 18 4月, 2011 1 次提交
  33. 09 3月, 2011 1 次提交
  34. 19 11月, 2010 1 次提交
    • W
      ftrace: Speed up recordmcount · 45677454
      Wu Zhangjin 提交于
      cmd_record_mcount is used to locate the _mcount symbols in the object
      files, only the files compiled with -pg has the _mcount symbol, so, it
      is only needed for such files, but the current cmd_record_mcount is used
      for all of the object files, so, we need to fix it and speed it up.
      
      Since -pg may be removed by the method used in kernel/trace/Makefile:
      
      ORIG_CFLAGS := $(KBUILD_CFLAGS)
      KBUILD_CFLAGS = $(subst -pg,,$(ORIG_CFLAGS))
      
      Or may be removed by the method used in arch/x86/kernel/Makefile:
      
      CFLAGS_REMOVE_file.o = -pg
      
      So, we must check the last variable stores the compiling flags, that is
      c_flags(Please refer to cmd_cc_o_c and rule_cc_o_c defined in
      scripts/Makefile.build) and since the CFLAGS_REMOVE_file.o is already
      filtered in _c_flags(Please refer to scripts/Makefile.lib) and _c_flags
      has less symbols, therefore, we only need to check _c_flags.
      
      ---------------
      Changes from v1:
      
        o Don't touch Makefile for CONFIG_FTRACE_MCOUNT_RECORD is enough
        o Use _c_flags intead of KBUILD_CFLAGS to cover CONFIG_REMOVE_file.o = -pg
        (feedback from Steven Rostedt <rostedt@goodmis.org>)
      Acked-by: NMichal Marek <mmarek@suse.cz>
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      LKML-Reference: <3dc8cddf022eb7024f9f2cf857529a15bee8999a.1288196498.git.wuzhangjin@gmail.com>
      
      [ changed if [ .. == .. ] to if [ .. = .. ] to handle dash environments ]
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      45677454
  35. 19 10月, 2010 1 次提交
    • S
      ftrace: Remove recursion between recordmcount and scripts/mod/empty · d7b4d6de
      Steven Rostedt 提交于
      When DYNAMIC_FTRACE is enabled and we use the C version of recordmcount,
      all objects are run through the recordmcount program to create a
      separate section that stores all the callers of mcount.
      
      The build process has a special file: scripts/mod/empty.o. This is
      built from empty.c which is literally an empty file (except for a
      single comment). This file is used to find information about the target
      elf format, like endianness and word size.
      
      The problem comes up when we need to build recordmcount. The
      build process requires that empty.o is built first. The build rules
      for empty.o will try to execute recordmcount on the empty.o file.
      We get an error that recordmcount does not exist.
      
      To avoid this recursion, the build file will skip running recordmcount
      if the file that it is building is script/mod/empty.o.
      
      [ extra comment Suggested-by: Sam Ravnborg <sam@ravnborg.org> ]
      Reported-by: NIngo Molnar <mingo@elte.hu>
      Tested-by: NIngo Molnar <mingo@elte.hu>
      Cc: Michal Marek <mmarek@suse.cz>
      Cc: linux-kbuild@vger.kernel.org
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      d7b4d6de