All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Nicolas Pitre <nicolas.pitre@linaro.org>
Cc: Andi Kleen <ak@linux.intel.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>
Subject: Re: [PATCH 3/7] [HACK] x86: crypto: fix link error with LTO
Date: Fri, 2 Feb 2018 23:18:14 +0100	[thread overview]
Message-ID: <CAK8P3a2QuVy5ZO0sOGApphaK1ddK3se_zzvYOJC8ULsLMT7GBA@mail.gmail.com> (raw)
In-Reply-To: <nycvar.YSQ.7.76.1802021414270.1842@knanqh.ubzr>

On Fri, Feb 2, 2018 at 8:49 PM, Nicolas Pitre <nicolas.pitre@linaro.org> wrote:
> On Fri, 2 Feb 2018, Arnd Bergmann wrote:
>
>> crypto_it_tab and the other symbols like it are defined in
>> crypto/aes_generic.c and exported for loadable modules. When
>> building with LTO and CONFIG_TRIM_UNUSED_KSYMS, the exports
>> are eliminated, since kbuild fails to take the users in
>> the arch/x86/crypto/aes-i586-asm_32.S assembler file into
>> account.
>>
>> This adds an ugly workaround by adding a reference to each symbol
>> into aes_glue.c, which gets linked together with the assembler
>> file.
>>
>> We obviously want to fix the CONFIG_TRIM_UNUSED_KSYMS logic
>> to do the right thing here instead, but I couldn't come up
>> with a good fix, so I use this instead to get a clean build
>> for testing.
>
> Could you give me the .config you used for this? So far I can't
> reproduce, and guessing with LTO takes lots of time.

I've uploaded my randconfig file to

https://pastebin.com/raw/iLk4sSpw

>> This fix only works most of the time, but I still ran into
>> some cases where combining an .S with a .c file did not
>> produce the correct .ko file, as the lto linker apparently
>> did not expect that kind of input. 'nm' on the file after
>> 'ld -r' showed only the contents of the assembler file, and
>> after the lto-ld stage, only the contents of the .c file
>> are there.
>
> 'ld -r' does not support mixed (LTO and non-LTO) objects.

Ok, that would explain it. I checked that CONFIG_THIN_ARCHIVES
is set here, but I see clearly that the module is linked using

x86_64-linux-ld -m elf_x86_64   -r -o arch/x86/crypto/aes-x86_64.o
arch/x86/crypto/aes-x86_64-asm_64.o arch/x86/crypto/aes_glue.o ;
scripts/mod/modpost arch/x86/crypto/aes-x86_64.o

       Arnd

  reply	other threads:[~2018-02-02 22:18 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-02 16:15 [PATCH 0/7] LTO: hacks to build LTO-enabled randconfig kernels Arnd Bergmann
2018-02-02 16:15 ` Arnd Bergmann
2018-02-02 16:15 ` [PATCH 1/7] [HACK] lto: make config.gz symbol visible Arnd Bergmann
2018-02-02 16:15   ` Arnd Bergmann
2018-02-02 16:20 ` [PATCH 2/7] [HACK] x86: lto: always link in library files Arnd Bergmann
2018-02-02 16:21 ` [PATCH 3/7] [HACK] x86: crypto: fix link error with LTO Arnd Bergmann
2018-02-02 19:49   ` Nicolas Pitre
2018-02-02 22:18     ` Arnd Bergmann [this message]
2018-02-02 16:21 ` [PATCH 4/7] [HACK] lto: shut up some warnings Arnd Bergmann
2018-02-02 16:21 ` [PATCH 5/7] [HACK] avoid gcc-8 ICE on LTO Arnd Bergmann
2018-02-02 17:04   ` Joe Perches
2018-02-02 16:21 ` [PATCH 6/7] Kbuild: lto: clean build artifacts Arnd Bergmann
2018-02-02 16:21 ` [PATCH 7/7] Kbuild: lto: pass -m32/-m64 to to LDFINAL Arnd Bergmann
2018-02-02 18:41   ` Nicolas Pitre
2018-02-02 20:18     ` Arnd Bergmann
2018-02-02 20:38       ` Nicolas Pitre
2018-02-02 20:55         ` Arnd Bergmann
2018-02-02 21:17           ` Nicolas Pitre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAK8P3a2QuVy5ZO0sOGApphaK1ddK3se_zzvYOJC8ULsLMT7GBA@mail.gmail.com \
    --to=arnd@arndb.de \
    --cc=ak@linux.intel.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolas.pitre@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.