diff options
author | Roland McGrath <roland@hack.frob.com> | 2011-07-09 14:41:39 -0700 |
---|---|---|
committer | Roland McGrath <roland@hack.frob.com> | 2011-07-09 14:41:39 -0700 |
commit | 113ddea44742d006d7a910a0707106c7defcfd9b (patch) | |
tree | d27e74deae49fc9dc8eb8f51af35363f958925b6 /configure.in | |
parent | 574920b446870648623a85e00dd8f3ca9f482c0e (diff) | |
download | glibc-113ddea44742d006d7a910a0707106c7defcfd9b.tar.gz |
Use an empirical check for .ctors/.dtors -> .init_array/.fini_array magic.
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/configure.in b/configure.in index e9464d89e6..e18b343416 100644 --- a/configure.in +++ b/configure.in @@ -1486,12 +1486,30 @@ EOF AC_CACHE_CHECK(whether to use .ctors/.dtors header and trailer, libc_cv_ctors_header, [dnl - if AC_TRY_COMMAND([${CC-cc} -Wl,--verbose 2>&1|grep SORT_BY_INIT_PRIORITY 1>&AS_MESSAGE_LOG_FD]); then - libc_cv_ctors_header=no - else libc_cv_ctors_header=yes - fi]) - + AC_TRY_LINK([], [ +__attribute__ ((constructor)) void ctor (void) { puts("ctor"); } +__attribute__ ((destructor)) void dtor (void) { puts("dtor"); } +], + [dnl + AS_IF([$READELF -WS conftest$ac_exeext | $AWK ' + { gsub(/\@<:@ */, "@<:@") } + $2 == ".ctors" || $2 == ".dtors" { + size = strtonum("0x" $6) + align = strtonum("0x" $NF) + seen@<:@$2@:>@ = 1 + stub@<:@$2@:>@ = size == align * 2 + } + END { + ctors_ok = !seen@<:@".ctors"@:>@ || stub@<:@".ctors"@:>@ + dtors_ok = !seen@<:@".dtors"@:>@ || stub@<:@".dtors"@:>@ + exit ((ctors_ok && dtors_ok) ? 0 : 1) + } + '], [libc_cv_ctors_header=no]) + ], [dnl + AC_MSG_ERROR([missing __attribute__ ((constructor)) support??]) + ]) + ]) if test $libc_cv_ctors_header = no; then AC_DEFINE(NO_CTORS_DTORS_SECTIONS) fi |