# staticCtor dload.o # --- runs nm on dload.o & finds the line containing "staticCtor", # --- analyzes that line and prints out the mangled symbol in it # --- which is the name of the static initialization block. # --- See the Makefile that accompanies this. # Carl Sturtivant, 2012-08-19 #needs an installation of Icon see http://cs.arizona.edu/icon # icont ("translator" i.e. compiler to bytecode) # iconx ("runtime" i.e. interpreter) # Icon v9.4.3 easy to get package with Ubuntu or Debian. # emacs syntax colors Icon. procedure main(arg) fname := arg[1] | stop("!1") in := open("nm " || fname, "p") | stop("!2") while line := trim(read(in)) do line ? if find("staticCtor") then { write(get_symbol(line)) return } stop("!3") end procedure get_symbol(line) line ? { tab(find("_")) sym := tab(0) return sym } end