const char *label)
{
if (flag_nop_mcount || !strcmp (target, "nop"))
- /* 5 byte nop: nopl 0(%[re]ax,%[re]ax,1) */
- fprintf (file, "%s" ASM_BYTE "0x0f, 0x1f, 0x44, 0x00, 0x00\n",
- label);
+ {
+ if (TARGET_16BIT)
+ /* 3 byte no-op: lea 0(%si), %si */
+ fprintf (file, "%s" ASM_BYTE "0x8d, 0x74, 0x00\n", label);
+ else
+ /* 5 byte nop: nopl 0(%[re]ax,%[re]ax,1) */
+ fprintf (file, "%s" ASM_BYTE "0x0f, 0x1f, 0x44, 0x00, 0x00\n",
+ label);
+ }
else if (!TARGET_PECOFF && flag_pic)
{
gcc_assert (flag_plt);
--- /dev/null
+/* Test -mnop-mcount for 16-bit code to generate a 3-byte NOP */
+/* { dg-do compile { target { *-*-linux* && nonpic } } } */
+/* { dg-require-effective-target mfentry } */
+/* { dg-options "-pg -mfentry -mnop-mcount -m16" } */
+/* { dg-final { scan-assembler-not "__fentry__" } } */
+/* { dg-final { scan-assembler-not "0x0f, 0x1f, 0x44, 0x00, 0x00" } } */
+/* { dg-final { scan-assembler-times "0x8d, 0x74, 0x00" 1 } } */
+extern void foobar(char *);
+
+void func(void)
+{
+ foobar ("Hello world\n");
+}
/* Test -mnop-mcount */
/* { dg-do compile { target { *-*-linux* && nonpic } } } */
/* { dg-require-effective-target mfentry } */
-/* { dg-options "-Wno-old-style-definition -pg -mfentry -mrecord-mcount -mnop-mcount" } */
+/* { dg-options "-pg -mfentry -mrecord-mcount -mnop-mcount" } */
/* { dg-final { scan-assembler-not "__fentry__" } } */
+/* { dg-final { scan-assembler-times "0x0f, 0x1f, 0x44, 0x00, 0x00" 3 } } */
/* Origin: Andi Kleen */
extern void foobar(char *);
foobar ("Hello world");
}
-void func3(a)
-char *a;
+void func3(char *a)
{
foobar("Hello world");
}