diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2004-02-09 02:40:50 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2004-02-09 02:40:50 +0000 |
commit | 51982f5133bf911044e556877bd770f6d8764ef7 (patch) | |
tree | 951dc08a81a7921eed7cee988af505b6db8fc23d /lib/csu | |
parent | 441fd02028f2d27c3c6d75d73a1aa2d10166cb3b (diff) |
Proper PIC support in arm startup files.
Diffstat (limited to 'lib/csu')
-rw-r--r-- | lib/csu/arm/Makefile | 2 | ||||
-rw-r--r-- | lib/csu/arm/md_init.h | 13 |
2 files changed, 11 insertions, 4 deletions
diff --git a/lib/csu/arm/Makefile b/lib/csu/arm/Makefile index 47adc13a1d1..c98fd5adfa6 100644 --- a/lib/csu/arm/Makefile +++ b/lib/csu/arm/Makefile @@ -9,7 +9,7 @@ ELFDIR= ${.CURDIR}/../common_elf .PATH: ${ELFDIR} CFLAGS+= -I${ELFDIR} -I${.CURDIR} -PICFLAG?=-fpic +PICFLAG?=-fpic -DPIC all: ${OBJS} diff --git a/lib/csu/arm/md_init.h b/lib/csu/arm/md_init.h index c39ed93bca6..e5c5eac35aa 100644 --- a/lib/csu/arm/md_init.h +++ b/lib/csu/arm/md_init.h @@ -1,4 +1,4 @@ -/* $OpenBSD: md_init.h,v 1.1 2004/02/01 05:28:20 drahn Exp $ */ +/* $OpenBSD: md_init.h,v 1.2 2004/02/09 02:40:49 drahn Exp $ */ /*- * Copyright (c) 2001 Ross Harvey @@ -33,7 +33,13 @@ * POSSIBILITY OF SUCH DAMAGE. */ -/* XXX */ +#ifdef PIC + /* This nastyness derived from gcc3 output */ +#define MD_SECT_CALL_FUNC(section, func) \ + __asm (".section "#section", \"ax\" \n" \ + " bl " #func "(PLT) \n" \ + " .previous") +#else #define MD_SECT_CALL_FUNC(section, func) \ __asm (".section "#section", \"ax\" \n" \ " adr r0, 1f \n" \ @@ -43,6 +49,7 @@ "1: .word " #func " \n" \ "2: \n" \ " .previous") +#endif #define MD_SECTION_PROLOGUE(sect, entry_pt) \ __asm ( \ @@ -52,7 +59,7 @@ " .align 4 \n" \ #entry_pt": \n" \ " mov ip, sp \n" \ - " stmfd sp!, {fp, lr, pc} \n" \ + " stmfd sp!, {fp, ip, lr, pc} \n" \ " sub fp, ip, #4 \n" \ " /* fall thru */ \n" \ " .previous") |