| 1 |
------------------------------------------------------------------------------ |
| 2 |
-- -- |
| 3 |
-- GNAT COMPILER COMPONENTS -- |
| 4 |
-- -- |
| 5 |
-- I N D E P S W -- |
| 6 |
-- -- |
| 7 |
-- S p e c -- |
| 8 |
-- -- |
| 9 |
-- Copyright (C) 2004-2025, Free Software Foundation, Inc. -- |
| 10 |
-- -- |
| 11 |
-- GNAT is free software; you can redistribute it and/or modify it under -- |
| 12 |
-- terms of the GNU General Public License as published by the Free Soft- -- |
| 13 |
-- ware Foundation; either version 3, or (at your option) any later ver- -- |
| 14 |
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- |
| 15 |
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- |
| 16 |
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- |
| 17 |
-- for more details. You should have received a copy of the GNU General -- |
| 18 |
-- Public License distributed with GNAT; see file COPYING3. If not, go to -- |
| 19 |
-- http://www.gnu.org/licenses for a complete copy of the license. -- |
| 20 |
-- -- |
| 21 |
-- GNAT was originally developed by the GNAT team at New York University. -- |
| 22 |
-- Extensive contributions were provided by Ada Core Technologies Inc. -- |
| 23 |
-- -- |
| 24 |
------------------------------------------------------------------------------ |
| 25 |
|
| 26 |
-- GNATLINK platform-independent switches |
| 27 |
|
| 28 |
-- Used to convert GNAT switches to their platform-dependent switch |
| 29 |
-- equivalent for the underlying linker. |
| 30 |
|
| 31 |
with System.OS_Lib; use System.OS_Lib; |
| 32 |
|
| 33 |
package Indepsw is |
| 34 |
|
| 35 |
type Switch_Kind is |
| 36 |
-- Independent switches currently supported |
| 37 |
|
| 38 |
(Map_File); |
| 39 |
-- Produce a map file. The path name of the map file to produce |
| 40 |
-- is given as an argument. |
| 41 |
|
| 42 |
procedure Convert |
| 43 |
(Switch : Switch_Kind; |
| 44 |
Argument : String; |
| 45 |
To : out String_List_Access); |
| 46 |
-- Convert Switch to the platform-dependent linker switch (with or without |
| 47 |
-- additional arguments) To. Issue a warning if Switch is not supported |
| 48 |
-- for the platform; in this case, To is set to null. |
| 49 |
|
| 50 |
function Is_Supported (Switch : Switch_Kind) return Boolean; |
| 51 |
-- Return True for each independent switch supported by the platform |
| 52 |
|
| 53 |
private |
| 54 |
-- Default warning messages when the switches are not supported by the |
| 55 |
-- implementation. These are in the spec so that the platform specific |
| 56 |
-- bodies do not need to redefine them. |
| 57 |
|
| 58 |
Map_File_Not_Supported : aliased String := |
| 59 |
"the underlying linker does not allow the output of a map file"; |
| 60 |
|
| 61 |
No_Support_For : constant array (Switch_Kind) of String_Access := |
| 62 |
(Map_File => Map_File_Not_Supported'Access); |
| 63 |
-- All implementations of procedure Convert should include a case |
| 64 |
-- statements with a "when others =>" choice that output the default |
| 65 |
-- warning message: |
| 66 |
|
| 67 |
-- case Switch is |
| 68 |
-- when ... => |
| 69 |
-- ... |
| 70 |
-- when others => |
| 71 |
-- Write_Str ("warning: "); |
| 72 |
-- Write_Line (No_Support_For (Switch).all); |
| 73 |
-- To := null; |
| 74 |
-- end case; |
| 75 |
|
| 76 |
end Indepsw; |