diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2017-01-21 00:45:14 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2017-01-21 00:45:14 +0000 |
commit | f370ab815975aacbfcd4d51557fcae1a622bb182 (patch) | |
tree | 57fac42275d09ddec1117a0fc6f9ad21c23ffe3f /lib/csu/arm | |
parent | c518e1a36d9df98ac82734768d27244af276ba2d (diff) |
Declare the symbols that label the .ctors, .dtors, .eh_frame, and .jcr
sections as extern hidden arrays of indefinite size, so that the compiler
(well, clang) doesn't believe it knows the exact contents and thus optimize
things into infinite loops. Actually set the symbols to be in the sections
and insert the leading and trailing values via __asm().
Problem pointed out by patrick@
testing and ok kettenis@
Diffstat (limited to 'lib/csu/arm')
-rw-r--r-- | lib/csu/arm/md_init.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/lib/csu/arm/md_init.h b/lib/csu/arm/md_init.h index 9e9aaa1fa60..30e7c991473 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.9 2016/10/03 22:13:30 kettenis Exp $ */ +/* $OpenBSD: md_init.h,v 1.10 2017/01/21 00:45:13 guenther Exp $ */ /*- * Copyright (c) 2001 Ross Harvey @@ -33,6 +33,28 @@ * POSSIBILITY OF SUCH DAMAGE. */ +/* + * arm overrides these because it uses %progbits instead of @progbits + */ +#define MD_DATA_SECTION_FLAGS_SYMBOL(section, flags, type, symbol) \ + extern __dso_hidden type symbol[]; \ + __asm(" .section "section",\""flags"\",%progbits \n" \ + " .balign 4 \n" \ + #symbol": \n" \ + " .previous") +#define MD_DATA_SECTION_SYMBOL_VALUE(section, type, symbol, value) \ + extern __dso_hidden type symbol[]; \ + __asm(" .section "section",\"aw\",%progbits \n" \ + " .balign 4 \n" \ + #symbol": \n" \ + " .int "#value" \n" \ + " .previous") +#define MD_DATA_SECTION_FLAGS_VALUE(section, flags, value) \ + __asm(" .section "section",\""flags"\",%progbits \n" \ + " .balign 4 \n" \ + " .int "#value" \n" \ + " .previous") + #ifdef __PIC__ /* This nastyness derived from gcc3 output */ #define MD_SECT_CALL_FUNC(section, func) \ |