This is the mail archive of the libc-alpha@sourceware.org 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] Powerpc: correct duplicate label issue with multiplepasses through context code


Correct a duplicate label build problem on powerpc32.
This problem triggers in the {set,swap,get}context code with some
combinations of the __ASSUME_SWAPCONTEXT_SYSCALL definition and
shlib_compat #ifdeffery.  Under certain conditions, we make multiple
passes through the {set,swap,get}context-common.S code, with each pass
having a unique __CONTEXT_FUNC_NAME value.  In those cases, this will
trip over the "simplified access_got macro" changes which hardcoded the
"got_label:" string.
Add a layer to glue the __CONTEXT_FUNC_NAME value to the got_label
string to ensure uniqueness.    

2012-01-04  Will Schmidt  <will_schmidt@vnet.ibm.com>

	* powerpc/powerpc32/sysdep.h: Add GLUE and GENERATE_GOT_LABEL
	macros.
	* unix/sysv/linux/powerpc/powerpc32/getcontext-common.S: Call
	macro to ensure uniqueness of label name.
	* unix/sysv/linux/powerpc/powerpc32/setcontext-common.S:
	Likewise.
	* unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S:
	Likewise.


diff --git a/sysdeps/powerpc/powerpc32/sysdep.h b/sysdeps/powerpc/powerpc32/sysdep.h
index c824c0a..f13f829 100644
--- a/sysdeps/powerpc/powerpc32/sysdep.h
+++ b/sysdeps/powerpc/powerpc32/sysdep.h
@@ -1,5 +1,5 @@
 /* Assembly macros for 32-bit PowerPC.
-   Copyright (C) 1999, 2001, 2002, 2003, 2006, 2011
+   Copyright (C) 1999, 2001, 2002, 2003, 2006, 2011, 2012
 	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -153,6 +153,10 @@ GOT_LABEL:			;					      \
 #undef L
 #define L(x) .L##x
 
+#define XGLUE(a,b) a##b
+#define GLUE(a,b) XGLUE(a,b)
+#define GENERATE_GOT_LABEL(name) GLUE(.got_label,name)
+
 /* Label in text section.  */
 #define C_TEXT(name) name
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S
index f55c073..a345300 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S
@@ -1,5 +1,5 @@
 /* Save current context, powerpc32 common.
-   Copyright (C) 2005, 2006, 2011 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006, 2011, 2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -145,6 +145,7 @@ ENTRY(__CONTEXT_FUNC_NAME)
 # ifdef __CONTEXT_ENABLE_VRS
 #  ifdef PIC
 	mflr    r8
+#define got_label GENERATE_GOT_LABEL(__CONTEXT_FUNC_NAME)
 	SETUP_GOT_ACCESS(r7,got_label)
 	addis	r7,r7,_GLOBAL_OFFSET_TABLE_-got_label@ha
 	addi	r7,r7,_GLOBAL_OFFSET_TABLE_-got_label@l
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S
index a2f419b..78cc7a6 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S
@@ -1,5 +1,6 @@
 /* Jump to a new context powerpc32 common.
-   Copyright (C) 2005, 2006, 2008, 2009, 2011 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006, 2008, 2009, 2011, 2012
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -73,6 +74,7 @@ ENTRY(__CONTEXT_FUNC_NAME)
 
 #ifdef PIC
 	mflr    r8
+#define got_label GENERATE_GOT_LABEL(__CONTEXT_FUNC_NAME)
 	SETUP_GOT_ACCESS(r7,got_label)
 	addis	r7,r7,_GLOBAL_OFFSET_TABLE_-got_label@ha
 	addi	r7,r7,_GLOBAL_OFFSET_TABLE_-got_label@l
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
index 19dfcf8..af21c43 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
@@ -1,5 +1,6 @@
 /* Save current context and jump to a new context.
-   Copyright (C) 2005, 2006, 2008, 2009, 2011 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006, 2008, 2009, 2011, 2012
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -146,6 +147,7 @@ ENTRY(__CONTEXT_FUNC_NAME)
 
 # ifdef PIC
 	mflr    r8
+#define got_label GENERATE_GOT_LABEL(__CONTEXT_FUNC_NAME)
 	SETUP_GOT_ACCESS(r7,got_label)
 	addis	r7,r7,_GLOBAL_OFFSET_TABLE_-got_label@ha
 	addi	r7,r7,_GLOBAL_OFFSET_TABLE_-got_label@l



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