Skip to content

Commit ee874f4

Browse files
committed
powerpc: Fix unrecognized instruction errors with recent binutils
Recent versions of binutils (with commit b25f942e18d6ecd7ec3e2d2e9930eb4f996c258a) stopped preserving "sticky" options across a base `.machine` directive, nullifying the use of passing "-many" through GCC to the assembler. As a result, some instructions which were recognized even under older, more stringent `.machine` directives become unrecognized instructions in that context. In `sysdeps/powerpc/tst-set_ppr.c`, the use of the `mfppr32` extended mnemonic became unrecognized, as the default compilation with GCC for 32bit powerpc adds a `.machine ppc` in the resulting assembly, so the command line option `-Wa,-many` is essentially ignored, and the ISA 2.06 instructions and mnemonics, like `mfppr32`, are unrecognized. The compilation of `sysdeps/powerpc/tst-set_ppr.c` fails with: Error: unrecognized opcode: `mfppr32' Add appropriate `.machine` directives in the assembly to bracket the `mfppr32` instruction. Part of a 2019 fix (commit 9250e66) to the above test's Makefile to add `-many` to the compilation when GCC itself stopped passing `-many` to the assember no longer has any effect, so remove that. Reported-by: Joseph Myers <joseph@codesourcery.com>
1 parent 9bd9978 commit ee874f4

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

sysdeps/powerpc/Makefile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,6 @@ ifeq ($(subdir),misc)
6161
sysdep_headers += sys/platform/ppc.h
6262
tests += test-gettimebase
6363
tests += tst-set_ppr
64-
65-
# This test is expected to run and exit with EXIT_UNSUPPORTED on
66-
# processors that do not implement the Power ISA 2.06 or greater.
67-
# But the test makes use of instructions from Power ISA 2.06 and 2.07.
68-
CFLAGS-tst-set_ppr.c += -Wa,-many
6964
endif
7065

7166
ifeq ($(subdir),wcsmbs)

sysdeps/powerpc/tst-set_ppr.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ get_thread_priority (void)
4444
{
4545
/* Read the PPR. */
4646
ppr_t ppr;
47-
asm volatile (MFPPR" %0" : "=r"(ppr));
47+
asm volatile (".machine push; .machine power7; "MFPPR" %0; .machine pop"
48+
: "=r"(ppr));
4849
/* Return the thread priority value. */
4950
return EXTRACT_THREAD_PRIORITY (ppr);
5051
}

0 commit comments

Comments
 (0)