mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-22 21:10:07 +00:00
aad08dbad9
* scripts/gen-as-const.awk: New file. * Makefile (distribute): Add it. * Makerules ($(common-objpfx)%.h %.h.d: %.sym): New pattern rule. (before-compile): Add $(gen-as-const-headers:%.sym=$(common-objpfx)%.h) to the list. (+depfiles): Add $(addprefix $(common-objpfx),$(gen-as-const-headers)).
30 lines
758 B
Awk
30 lines
758 B
Awk
# Script used in producing headers of assembly constants from C expressions.
|
|
# The input to this script looks like:
|
|
# #cpp-directive ...
|
|
# NAME1
|
|
# NAME2 expression ...
|
|
# The output of this script is C code to be run through gcc -S and then
|
|
# massaged to extract the integer constant values of the given C expressions.
|
|
# A line giving just a name implies an expression consisting of just that name.
|
|
|
|
BEGIN { started = 0 }
|
|
|
|
# cpp directives go straight through.
|
|
/^#/ { print; next }
|
|
|
|
NF >= 1 && !started {
|
|
print "void dummy(void) {";
|
|
started = 1;
|
|
}
|
|
|
|
NF == 1 { sub(/^.*$/, "& &"); }
|
|
|
|
NF > 1 {
|
|
name = $1;
|
|
sub(/^[^ ]+[ ]+/, "");
|
|
printf "asm (\"@@@name@@@%s@@@value@@@%%0@@@end@@@\" : : \"i\" (%s));\n",
|
|
name, $0;
|
|
}
|
|
|
|
END { if (started) print "}" }
|