[librm] Add rm stack copying functions