• Michael Ellerman's avatar
    powerpc/64s: Fix section mismatch warnings from boot code · 6eeb9b3b
    Michael Ellerman authored
    We currently have two section mismatch warnings:
    
      The function __boot_from_prom() references
      the function __init prom_init().
    
      The function start_here_common() references
      the function __init start_kernel().
    
    The warnings are correct, we do have branches from non-init code into
    init code, which is freed after boot. But we don't expect to ever
    execute any of that early boot code after boot, if we did that would
    be a bug. In particular calling into OF after boot would be fatal
    because OF is no longer resident.
    
    So for now fix the warnings by marking the relevant functions as
    __REF, which puts them in the ".ref.text" section.
    
    This causes some reordering of the functions in the final link:
    
      @@ -217,10 +217,9 @@
       c00000000000b088 t generic_secondary_common_init
       c00000000000b124 t __mmu_off
       c00000000000b14c t __start_initialization_multiplatform
      -c00000000000b1ac t __boot_from_prom
      -c00000000000b1ec t __after_prom_start
      -c00000000000b260 t p_end
      -c00000000000b27c T copy_and_flush
      +c00000000000b1ac t __after_prom_start
      +c00000000000b220 t p_end
      +c00000000000b23c T copy_and_flush
       c00000000000b300 T __secondary_start
       c00000000000b300 t copy_to_here
       c00000000000b344 t start_secondary_prolog
      @@ -228,8 +227,9 @@
       c00000000000b36c t enable_64b_mode
       c00000000000b388 T relative_toc
       c00000000000b3a8 t p_toc
      -c00000000000b3b0 t start_here_common
      -c00000000000b3d0 t start_here_multiplatform
      +c00000000000b3b0 t __boot_from_prom
      +c00000000000b3f0 t start_here_multiplatform
      +c00000000000b480 t start_here_common
       c00000000000b880 T system_call_common
       c00000000000b974 t system_call
       c00000000000b9dc t system_call_exit
    
    In particular __boot_from_prom moves after copy_to_here, which means
    it's not copied to zero in the first stage of copy of the kernel to
    zero.
    
    But that's OK, because we only call __boot_from_prom before we do the
    copy, so it makes no difference when it's copied. The call sequence
    is:
      __start
      -> __start_initialization_multiplatform
         -> __boot_from_prom
            -> __start
               -> __start_initialization_multiplatform
                  -> __after_prom_start
                     -> copy_and_flush
                     -> copy_and_flush (relocated to 0)
                        -> start_here_multiplatform
                           -> early_setup
    Reported-by: default avatarMauricio Faria de Oliveira <mauricfo@linux.ibm.com>
    Reported-by: default avatarRoman Bolshakov <r.bolshakov@yadro.com>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20200225031328.14676-1-mpe@ellerman.id.au
    6eeb9b3b
head_64.S 25.3 KB