linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sedat Dilek <sedat.dilek@gmail.com>
To: Denys Vlasenko <dvlasenk@redhat.com>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org
Subject: CBL issue #431: lld: x86_64: sysfs: cannot create duplicate filename $module/.rodata.cst{16,32}
Date: Mon, 8 Apr 2019 15:36:22 +0200	[thread overview]
Message-ID: <CA+icZUVW2X6G=qukJTrZuUevcnrOiuShJGxnxVaqyONNxv+RYg@mail.gmail.com> (raw)

Hi Denys,

I fell over your commit "crypto: x86 - make constants readonly, allow
linker to merge them" [1] while digging into ClangBuiltLinux issue 431
[0].

I see the following in my dmesg-log:

$ grep sysfs: dmesg_5.0.4-rc1-1-amd64-cbl-asmgoto.txt
[Fri Mar 22 10:32:09 2019] sysfs: cannot create duplicate filename
'/module/usbcore/sections/.rodata.cst16'
[Fri Mar 22 10:32:18 2019] sysfs: cannot create duplicate filename
'/module/nfsd/sections/.rodata.cst32'
[Fri Mar 22 10:32:18 2019] sysfs: cannot create duplicate filename
'/module/iwlwifi/sections/.rodata.cst16'
[Fri Mar 22 10:32:18 2019] sysfs: cannot create duplicate filename
'/module/i915/sections/.rodata.cst32'
[Fri Mar 22 10:32:18 2019] sysfs: cannot create duplicate filename
'/module/mac80211/sections/.rodata.cst32'
[Fri Mar 22 10:32:18 2019] sysfs: cannot create duplicate filename
'/module/iwlmvm/sections/.rodata.cst16'
[Fri Mar 22 10:32:20 2019] sysfs: cannot create duplicate filename
'/module/bluetooth/sections/.rodata.cst16'

Above modules have dependencies to stuff from arch/x86/crypto (see below P.S.).

Looks like LLD defaults to -ffunction-sections and -fdata-sections.
Do you happen to know what the defaults are for BFD linker?

LLD maintainers suggest me to put -fdata-sections.
But where?

I tried to put it into arch/86/Makefile:

KBUILD_CFLAGS_MODULE += -fdata-sections

No success.
Not sure if I need also to activate -ffunction-sections in this line.

Unsure if this is too aggressive...

diff --git a/Makefile b/Makefile
index ac29cd533d55..08bd1946e182 100644
--- a/Makefile
+++ b/Makefile
@@ -815,6 +815,8 @@ ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
 KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections
 LDFLAGS_vmlinux += --gc-sections
 endif
+KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections
+KBUILD_CFLAGS_MODULE += -ffunction-sections -fdata-sections

 # arch Makefile may override CC so keep this after arch Makefile is included
 NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)

...and what about the correlation with this setting init/Makefile...

ccflags-y := -fno-function-sections -fno-data-sections

More details see [0].

Maybe you have an idea?
If you need further informations, please let me know.

Thanks in advance.

Regards,
- Sedat -

[0] https://github.com/ClangBuiltLinux/linux/issues/431
[1] https://git.kernel.org/linus/e183914af00e15eb41ae666d44e323bfa154be13

P.S.: arch/x86/crypto dependencies

