summaryrefslogtreecommitdiff
path: root/lib/libc/arch/sparc/SYS.h
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2012-09-04 19:08:16 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2012-09-04 19:08:16 +0000
commitaf1d6e1ef5d045fda635aed4b791869781761e1a (patch)
tree2a20fe84f615f923d776d2d0886c3018d965eef7 /lib/libc/arch/sparc/SYS.h
parentc081a94223a6ecd5ca49a29b347509f7d279f59f (diff)
Add support for -fPIC
ok kettenis
Diffstat (limited to 'lib/libc/arch/sparc/SYS.h')
-rw-r--r--lib/libc/arch/sparc/SYS.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/libc/arch/sparc/SYS.h b/lib/libc/arch/sparc/SYS.h
index f4610e88c3f..d44e0797fe4 100644
--- a/lib/libc/arch/sparc/SYS.h
+++ b/lib/libc/arch/sparc/SYS.h
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: SYS.h,v 1.14 2012/08/22 17:19:35 pascal Exp $
+ * $OpenBSD: SYS.h,v 1.15 2012/09/04 19:08:13 deraadt Exp $
*/
#include <machine/asm.h>
@@ -49,9 +49,17 @@
* ERROR branches to cerror.
*/
#ifdef __PIC__
+#if __PIC__ == 1
#define ERROR() \
PIC_PROLOGUE(%g1,%g2); \
ld [%g1+_C_LABEL(__cerror)],%g2; jmp %g2; nop
+#else /* __PIC__ == 2 */
+#define ERROR() \
+ PIC_PROLOGUE(%g1,%g2); \
+ sethi %hi(_C_LABEL(__cerror)),%g2; \
+ or %g2,%lo(_C_LABEL(__cerror)),%g2; \
+ ld [%g1+%g2],%g2; jmp %g2; nop
+#endif
#else
#define ERROR() \
sethi %hi(_C_LABEL(__cerror)),%g1; \