diff options
author | Ian Lance Taylor <ian@airs.com> | 1994-05-19 18:25:10 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1994-05-19 18:25:10 +0000 |
commit | 2a9fa50cd8ae5dc1e99056c9683bece549e0b68f (patch) | |
tree | d4a3dce560b126bc852e1b8cd1dabaa266b7ba2d /ld/lexsup.c | |
parent | 013dec1ad95ef067951314b9f1beb2fa53296a6f (diff) | |
download | gdb-2a9fa50cd8ae5dc1e99056c9683bece549e0b68f.zip gdb-2a9fa50cd8ae5dc1e99056c9683bece549e0b68f.tar.gz gdb-2a9fa50cd8ae5dc1e99056c9683bece549e0b68f.tar.bz2 |
Add support for ELF shared libraries.
* ld.h (ld_config_type): Add field dynamic_link.
* ldmain.c (main): Initialize config.dynamic_link to false. Warn
on attempts to use -r with -relax, -call_shared or -s.
* lexsup.c (longopts): Separate OPTION_CALL_SHARED from
OPTION_NON_SHARED. Add OPTION_IGNORE. Adjust macro values
accordingly. Add "dy" and "non_shared" options. Change "Qy" to
OPTION_IGNORE for now. Handle OPTION_CALL_SHARED and
OPTION_NON_SHARED by setting dynamic_link field accordingly.
Handle OPTION_IGNORE by ignoring it. Clear dynamic_link field for
-r and -Ur.
* ldfile.c (ldfile_open_file): If config.dynamic_link is true, try
opening a file with a .so extension first.
* emultempl/elf32.em: New file.
* emulparams/elf32_sparc.sh (TEXT_START_ADDR): Change to 0x10000.
(NONPAGED_TEXT_START_ADDR): Likewise.
(TEMPLATE_NAME): Define as elf32.
(DATA_PLT): Define.
* emulparams/elf_i386.sh (TEMPLATE_NAME): Define as elf32.
* scripttempl/elf.sc: Add placement for new dynamic sections.
Don't use CREATE_OBJECT_SYMBOLS. Define _etext, _edata and _end
outside of any section. Don't use ALIGN(8); just let one section
VMA follow another. Put .dynbss in .bss. Don't mention debugging
sections; they'll be handled correctly anyhow.
* Makefile.in (eelf_i386.c): Depend upon elf32.em, not generic.em.
Diffstat (limited to 'ld/lexsup.c')
-rw-r--r-- | ld/lexsup.c | 55 |
1 files changed, 32 insertions, 23 deletions
diff --git a/ld/lexsup.c b/ld/lexsup.c index 0b07e0f..a397574 100644 --- a/ld/lexsup.c +++ b/ld/lexsup.c @@ -57,50 +57,53 @@ parse_args (argc, argv) static struct option longopts[] = { #define OPTION_CALL_SHARED 150 +#define OPTION_NON_SHARED 151 {"call_shared", no_argument, NULL, OPTION_CALL_SHARED}, {"dc", no_argument, NULL, 'd'}, -#define OPTION_DEFSYM 151 +#define OPTION_DEFSYM 152 {"defsym", required_argument, NULL, OPTION_DEFSYM}, - {"dn", no_argument, NULL, OPTION_CALL_SHARED}, + {"dn", no_argument, NULL, OPTION_NON_SHARED}, {"dp", no_argument, NULL, 'd'}, -#define OPTION_EB 152 + {"dy", no_argument, NULL, OPTION_CALL_SHARED}, +#define OPTION_EB 153 {"EB", no_argument, NULL, OPTION_EB}, -#define OPTION_EL 153 +#define OPTION_EL 154 {"EL", no_argument, NULL, OPTION_EL}, {"format", required_argument, NULL, 'b'}, -#define OPTION_HELP 154 +#define OPTION_HELP 155 {"help", no_argument, NULL, OPTION_HELP}, -#define OPTION_MAP 155 +#define OPTION_MAP 156 {"Map", required_argument, NULL, OPTION_MAP}, -#define OPTION_NO_KEEP_MEMORY 156 +#define OPTION_NO_KEEP_MEMORY 157 {"no-keep-memory", no_argument, NULL, OPTION_NO_KEEP_MEMORY}, -#define OPTION_NOINHIBIT_EXEC 157 +#define OPTION_NOINHIBIT_EXEC 158 {"noinhibit-exec", no_argument, NULL, OPTION_NOINHIBIT_EXEC}, {"noinhibit_exec", no_argument, NULL, OPTION_NOINHIBIT_EXEC}, - {"non_shared", no_argument, NULL, OPTION_CALL_SHARED}, -#define OPTION_OFORMAT 158 + {"non_shared", no_argument, NULL, OPTION_NON_SHARED}, +#define OPTION_OFORMAT 159 {"oformat", required_argument, NULL, OPTION_OFORMAT}, - {"Qy", no_argument, NULL, OPTION_CALL_SHARED}, -#define OPTION_RELAX 159 +#define OPTION_IGNORE 160 + {"Qy", no_argument, NULL, OPTION_IGNORE}, +#define OPTION_RELAX 161 {"relax", no_argument, NULL, OPTION_RELAX}, -#define OPTION_RETAIN_SYMBOLS_FILE 160 +#define OPTION_RETAIN_SYMBOLS_FILE 162 {"retain-symbols-file", no_argument, NULL, OPTION_RETAIN_SYMBOLS_FILE}, -#define OPTION_SORT_COMMON 161 +#define OPTION_SORT_COMMON 163 {"sort-common", no_argument, NULL, OPTION_SORT_COMMON}, {"sort_common", no_argument, NULL, OPTION_SORT_COMMON}, -#define OPTION_STATS 162 +#define OPTION_STATS 164 {"stats", no_argument, NULL, OPTION_STATS}, -#define OPTION_TBSS 163 +#define OPTION_TBSS 165 {"Tbss", required_argument, NULL, OPTION_TBSS}, -#define OPTION_TDATA 164 +#define OPTION_TDATA 166 {"Tdata", required_argument, NULL, OPTION_TDATA}, -#define OPTION_TTEXT 165 +#define OPTION_TTEXT 167 {"Ttext", required_argument, NULL, OPTION_TTEXT}, -#define OPTION_UR 166 +#define OPTION_UR 168 {"Ur", no_argument, NULL, OPTION_UR}, -#define OPTION_VERSION 167 +#define OPTION_VERSION 169 {"version", no_argument, NULL, OPTION_VERSION}, -#define OPTION_WARN_COMMON 168 +#define OPTION_WARN_COMMON 170 {"warn-common", no_argument, NULL, OPTION_WARN_COMMON}, {NULL, no_argument, NULL, 0} }; @@ -124,6 +127,8 @@ parse_args (argc, argv) (char *) NULL); break; + case OPTION_IGNORE: + break; case 'A': ldfile_add_arch (optarg); break; @@ -139,7 +144,10 @@ parse_args (argc, argv) yyparse (); break; case OPTION_CALL_SHARED: - set_default_dirlist ((char *) longopts[longind].name); + config.dynamic_link = true; + break; + case OPTION_NON_SHARED: + config.dynamic_link = false; break; case 'd': command_line.force_common_definition = true; @@ -194,7 +202,6 @@ parse_args (argc, argv) /* Ignore. Was handled in a pre-parse. */ break; case OPTION_MAP: - write_map = true; config.map_filename = optarg; break; case 'N': @@ -229,6 +236,7 @@ parse_args (argc, argv) config.build_constructors = false; config.magic_demand_paged = false; config.text_read_only = false; + config.dynamic_link = false; break; case 'R': lang_add_input_file (optarg, @@ -275,6 +283,7 @@ parse_args (argc, argv) config.build_constructors = true; config.magic_demand_paged = false; config.text_read_only = false; + config.dynamic_link = false; break; case 'u': ldlang_add_undef (optarg); |