X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=m4%2Fpsi_decl.m4;h=6a0ef809916b256dd99e8f7e8cfeedd93c7d2014;hp=d1acd32f1eb248da35392cfc5004fdc87f6601f9;hb=03100f9c2f83b42bee97e4adcfba5d8821c4ac22;hpb=2f8b7315fc99d6fe7ac0076b4e1b5f33f11b2209 diff --git a/m4/psi_decl.m4 b/m4/psi_decl.m4 index d1acd32..6a0ef80 100644 --- a/m4/psi_decl.m4 +++ b/m4/psi_decl.m4 @@ -1,7 +1,9 @@ # psi_add_redir(name, symbol) # Add a function redirection to $PSI_REDIRS. psi_add_redir() { - cat >>$PSI_REDIRS <<<" {\"$1\", (psi_func_ptr) $2}, " + cat >>$PSI_REDIRS <>$PSI_VA_DECLS <<<" $1, {0}, " + cat >>$PSI_VA_DECLS <>$PSI_DECLS <<<" $1, {0}, " + cat >>$PSI_DECLS <@@:>@+U / {print$[]3; exit}'` + psi_libc_main=`nm -g conftest$ac_exeext | $AWK -F ' *|@' '/^@<:@@<:@:space:@:>@@:>@+U / {print$[]3; exit}'` ]) psi_cv_libc_main=$psi_libc_main ]) @@ -73,9 +78,9 @@ AC_DEFUN(PSI_DECL, [ AC_CACHE_CHECK(for PSI_VAR_NAME($1), [psi_cv_fn_]PSI_VAR_NAME($1), [ psi_symbol_redirect= AC_TRY_LINK(PSI_INCLUDES, [ - void (*fn)(void) = (void (*)(void)) $psi_symbol; + void (*fn)(void) = (void (*)(void)) $psi_symbol; (*fn)() ], [ - psi_symbol_redirect=`$NM -g conftest$ac_exeext | $AWK -F" *|@" '/^@<:@@<:@:space:@:>@@:>@+U '$psi_cv_libc_main'/ {next} /^@<:@@<:@:space:@:>@@:>@+U / {print$[]3; exit}'` + psi_symbol_redirect=`nm -g conftest$ac_exeext | $AWK -F ' *|@' '/^@<:@@<:@:space:@:>@@:>@+U '$psi_cv_libc_main'/ {next} /^@<:@@<:@:space:@:>@@:>@+U / {print$[]3; exit}'` ]) [psi_cv_fn_]PSI_VAR_NAME($1)=$psi_symbol_redirect ]) @@ -83,12 +88,17 @@ AC_DEFUN(PSI_DECL, [ "$psi_symbol"|"_$psi_symbol") psi_add_decl "$psi_decl_args" $3 ;; - *) + "") ifelse([$3], vararg, [ AC_MSG_ERROR(varargs macro support is not implemented) ],[ - PSI_MACRO($1, $2, [psi_add_decl "$psi_decl_args"]) + PSI_MACRO($1, $2, [ + psi_add_decl "$psi_decl_args" + ]) ]) ;; + "*") + PSI_REDIR($psi_symbol, $psi_symbol_redirect) + ;; esac ])