$ git grep -E 'rodata.cst16|rodata.cst32' | grep arch/x86
arch/x86/crypto/aegis128-aesni-asm.S:.section
.rodata.cst16.aegis128_const, "aM", @progbits, 32
arch/x86/crypto/aegis128-aesni-asm.S:.section
.rodata.cst16.aegis128_counter, "aM", @progbits, 16
arch/x86/crypto/aegis128l-aesni-asm.S:.section
.rodata.cst16.aegis128l_const, "aM", @progbits, 32
arch/x86/crypto/aegis128l-aesni-asm.S:.section
.rodata.cst16.aegis128l_counter, "aM", @progbits, 16
arch/x86/crypto/aegis256-aesni-asm.S:.section
.rodata.cst16.aegis256_const, "aM", @progbits, 32
arch/x86/crypto/aegis256-aesni-asm.S:.section
.rodata.cst16.aegis256_counter, "aM", @progbits, 16
arch/x86/crypto/aesni-intel_asm.S:.section
.rodata.cst16.gf128mul_x_ble_mask, "aM", @progbits, 16
arch/x86/crypto/aesni-intel_asm.S:.section      .rodata.cst16.POLY,
"aM", @progbits, 16
arch/x86/crypto/aesni-intel_asm.S:.section      .rodata.cst16.TWOONE,
"aM", @progbits, 16
arch/x86/crypto/aesni-intel_asm.S:.section
.rodata.cst16.SHUF_MASK, "aM", @progbits, 16
arch/x86/crypto/aesni-intel_asm.S:.section      .rodata.cst16.MASK1,
"aM", @progbits, 16
arch/x86/crypto/aesni-intel_asm.S:.section      .rodata.cst16.MASK2,
"aM", @progbits, 16
arch/x86/crypto/aesni-intel_asm.S:.section      .rodata.cst16.ONE,
"aM", @progbits, 16
arch/x86/crypto/aesni-intel_asm.S:.section
.rodata.cst16.F_MIN_MASK, "aM", @progbits, 16
arch/x86/crypto/aesni-intel_asm.S:.section      .rodata.cst16.dec,
"aM", @progbits, 16
arch/x86/crypto/aesni-intel_asm.S:.section      .rodata.cst16.enc,
"aM", @progbits, 16
arch/x86/crypto/aesni-intel_avx-x86_64.S:.section
.rodata.cst16.POLY, "aM", @progbits, 16
arch/x86/crypto/aesni-intel_avx-x86_64.S:.section
.rodata.cst16.POLY2, "aM", @progbits, 16
arch/x86/crypto/aesni-intel_avx-x86_64.S:.section
.rodata.cst16.TWOONE, "aM", @progbits, 16
arch/x86/crypto/aesni-intel_avx-x86_64.S:.section
.rodata.cst16.SHUF_MASK, "aM", @progbits, 16
arch/x86/crypto/aesni-intel_avx-x86_64.S:.section
.rodata.cst16.ONE, "aM", @progbits, 16
arch/x86/crypto/aesni-intel_avx-x86_64.S:.section
.rodata.cst16.ONEf, "aM", @progbits, 16
arch/x86/crypto/camellia-aesni-avx-asm_64.S:.section    .rodata.cst16,
"aM", @progbits, 16
arch/x86/crypto/camellia-aesni-avx2-asm_64.S:.section
.rodata.cst32.shufb_16x16b, "aM", @progbits, 32
arch/x86/crypto/camellia-aesni-avx2-asm_64.S:.section
.rodata.cst32.pack_bswap, "aM", @progbits, 32
arch/x86/crypto/camellia-aesni-avx2-asm_64.S:.section   .rodata.cst16,
"aM", @progbits, 16
arch/x86/crypto/cast5-avx-x86_64-asm_64.S:.section
.rodata.cst16.bswap_mask, "aM", @progbits, 16
arch/x86/crypto/cast5-avx-x86_64-asm_64.S:.section
.rodata.cst16.bswap128_mask, "aM", @progbits, 16
arch/x86/crypto/cast5-avx-x86_64-asm_64.S:.section
.rodata.cst16.bswap_iv_mask, "aM", @progbits, 16
arch/x86/crypto/cast6-avx-x86_64-asm_64.S:.section      .rodata.cst16,
"aM", @progbits, 16
arch/x86/crypto/chacha-avx2-x86_64.S:.section   .rodata.cst32.ROT8,
"aM", @progbits, 32
arch/x86/crypto/chacha-avx2-x86_64.S:.section   .rodata.cst32.ROT16,
"aM", @progbits, 32
arch/x86/crypto/chacha-avx2-x86_64.S:.section   .rodata.cst32.CTRINC,
"aM", @progbits, 32
arch/x86/crypto/chacha-avx2-x86_64.S:.section   .rodata.cst32.CTR2BL,
"aM", @progbits, 32
arch/x86/crypto/chacha-avx2-x86_64.S:.section   .rodata.cst32.CTR4BL,
"aM", @progbits, 32
arch/x86/crypto/chacha-avx512vl-x86_64.S:.section
.rodata.cst32.CTR2BL, "aM", @progbits, 32
arch/x86/crypto/chacha-avx512vl-x86_64.S:.section
.rodata.cst32.CTR4BL, "aM", @progbits, 32
arch/x86/crypto/chacha-avx512vl-x86_64.S:.section
.rodata.cst32.CTR8BL, "aM", @progbits, 32
arch/x86/crypto/chacha-ssse3-x86_64.S:.section  .rodata.cst16.ROT8,
"aM", @progbits, 16
arch/x86/crypto/chacha-ssse3-x86_64.S:.section  .rodata.cst16.ROT16,
"aM", @progbits, 16
arch/x86/crypto/chacha-ssse3-x86_64.S:.section  .rodata.cst16.CTRINC,
"aM", @progbits, 16
arch/x86/crypto/crct10dif-pcl-asm_64.S:.section .rodata.cst16.mask1,
"aM", @progbits, 16
arch/x86/crypto/crct10dif-pcl-asm_64.S:.section .rodata.cst16.mask2,
"aM", @progbits, 16
arch/x86/crypto/crct10dif-pcl-asm_64.S:.section
.rodata.cst16.SHUF_MASK, "aM", @progbits, 16
arch/x86/crypto/crct10dif-pcl-asm_64.S:.section
.rodata.cst32.pshufb_shf_table, "aM", @progbits, 32
arch/x86/crypto/ghash-clmulni-intel_asm.S:.section
.rodata.cst16.bswap_mask, "aM", @progbits, 16
arch/x86/crypto/morus1280-avx2-asm.S:.section
.rodata.cst32.morus1280_const, "aM", @progbits, 32
arch/x86/crypto/morus1280-avx2-asm.S:.section
.rodata.cst32.morus1280_counter, "aM", @progbits, 32
arch/x86/crypto/morus1280-sse2-asm.S:.section
.rodata.cst16.morus640_const, "aM", @progbits, 16
arch/x86/crypto/morus1280-sse2-asm.S:.section
.rodata.cst16.morus640_counter, "aM", @progbits, 16
arch/x86/crypto/morus640-sse2-asm.S:.section
.rodata.cst16.morus640_const, "aM", @progbits, 32
arch/x86/crypto/morus640-sse2-asm.S:.section
.rodata.cst16.morus640_counter, "aM", @progbits, 16
arch/x86/crypto/poly1305-avx2-x86_64.S:.section .rodata.cst32.ANMASK,
"aM", @progbits, 32
arch/x86/crypto/poly1305-avx2-x86_64.S:.section .rodata.cst32.ORMASK,
"aM", @progbits, 32
arch/x86/crypto/poly1305-sse2-x86_64.S:.section .rodata.cst16.ANMASK,
"aM", @progbits, 16
arch/x86/crypto/poly1305-sse2-x86_64.S:.section .rodata.cst16.ORMASK,
"aM", @progbits, 16
arch/x86/crypto/serpent-avx-x86_64-asm_64.S:.section
.rodata.cst16.bswap128_mask, "aM", @progbits, 16
arch/x86/crypto/serpent-avx-x86_64-asm_64.S:.section
.rodata.cst16.xts_gf128mul_and_shl1_mask, "aM", @progbits, 16
arch/x86/crypto/serpent-avx2-asm_64.S:.section
.rodata.cst16.bswap128_mask, "aM", @progbits, 16
arch/x86/crypto/serpent-avx2-asm_64.S:.section
.rodata.cst16.xts_gf128mul_and_shl1_mask_0, "aM", @progbits, 16
arch/x86/crypto/serpent-avx2-asm_64.S:.section
.rodata.cst16.xts_gf128mul_and_shl1_mask_1, "aM", @progbits, 16
arch/x86/crypto/sha1_ni_asm.S:.section
.rodata.cst16.PSHUFFLE_BYTE_FLIP_MASK, "aM", @progbits, 16
arch/x86/crypto/sha1_ni_asm.S:.section  .rodata.cst16.UPPER_WORD_MASK,
"aM", @progbits, 16
arch/x86/crypto/sha256-avx-asm.S:.section
.rodata.cst16.PSHUFFLE_BYTE_FLIP_MASK, "aM", @progbits, 16
arch/x86/crypto/sha256-avx-asm.S:.section
.rodata.cst16._SHUF_00BA, "aM", @progbits, 16
arch/x86/crypto/sha256-avx-asm.S:.section
.rodata.cst16._SHUF_DC00, "aM", @progbits, 16
arch/x86/crypto/sha256-avx2-asm.S:.section
.rodata.cst32.PSHUFFLE_BYTE_FLIP_MASK, "aM", @progbits, 32
arch/x86/crypto/sha256-avx2-asm.S:.section
.rodata.cst32._SHUF_00BA, "aM", @progbits, 32
arch/x86/crypto/sha256-avx2-asm.S:.section
.rodata.cst32._SHUF_DC00, "aM", @progbits, 32
arch/x86/crypto/sha256-ssse3-asm.S:.section
.rodata.cst16.PSHUFFLE_BYTE_FLIP_MASK, "aM", @progbits, 16
arch/x86/crypto/sha256-ssse3-asm.S:.section
.rodata.cst16._SHUF_00BA, "aM", @progbits, 16
arch/x86/crypto/sha256-ssse3-asm.S:.section
.rodata.cst16._SHUF_DC00, "aM", @progbits, 16
arch/x86/crypto/sha256_ni_asm.S:.section
.rodata.cst16.PSHUFFLE_BYTE_FLIP_MASK, "aM", @progbits, 16
arch/x86/crypto/sha512-avx-asm.S:.section
.rodata.cst16.XMM_QWORD_BSWAP, "aM", @progbits, 16
arch/x86/crypto/sha512-avx2-asm.S:.section
.rodata.cst32.PSHUFFLE_BYTE_FLIP_MASK, "aM", @progbits, 32
arch/x86/crypto/sha512-avx2-asm.S:.section
.rodata.cst32.MASK_YMM_LO, "aM", @progbits, 32
arch/x86/crypto/sha512-ssse3-asm.S:.section
.rodata.cst16.XMM_QWORD_BSWAP, "aM", @progbits, 16
arch/x86/crypto/twofish-avx-x86_64-asm_64.S:.section
.rodata.cst16.bswap128_mask, "aM", @progbits, 16
arch/x86/crypto/twofish-avx-x86_64-asm_64.S:.section
.rodata.cst16.xts_gf128mul_and_shl1_mask, "aM", @progbits, 16
- EOT -

             reply	other threads:[~2019-04-08 13:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-08 13:36 Sedat Dilek [this message]
2019-04-08 13:56 ` CBL issue #431: lld: x86_64: sysfs: cannot create duplicate filename $module/.rodata.cst{16,32} Denys Vlasenko
2019-04-08 13:58   ` Denys Vlasenko
2019-04-08 14:23     ` Sedat Dilek
2019-04-08 14:29       ` Denys Vlasenko
2019-04-08 14:34         ` Sedat Dilek
2019-04-08 14:42           ` Denys Vlasenko
2019-04-08 14:44             ` Sedat Dilek
2019-04-08 14:57               ` Sedat Dilek
2019-04-08 15:04                 ` Denys Vlasenko
2019-04-08 15:08                   ` Sedat Dilek
2019-04-08 15:16                   ` Sedat Dilek

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='CA+icZUVW2X6G=qukJTrZuUevcnrOiuShJGxnxVaqyONNxv+RYg@mail.gmail.com' \
    --to=sedat.dilek@gmail.com \
    --cc=dvlasenk@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).