]> git.ipfire.org Git - thirdparty/gcc.git/commit
i386: Enable -mnop-mcount for -fpic with PLTs [PR119386]
authorArd Biesheuvel <ardb@kernel.org>
Thu, 10 Apr 2025 12:26:41 +0000 (14:26 +0200)
committerUros Bizjak <ubizjak@gmail.com>
Wed, 16 Apr 2025 18:38:20 +0000 (20:38 +0200)
commit6b4569a3ebdd0df44d87d67a18272ec0b878f2ee
treec3f6dc1c6b8ba84063d3edd6b72a999262c5ca2a
parent9b0ae0a8d70603960f3c578d261efd18c02b803f
i386: Enable -mnop-mcount for -fpic with PLTs [PR119386]

-mnop-mcount can be trivially enabled for -fPIC codegen as long as PLTs
are being used, given that the instruction encodings are identical, only
the target may resolve differently depending on how the linker decides
to incorporate the object file.

So relax the option check, and add a test to ensure that 5-byte NOPs are
emitted when -mnop-mcount is being used.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
gcc/ChangeLog:

PR target/119386
* config/i386/i386-options.cc: Permit -mnop-mcount when
using -fpic with PLTs.

gcc/testsuite/ChangeLog:

PR target/119386
* gcc.target/i386/pr119386-3.c: New test.
gcc/config/i386/i386-options.cc
gcc/testsuite/gcc.target/i386/pr119386-3.c [new file with mode: 0644]