defexp.awk 688 B

12345678910111213141516171819202122232425262728
  1. # awk script to convert symbol export table formats
  2. # converts an msvc .def file to an darwin ld export-symbols-list file
  3. # we only support the most basic module definition syntax
  4. # skip comments
  5. /^\w*#.*/ {next}
  6. /^\w*;.*/ {next}
  7. # remember and propagate the library name
  8. /LIBRARY/ {name = $2; print "# export list for", name; next}
  9. # skip various other lines
  10. /^\w*NAME/ ||
  11. /^\w*VERSION/ ||
  12. /^\w*EXPORTS/ ||
  13. /^\w*HEAPSIZE/ ||
  14. /^\w*STACKSIZE/ ||
  15. /^\w*STUB/ {next}
  16. # todo: handle SECTIONS
  17. # for symbols, strip the semicolon and mangle the name
  18. /[a-zA-Z]+/ {sub(/\;/, ""); print "_" $1}
  19. # todo: warn if we see publicname=privatename mappings
  20. # which other linkers don't support