From 63722daa40aabf505c634d5cd88b03574f96dc70 Mon Sep 17 00:00:00 2001 From: xleroy Date: Fri, 2 May 2014 14:27:14 +0000 Subject: ARM: honor common variables. Changelog: update. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2475 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- Changelog | 4 +++- arm/PrintAsm.ml | 35 ++++++++++++++++++++++++----------- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/Changelog b/Changelog index d0f9172..edf327e 100644 --- a/Changelog +++ b/Changelog @@ -26,7 +26,9 @@ Usability: - Various tweaks in IRC graph coloring to reduce compilation time. Improvements in ABI conformance: -- IA32: revised handling of "common" variables to conform with ABI. +- New target platform: ARM with EABI "hard float" calling conventions + (armhf in Debian's classification). +- IA32 and ARM: revised handling of "common" variables to conform with ABI. Bug fixing: - In -fbitfields emulation: "a->f" was not properly rewritten if "a" diff --git a/arm/PrintAsm.ml b/arm/PrintAsm.ml index e1d5eaa..7e6827e 100644 --- a/arm/PrintAsm.ml +++ b/arm/PrintAsm.ml @@ -134,9 +134,9 @@ let subimm oc dst src n = (* Names of sections *) -let name_of_section_ELF = function +let name_of_section = function | Section_text -> ".text" - | Section_data i | Section_small_data i -> if i then ".data" else ".bss" + | Section_data i | Section_small_data i -> if i then ".data" else "COMM" | Section_const | Section_small_const -> ".section .rodata" | Section_string -> ".section .rodata" | Section_literal -> ".text" @@ -146,7 +146,7 @@ let name_of_section_ELF = function s (if wr then "w" else "") (if ex then "x" else "") let section oc sec = - fprintf oc " %s\n" (name_of_section_ELF sec) + fprintf oc " %s\n" (name_of_section sec) (* Record current code position and latest position at which to emit float and symbol constants. *) @@ -959,14 +959,27 @@ let print_var oc name v = | Some a -> a | None -> 8 (* 8-alignment is a safe default *) in - section oc sec; - fprintf oc " .balign %d\n" align; - if not (C2C.atom_is_static name) then - fprintf oc " .global %a\n" print_symb name; - fprintf oc "%a:\n" print_symb name; - print_init_data oc name v.gvar_init; - fprintf oc " .type %a, %%object\n" print_symb name; - fprintf oc " .size %a, . - %a\n" print_symb name print_symb name + let name_sec = + name_of_section sec in + if name_sec <> "COMM" then begin + fprintf oc " %s\n" name_sec; + fprintf oc " .balign %d\n" align; + if not (C2C.atom_is_static name) then + fprintf oc " .global %a\n" print_symb name; + fprintf oc "%a:\n" print_symb name; + print_init_data oc name v.gvar_init; + fprintf oc " .type %a, %%object\n" print_symb name; + fprintf oc " .size %a, . - %a\n" print_symb name print_symb name + end else begin + let sz = + match v.gvar_init with [Init_space sz] -> sz | _ -> assert false in + if C2C.atom_is_static name then + fprintf oc " .local %a\n" print_symb name; + fprintf oc " .comm %a, %s, %d\n" + print_symb name + (Z.to_string sz) + align + end let print_globdef oc (name, gdef) = match gdef with -- cgit v1.2.3