From eb91665b4cae0e1824a25da81788bf486d109077 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Mon, 6 Dec 1993 08:55:06 +0000 Subject: [PATCH] * config/obj-som.c (obj_som_version): Pass version string to SOM BFD backend. (obj_som_copyright): New function. Much like obj_som_version. * config/tc-hppa.c (obj_copyright): Define as appropriate for SOM and ELF. (pa_copyright): Just a stub now. --- gas/ChangeLog | 8 ++++++ gas/config/obj-som.c | 64 ++++++++++++++++++++++++++++++++++++++++++-- gas/config/tc-hppa.c | 50 +++++++++++----------------------- 3 files changed, 85 insertions(+), 37 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 64f6dcf2c6..edad57ebc8 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,13 @@ Sun Dec 5 17:05:29 1993 Jeffrey A. Law (law@snake.cs.utah.edu) + * config/obj-som.c (obj_som_version): Pass version string to + SOM BFD backend. + (obj_som_copyright): New function. Much like obj_som_version. + + * config/tc-hppa.c (obj_copyright): Define as appropriate for + SOM and ELF. + (pa_copyright): Just a stub now. + * config/obj-som.c (obj_read_begin_hook): Delete unused function. * config/obj-som.h (obj_read_begin_hook): Provide dummy definition. (TARGET_SYMBOL_FIELDS): Delete. SOM isn't making use of them. diff --git a/gas/config/obj-som.c b/gas/config/obj-som.c index fd8943a9bc..a73dad33e8 100644 --- a/gas/config/obj-som.c +++ b/gas/config/obj-som.c @@ -32,24 +32,84 @@ const pseudo_typeS obj_pseudo_table[] = {NULL} }; -/* Handle a .version directive. FIXME. We just parse the .version - directive and throw away the results!. */ +static int version_seen = 0; +static int copyright_seen = 0; + +/* Handle a .version directive. */ void obj_som_version (unused) int unused; { + char *version, c; + + if (version_seen) + { + as_bad ("Only one .version pseudo-op per file!"); + ignore_rest_of_line (); + return; + } + SKIP_WHITESPACE (); if (*input_line_pointer == '\"') { + version = input_line_pointer; ++input_line_pointer; while (is_a_char (next_char_of_string ())) ; + c = *input_line_pointer; + *input_line_pointer = '\000'; } else { as_bad ("Expected quoted string"); + ignore_rest_of_line (); + return; } + + version_seen = 1; + bfd_som_attach_aux_hdr (stdoutput, VERSION_AUX_ID, version); + *input_line_pointer = c; + demand_empty_rest_of_line (); +} + +/* Handle a .copyright directive. This probably isn't complete, but + it's of dubious value anyway and (IMHO) not worth the time to finish. + If you care about copyright strings that much, you fix it. */ + +void +obj_som_copyright (unused) + int unused; +{ + char *copyright, c; + + if (copyright_seen) + { + as_bad ("Only one .copyright pseudo-op per file!"); + ignore_rest_of_line (); + return; + } + + SKIP_WHITESPACE (); + if (*input_line_pointer == '\"') + { + copyright = input_line_pointer; + ++input_line_pointer; + while (is_a_char (next_char_of_string ())) + ; + c = *input_line_pointer; + *input_line_pointer = '\000'; + } + else + { + as_bad ("Expected quoted string"); + ignore_rest_of_line (); + return; + } + + copyright_seen = 1; + bfd_som_attach_aux_hdr (stdoutput, COPYRIGHT_AUX_ID, copyright); + *input_line_pointer = c; demand_empty_rest_of_line (); } diff --git a/gas/config/tc-hppa.c b/gas/config/tc-hppa.c index 2c05654027..5fda66a2d9 100644 --- a/gas/config/tc-hppa.c +++ b/gas/config/tc-hppa.c @@ -52,8 +52,10 @@ typedef elf_symbol_type obj_symbol_type; /* How to generate a relocation. */ #define hppa_gen_reloc_type hppa_elf_gen_reloc_type -/* Who knows. */ +/* ELF objects can have versions, but apparently do not have anywhere + to store a copyright string. */ #define obj_version obj_elf_version +#define obj_copyright obj_elf_version /* Use space aliases. */ #define USE_ALIASES 1 @@ -73,8 +75,9 @@ static void hppa_tc_make_symextn_section PARAMS ((void)); /* Object file formats specify relocation types. */ typedef int reloc_type; -/* Who knows. */ +/* SOM objects can have both a version string and a copyright string. */ #define obj_version obj_som_version +#define obj_copyright obj_som_copyright /* Do not use space aliases. */ #define USE_ALIASES 0 @@ -4459,39 +4462,6 @@ pa_comm (unused) demand_empty_rest_of_line (); } -/* Process a .COPYRIGHT pseudo-op. */ - -static void -pa_copyright (unused) - int unused; -{ - char *name; - char c; - - SKIP_WHITESPACE (); - if (*input_line_pointer == '\"') - { - ++input_line_pointer; - name = input_line_pointer; - while ((c = next_char_of_string ()) >= 0) - ; - c = *input_line_pointer; - *input_line_pointer = '\0'; - *(input_line_pointer - 1) = '\0'; - { - /* FIXME. Not supported */ - abort (); - } - *input_line_pointer = c; - } - else - { - as_bad ("Expected \"-ed string"); - } - pa_undefine_label (); - demand_empty_rest_of_line (); -} - /* Process a .END pseudo-op. */ static void @@ -6176,6 +6146,16 @@ pa_version (unused) pa_undefine_label (); } +/* Handle a .COPYRIGHT pseudo-op. */ + +static void +pa_copyright (unused) + int unused; +{ + obj_copyright (0); + pa_undefine_label (); +} + /* Just like a normal cons, but when finished we have to undefine the latest space label. */ -- 2.34.1