| 1 | // script.h -- handle linker scripts for gold -*- C++ -*- |
| 2 | |
| 3 | // Copyright 2006, 2007 Free Software Foundation, Inc. |
| 4 | // Written by Ian Lance Taylor <iant@google.com>. |
| 5 | |
| 6 | // This file is part of gold. |
| 7 | |
| 8 | // This program is free software; you can redistribute it and/or modify |
| 9 | // it under the terms of the GNU General Public License as published by |
| 10 | // the Free Software Foundation; either version 3 of the License, or |
| 11 | // (at your option) any later version. |
| 12 | |
| 13 | // This program is distributed in the hope that it will be useful, |
| 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | // GNU General Public License for more details. |
| 17 | |
| 18 | // You should have received a copy of the GNU General Public License |
| 19 | // along with this program; if not, write to the Free Software |
| 20 | // Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
| 21 | // MA 02110-1301, USA. |
| 22 | |
| 23 | // We implement a subset of the original GNU ld linker script language |
| 24 | // for compatibility. The goal is not to implement the entire |
| 25 | // language. It is merely to implement enough to handle common uses. |
| 26 | // In particular we need to handle /usr/lib/libc.so on a typical |
| 27 | // GNU/Linux system, and we want to handle linker scripts used by the |
| 28 | // Linux kernel build. |
| 29 | |
| 30 | #ifndef GOLD_SCRIPT_H |
| 31 | #define GOLD_SCRIPT_H |
| 32 | |
| 33 | namespace gold |
| 34 | { |
| 35 | |
| 36 | class General_options; |
| 37 | class Command_line; |
| 38 | class Symbol_table; |
| 39 | class Layout; |
| 40 | class Input_argument; |
| 41 | class Input_objects; |
| 42 | class Input_group; |
| 43 | class Input_file; |
| 44 | class Task_token; |
| 45 | class Workqueue; |
| 46 | |
| 47 | // FILE was found as an argument on the command line, but was not |
| 48 | // recognized as an ELF file. Try to read it as a script. We've |
| 49 | // already read BYTES of data into P. Return true if the file was |
| 50 | // handled. This has to handle /usr/lib/libc.so on a GNU/Linux |
| 51 | // system. |
| 52 | |
| 53 | bool |
| 54 | read_input_script(Workqueue*, const General_options&, Symbol_table*, Layout*, |
| 55 | Dirsearch*, Input_objects*, Input_group*, |
| 56 | const Input_argument*, Input_file*, const unsigned char* p, |
| 57 | off_t bytes, Task_token* this_blocker, |
| 58 | Task_token* next_blocker); |
| 59 | |
| 60 | // FILE was found as an argument to --script (-T). |
| 61 | // Read it as a script, and execute its contents immediately. |
| 62 | |
| 63 | bool |
| 64 | read_commandline_script(const char* filename, Command_line*); |
| 65 | |
| 66 | } // End namespace gold. |
| 67 | |
| 68 | #endif // !defined(GOLD_SCRIPT_H) |