https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85380

            Bug ID: 85380
           Summary: gnatbind fails with small executable & restricted
                    runtime
           Product: gcc
           Version: 8.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: simon at pushface dot org
  Target Milestone: ---
              Host: x86_64-apple-darwin15
            Target: arm-eabi
             Build: x86_64-apple-darwin15

After following the change suggested in PR ada/66205 comment 14,
System.Suppress_Standard_Library set to False, I attempted to build a small
program and got the error

    b__generate_hard_fault.adb:62:44: "Parameters" not declared in "System"
    gprbind: compilation of binder generated file failed

This line is

      Default_Secondary_Stack_Size : System.Parameters.Size_Type;
      pragma Import (C, Default_Secondary_Stack_Size,
"__gnat_default_ss_size");

and in successful builds of other programs System.Parameters is withed (in the
spec; why not in the body?).

On investigating, I find that none of the units in the closure required the
secondary stack (the P lines didn’t contain 'SS'); this means that
Opt.Sec_Stack_Used is False.

The 'with System.Parameters;' line is generated at bindgen.adb:2286 if
Opt.Sec_Stack_Used is True.

If Suppress_Standard_Library_On_Target is False, the
'Default_Secondary_Stack_Size' line is generated unconditionally at
bindgen.adb:748.

Proposed solution: make generation of the 'with System.Parameters;' line
conditional on (Opt.Sec_Stack_Used or not Suppress_Standard_Library_On_Target).

Proposed alternative solution: make generation of the
'Default_Secondary_Stack_Size' and related lines at bindgen.adb:748 conditional
on Opt.Sec_Stack_Used. I think this would need a lot more thought to make sure
it was OK in all circumstances.

Reply via email to