This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] i386: Replace internal_function attribute for __mcount_internal

I compiled glibc on i386 with internal_function restored, with a special
GCC which encodes the regparm attribute value in the symbol name
(similar to what Windows does).  This means that mismatches between
definition and use result in linker errors.

This rediscovered the NSS mismatch already fixed, and another internal
mismatch related to mcount.  This one is harmless; it's merely an
internal inconsistency introduced by the internal_function removal.

After adjusting the Versions files to export the mangled names for
GLIBC_PRIVATE functions, all libraries link again and the public ABI
checks out, so I'm reasonably confident that we now have a consistent
build again.

i386: Replace internal_function attribute for __mcount_internal

__mcount_internal is called from assembler code.  Use an explicit
regparm attribute to pass both arguments in registers, to match what
used to happen with internal_function before commit
fbdc1e3e8de7f49e439b6e274d3e7e07da78416e (i386: Do not set

2017-08-14  Florian Weimer  <>

	* sysdeps/i386/machine-gmon.h (mcount_internal): Declare with
	regparm (2) instead of internal_function.
	(_MCOUNT_DECL): Adjust.

diff --git a/sysdeps/i386/machine-gmon.h b/sysdeps/i386/machine-gmon.h
index d5d8cdf7c6..3e90b8c0c7 100644
--- a/sysdeps/i386/machine-gmon.h
+++ b/sysdeps/i386/machine-gmon.h
@@ -29,10 +29,12 @@
 /* We must not pollute the global namespace.  */
 #define mcount_internal __mcount_internal
-extern void mcount_internal (u_long frompc, u_long selfpc) internal_function;
+extern void mcount_internal (u_long frompc, u_long selfpc)
+  __attribute__ ((regparm (2)));
-#define _MCOUNT_DECL(frompc, selfpc) \
-void internal_function mcount_internal (u_long frompc, u_long selfpc)
+#define _MCOUNT_DECL(frompc, selfpc)                \
+  __attribute__ ((regparm (2)))			    \
+void mcount_internal (u_long frompc, u_long selfpc)
 /* Define MCOUNT as empty since we have the implementation in another

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]