summaryrefslogtreecommitdiff
path: root/lib/csu
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2017-02-26 15:20:59 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2017-02-26 15:20:59 +0000
commit27678cac5cd59c78540cfca1e18b9c092d42a0ee (patch)
tree53d588f402bf9760200c867bc5f39f5dca14c2fb /lib/csu
parentfef72b64bce0c9903c16a8cbff8996462c4b66d1 (diff)
Use a long branch (using movw/movt) to implement MD_SECT_CALL_FUNC.
Necessary (but perhaps not suffcient) to build large binaries on arm. ok guenther@
Diffstat (limited to 'lib/csu')
-rw-r--r--lib/csu/arm/md_init.h20
1 files changed, 5 insertions, 15 deletions
diff --git a/lib/csu/arm/md_init.h b/lib/csu/arm/md_init.h
index 30e7c991473..b64efb97a1a 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.10 2017/01/21 00:45:13 guenther Exp $ */
+/* $OpenBSD: md_init.h,v 1.11 2017/02/26 15:20:58 kettenis Exp $ */
/*-
* Copyright (c) 2001 Ross Harvey
@@ -55,23 +55,13 @@
" .int "#value" \n" \
" .previous")
-#ifdef __PIC__
- /* This nastyness derived from gcc3 output */
#define MD_SECT_CALL_FUNC(section, func) \
__asm (".section "#section", \"ax\" \n" \
- " bl " #func "(PLT) \n" \
+ " movw r0, #:lower16:" #func "- 1f - 8 \n" \
+ " movt r0, #:upper16:" #func "- 1f - 8 \n" \
+ "1: add r0, r0, pc \n" \
+ " blx r0 \n" \
" .previous")
-#else
-#define MD_SECT_CALL_FUNC(section, func) \
- __asm (".section "#section", \"ax\" \n" \
- " adr r0, 1f \n" \
- " ldr r0, [r0] \n" \
- " adr lr, 2f \n" \
- " mov pc, r0 \n" \
- "1: .word " #func " \n" \
- "2: \n" \
- " .previous")
-#endif
#define MD_SECTION_PROLOGUE(sect, entry_pt) \
__asm ( \