diff --git a/changes/03-other/1365-asm-jasmin-version.md b/changes/03-other/1365-asm-jasmin-version.md new file mode 100644 index 000000000..6cf790ea5 --- /dev/null +++ b/changes/03-other/1365-asm-jasmin-version.md @@ -0,0 +1,3 @@ +- The assembly output of the compiler features an `.ident` directive including + the version of the compiler + ([PR #1365](https://github.com/jasmin-lang/jasmin/pull/1365)). diff --git a/compiler/src/AsmTargetBuilder.ml b/compiler/src/AsmTargetBuilder.ml index 22d8ad2d9..23622a2a2 100644 --- a/compiler/src/AsmTargetBuilder.ml +++ b/compiler/src/AsmTargetBuilder.ml @@ -110,11 +110,13 @@ module Make(Target : AsmTarget) : S let functions_head = pp_functions_decl asm.asm_funcs in let functions_body = pp_functions asm.asm_funcs in let data_segment = pp_data_segment asm.asm_globs asm.asm_glob_names in + let compiler_ident = Header (".ident", [Format.asprintf "\"%s\"" Glob_options.version_string]) in let stack_note_segment = if is_target_system_macos () then [] else [ Header (".section", [ "\".note.GNU-stack\""; "\"\""; "%progbits" ]); ] in - headers @ functions_head @ functions_body @ data_segment @ stack_note_segment + headers @ functions_head @ functions_body @ data_segment @ + compiler_ident :: stack_note_segment end