Move common functions copy_to_string and copy_from_string to new module graph_copy
Multiple import code from for the same object file result in linker errors when gcc is used for linking. This MR moves the duplicate code between dynamic_string and graph_copy_with_names to a new module graph_copy. (We cannot import dynamic_string from graph_copy_with_names, because the former requires dynamics.)