From b81231b7865564f91e58e083ef2763ddec344603 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Mon, 17 Jun 1996 05:59:01 +0000 Subject: [PATCH] * config/tc-hppa.c (md_pseudo_table): Add ".level" pseudo op. (pa_level): New function. hpux10 gunk. --- gas/ChangeLog | 5 +++ gas/config/tc-hppa.c | 100 +++++++++++++++++++++++++++++++++---------- 2 files changed, 82 insertions(+), 23 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 50054e94601..86a4bfe74fc 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +Sun Jun 16 22:57:47 1996 Jeffrey A. Law + + * config/tc-hppa.c (md_pseudo_table): Add ".level" pseudo op. + (pa_level): New function. + Fri Jun 14 20:06:44 1996 Ian Lance Taylor * listing.c (listing_newline): Don't do anything if listing is 0. diff --git a/gas/config/tc-hppa.c b/gas/config/tc-hppa.c index 0dbf21a07c4..e518c6f5ebf 100644 --- a/gas/config/tc-hppa.c +++ b/gas/config/tc-hppa.c @@ -90,6 +90,14 @@ typedef som_symbol_type obj_symbol_type; #endif #endif +#ifndef R_N0SEL +#define R_N0SEL 0xd8 +#endif + +#ifndef R_N1SEL +#define R_N1SEL 0xd9 +#endif + /* Various structures and types used internally in tc-hppa.c. */ /* Unwind table and descriptor. FIXME: Sync this with GDB version. */ @@ -492,6 +500,7 @@ static void pa_type_args PARAMS ((symbolS *, int)); static void pa_import PARAMS ((int)); static void pa_label PARAMS ((int)); static void pa_leave PARAMS ((int)); +static void pa_level PARAMS ((int)); static void pa_origin PARAMS ((int)); static void pa_proc PARAMS ((int)); static void pa_procend PARAMS ((int)); @@ -609,6 +618,7 @@ const pseudo_typeS md_pseudo_table[] = {"label", pa_label, 0}, {"lcomm", pa_lcomm, 0}, {"leave", pa_leave, 0}, + {"level", pa_level, 0}, {"long", pa_cons, 4}, {"lsym", pa_lsym, 0}, {"nsubspa", pa_subspace, 1}, @@ -641,7 +651,7 @@ const pseudo_typeS md_pseudo_table[] = first line of the input file. This is because the compiler outputs #NO_APP at the beginning of its output. - Also note that '/*' will always start a comment. */ + Also note that C style comments will always work. */ const char line_comment_chars[] = "#"; /* This array holds the characters which act as line separators. */ @@ -981,8 +991,9 @@ static const struct selector_entry selector_table[] = /* pre-defined subsegments (subspaces) for the HPPA. */ #define SUBSEG_CODE 0 -#define SUBSEG_DATA 0 #define SUBSEG_LIT 1 +#define SUBSEG_MILLI 2 +#define SUBSEG_DATA 0 #define SUBSEG_BSS 2 #define SUBSEG_UNWIND 3 #define SUBSEG_GDB_STRINGS 0 @@ -993,6 +1004,7 @@ static struct default_subspace_dict pa_def_subspaces[] = {"$CODE$", 1, 1, 1, 0, 0, 0, 24, 0x2c, 0, 8, 0, 0, ".text", SUBSEG_CODE}, {"$DATA$", 1, 1, 0, 0, 0, 0, 24, 0x1f, 1, 8, 1, 1, ".data", SUBSEG_DATA}, {"$LIT$", 1, 1, 0, 0, 0, 0, 16, 0x2c, 0, 8, 0, 0, ".text", SUBSEG_LIT}, + {"$MILLICODE$", 1, 1, 0, 0, 0, 0, 8, 0x2c, 0, 8, 0, 0, ".text", SUBSEG_MILLI}, {"$BSS$", 1, 1, 0, 0, 0, 1, 80, 0x1f, 1, 8, 1, 1, ".bss", SUBSEG_BSS}, #ifdef OBJ_ELF {"$UNWIND$", 1, 1, 0, 0, 0, 0, 64, 0x2c, 0, 4, 0, 0, ".PARISC.unwind", SUBSEG_UNWIND}, @@ -2768,9 +2780,10 @@ tc_gen_reloc (section, fixp) relocs[i]->addend = fixp->fx_offset; } } + + done: #endif -done: return relocs; } @@ -2899,7 +2912,7 @@ md_apply_fix (fixP, valp) char *buf = fixP->fx_where + fixP->fx_frag->fr_literal; struct hppa_fix_struct *hppa_fixP; long new_val, result; - unsigned int w1, w2, w; + unsigned int w1, w2, w, resulti; hppa_fixP = (struct hppa_fix_struct *) fixP->tc_fix_data; /* SOM uses R_HPPA_ENTRY and R_HPPA_EXIT relocations which can @@ -2910,7 +2923,7 @@ md_apply_fix (fixP, valp) || fixP->fx_r_type == R_HPPA_EXIT || fixP->fx_r_type == R_HPPA_BEGIN_BRTAB || fixP->fx_r_type == R_HPPA_END_BRTAB) - return; + return 1; #endif /* There should have been an HPPA specific fixup associated @@ -2976,7 +2989,8 @@ md_apply_fix (fixP, valp) bfd_put_32 (stdoutput, bfd_get_32 (stdoutput, buf) & 0xffffc000, buf); - low_sign_unext (new_val, 14, &result); + low_sign_unext (new_val, 14, &resulti); + result = resulti; break; /* Handle all opcodes with the 'k' operand type. */ @@ -2987,7 +3001,8 @@ md_apply_fix (fixP, valp) bfd_put_32 (stdoutput, bfd_get_32 (stdoutput, buf) & 0xffe00000, buf); - dis_assemble_21 (new_val, &result); + dis_assemble_21 (new_val, &resulti); + result = resulti; break; /* Handle all the opcodes with the 'i' operand type. */ @@ -2998,20 +3013,21 @@ md_apply_fix (fixP, valp) bfd_put_32 (stdoutput, bfd_get_32 (stdoutput, buf) & 0xffff800, buf); - low_sign_unext (new_val, 11, &result); + low_sign_unext (new_val, 11, &resulti); + result = resulti; break; /* Handle all the opcodes with the 'w' operand type. */ case 12: - CHECK_FIELD (new_val, 8199, -8184, 0) + CHECK_FIELD (new_val, 8199, -8184, 0); /* Mask off 11 bits to be changed. */ - sign_unext ((new_val - 8) >> 2, 12, &result); + sign_unext ((new_val - 8) >> 2, 12, &resulti); bfd_put_32 (stdoutput, bfd_get_32 (stdoutput, buf) & 0xffffe002, buf); - dis_assemble_12 (result, &w1, &w); + dis_assemble_12 (resulti, &w1, &w); result = ((w1 << 2) | w); break; @@ -3023,8 +3039,8 @@ md_apply_fix (fixP, valp) bfd_put_32 (stdoutput, bfd_get_32 (stdoutput, buf) & 0xffe0e002, buf); - sign_unext ((new_val - 8) >> 2, 17, &result); - dis_assemble_17 (result, &w1, &w2, &w); + sign_unext ((new_val - 8) >> 2, 17, &resulti); + dis_assemble_17 (resulti, &w1, &w2, &w); result = ((w2 << 2) | (w1 << 16) | w); break; @@ -3035,18 +3051,18 @@ md_apply_fix (fixP, valp) default: as_bad ("Unknown relocation encountered in md_apply_fix."); - return; + return 0; } /* Insert the relocation. */ bfd_put_32 (stdoutput, bfd_get_32 (stdoutput, buf) | result, buf); - return; + return 1; } else { printf ("no hppa_fixup entry for this fixup (fixP = 0x%x, type = 0x%x)\n", (unsigned int) fixP, fixP->fx_r_type); - return; + return 0; } } @@ -3908,7 +3924,7 @@ pa_parse_nonneg_add_cmpltr (s, isbranch) ISBRANCH specifies whether or not this is parsing a condition completer for a branch (vs a nullification completer for a - computational instruction. */ + computational instruction). */ static int pa_parse_neg_add_cmpltr (s, isbranch) @@ -4845,6 +4861,35 @@ pa_leave (unused) abort (); } +/* Handle a .LEVEL pseudo-op. */ + +static void +pa_level (unused) + int unused; +{ + char *level; + + level = input_line_pointer; + if (strncmp (level, "1.0", 3) == 0) + { + input_line_pointer += 3; + if (!bfd_set_arch_mach (stdoutput, bfd_arch_hppa, 10)) + as_warn ("could not set architecture and machine"); + } + else if (strncmp (level, "1.1", 3) == 0) + { + input_line_pointer += 3; + if (!bfd_set_arch_mach (stdoutput, bfd_arch_hppa, 11)) + as_warn ("could not set architecture and machine"); + } + else + { + as_bad ("Unrecognized .LEVEL argument\n"); + ignore_rest_of_line (); + } + demand_empty_rest_of_line (); +} + /* Handle a .ORIGIN pseudo-op. */ static void @@ -5649,6 +5694,16 @@ pa_spaces_begin () | SEC_READONLY | SEC_HAS_CONTENTS)); } + else if (!strcmp (pa_def_subspaces[i].name, "$MILLICODE$") + && !USE_ALIASES) + { + applicable = bfd_applicable_section_flags (stdoutput); + bfd_set_section_flags (stdoutput, segment, + applicable & (SEC_ALLOC | SEC_LOAD + | SEC_RELOC + | SEC_READONLY + | SEC_HAS_CONTENTS)); + } else if (!strcmp (pa_def_subspaces[i].name, "$UNWIND$") && !USE_ALIASES) { applicable = bfd_applicable_section_flags (stdoutput); @@ -6299,12 +6354,11 @@ hppa_fix_adjustable (fixp) return 0; } - /* We can't adjust DP relative relocs that use LR% and RR% field - selectors. That confuses the optimization pass in HP linker. */ - if (fixp->fx_r_type == R_DP_RELATIVE - && (hppa_fix->fx_r_field == e_lrsel - || hppa_fix->fx_r_field == e_rrsel - || hppa_fix->fx_r_field == e_nlrsel)) + /* We can't adjust any relocs that use LR% and RR% field selectors. + That confuses the HP linker. */ + if (hppa_fix->fx_r_field == e_lrsel + || hppa_fix->fx_r_field == e_rrsel + || hppa_fix->fx_r_field == e_nlrsel) return 0; #endif -- 2.30.2