Re: [PATCH v5 3/7] Change the symbols order when --ffunction-sections is enabled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



OK. Here is a simple fix to the issue.

diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S
index d317a843f7ea9..f1b86eb303404 100644
--- a/arch/sparc/kernel/vmlinux.lds.S
+++ b/arch/sparc/kernel/vmlinux.lds.S
@@ -48,6 +48,11 @@ SECTIONS
        {
                _text = .;
                HEAD_TEXT
+               ALIGN_FUNCTION();
+#ifdef CONFIG_SPARC64
+               /* Match text section symbols in head_64.S first */
+               *head_64.o(.text)
+#endif
                TEXT_TEXT
                SCHED_TEXT
                LOCK_TEXT

If this is OK, I'll send the updated patch.

-Rong

On Fri, Oct 25, 2024 at 11:14 AM Rong Xu <xur@xxxxxxxxxx> wrote:
>
> I can reproduce the build error.
>
> The reason for the error is because in CONFIG_SPARC64, the symbol
> swapper_tsb needs to have a fixed address of 0x0000000000408000.
>
> In arch/sparc/kernel/vmlinux.lds.S
>  37 #ifdef CONFIG_SPARC64
>  38 ASSERT((swapper_tsb == 0x0000000000408000), "Error: sparc64 early
> assembler too large")
>  39 #endif
>
> This symbol resides in the .text section. The patch relocates "cold"
> functions (tagged by .text.unlikely) to precede other symbols within
> the .text section. This pushes swapper_tsb to a higher memory address,
> and we have the assertion.
>
> However, this sparc code appears incompatible with the original linker
> script. The original script prioritized .text.hot symbols, placing
> them before others in the .text section. Currently, no functions are
> marked as "hot" in the source code.  If a function were marked with
> __attribute__((hot)), the build would also fail.
>
> I don't know a good solution other than adding a branch to the
> include/asm-generic/vmlinux.lds.h.
>
> @Masahiro Yamada: I'd appreciate any further suggestions you might have.
>
> Best regards,
>
> -Rong
>
> On Thu, Oct 24, 2024 at 11:47 PM kernel test robot <lkp@xxxxxxxxx> wrote:
> >
> > Hi Rong,
> >
> > kernel test robot noticed the following build errors:
> >
> > [auto build test ERROR on eb952c47d154ba2aac794b99c66c3c45eb4cc4ec]
> >
> > url:    https://github.com/intel-lab-lkp/linux/commits/Rong-Xu/Add-AutoFDO-support-for-Clang-build/20241024-064725
> > base:   eb952c47d154ba2aac794b99c66c3c45eb4cc4ec
> > patch link:    https://lore.kernel.org/r/20241023224409.201771-4-xur%40google.com
> > patch subject: [PATCH v5 3/7] Change the symbols order when --ffunction-sections is enabled
> > config: sparc-sparc64_defconfig (https://download.01.org/0day-ci/archive/20241025/202410251411.eRNArTOZ-lkp@xxxxxxxxx/config)
> > compiler: sparc64-linux-gcc (GCC) 13.3.0
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241025/202410251411.eRNArTOZ-lkp@xxxxxxxxx/reproduce)
> >
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <lkp@xxxxxxxxx>
> > | Closes: https://lore.kernel.org/oe-kbuild-all/202410251411.eRNArTOZ-lkp@xxxxxxxxx/
> >
> > All errors (new ones prefixed by >>):
> >
> > >> sparc64-linux-ld: Error: sparc64 early assembler too large
> >
> > --
> > 0-DAY CI Kernel Test Service
> > https://github.com/intel/lkp-tests/wiki





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux