tc-s390.c (99461) | tc-s390.c (107492) |
---|---|
1/* tc-s390.c -- Assemble for the S390 2 Copyright 2000, 2001, 2002 Free Software Foundation, Inc. 3 Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). 4 5 This file is part of GAS, the GNU Assembler. 6 7 GAS is free software; you can redistribute it and/or modify 8 it under the terms of the GNU General Public License as published by 9 the Free Software Foundation; either version 2, or (at your option) 10 any later version. 11 12 GAS is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with GAS; see the file COPYING. If not, write to the Free 19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA | 1/* tc-s390.c -- Assemble for the S390 2 Copyright 2000, 2001, 2002 Free Software Foundation, Inc. 3 Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). 4 5 This file is part of GAS, the GNU Assembler. 6 7 GAS is free software; you can redistribute it and/or modify 8 it under the terms of the GNU General Public License as published by 9 the Free Software Foundation; either version 2, or (at your option) 10 any later version. 11 12 GAS is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with GAS; see the file COPYING. If not, write to the Free 19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA |
20 02111-1307, USA. */ | 20 02111-1307, USA. */ |
21 22#include <stdio.h> 23#include "as.h" 24#include "safe-ctype.h" 25#include "subsegs.h" 26#include "struc-symbol.h" 27 28#include "opcode/s390.h" --- 48 unchanged lines hidden (view full) --- 77static void s390_elf_cons PARAMS ((int)); 78static void s390_bss PARAMS ((int)); 79static void s390_insn PARAMS ((int)); 80static void s390_literals PARAMS ((int)); 81 82const pseudo_typeS md_pseudo_table[] = 83{ 84 { "align", s_align_bytes, 0 }, | 21 22#include <stdio.h> 23#include "as.h" 24#include "safe-ctype.h" 25#include "subsegs.h" 26#include "struc-symbol.h" 27 28#include "opcode/s390.h" --- 48 unchanged lines hidden (view full) --- 77static void s390_elf_cons PARAMS ((int)); 78static void s390_bss PARAMS ((int)); 79static void s390_insn PARAMS ((int)); 80static void s390_literals PARAMS ((int)); 81 82const pseudo_typeS md_pseudo_table[] = 83{ 84 { "align", s_align_bytes, 0 }, |
85 /* Pseudo-ops which must be defined. */ | 85 /* Pseudo-ops which must be defined. */ |
86 { "bss", s390_bss, 0 }, 87 { "insn", s390_insn, 0 }, 88 /* Pseudo-ops which must be overridden. */ 89 { "byte", s390_byte, 0 }, 90 { "short", s390_elf_cons, 2 }, 91 { "long", s390_elf_cons, 4 }, 92 { "quad", s390_elf_cons, 8 }, 93 { "ltorg", s390_literals, 0 }, --- 22 unchanged lines hidden (view full) --- 116 117 Each floating point register a has predefined name of the form: 118 f<reg_num> which has the value <reg_num>. 119 120 There are individual registers as well: 121 sp has the value 15 122 lit has the value 12 123 | 86 { "bss", s390_bss, 0 }, 87 { "insn", s390_insn, 0 }, 88 /* Pseudo-ops which must be overridden. */ 89 { "byte", s390_byte, 0 }, 90 { "short", s390_elf_cons, 2 }, 91 { "long", s390_elf_cons, 4 }, 92 { "quad", s390_elf_cons, 8 }, 93 { "ltorg", s390_literals, 0 }, --- 22 unchanged lines hidden (view full) --- 116 117 Each floating point register a has predefined name of the form: 118 f<reg_num> which has the value <reg_num>. 119 120 There are individual registers as well: 121 sp has the value 15 122 lit has the value 12 123 |
124 The table is sorted. Suitable for searching by a binary search. */ | 124 The table is sorted. Suitable for searching by a binary search. */ |
125 126static const struct pd_reg pre_defined_registers[] = 127{ 128 { "a0", 0 }, /* Access registers */ 129 { "a1", 1 }, 130 { "a10", 10 }, 131 { "a11", 11 }, 132 { "a12", 12 }, --- 174 unchanged lines hidden (view full) --- 307 308symbolS *GOT_symbol; /* Pre-defined "_GLOBAL_OFFSET_TABLE_" */ 309 310#ifndef WORKING_DOT_WORD 311const int md_short_jump_size = 4; 312const int md_long_jump_size = 4; 313#endif 314 | 125 126static const struct pd_reg pre_defined_registers[] = 127{ 128 { "a0", 0 }, /* Access registers */ 129 { "a1", 1 }, 130 { "a10", 10 }, 131 { "a11", 11 }, 132 { "a12", 12 }, --- 174 unchanged lines hidden (view full) --- 307 308symbolS *GOT_symbol; /* Pre-defined "_GLOBAL_OFFSET_TABLE_" */ 309 310#ifndef WORKING_DOT_WORD 311const int md_short_jump_size = 4; 312const int md_long_jump_size = 4; 313#endif 314 |
315CONST char *md_shortopts = "A:m:kVQ:"; | 315const char *md_shortopts = "A:m:kVQ:"; |
316struct option md_longopts[] = { 317 {NULL, no_argument, NULL, 0} 318}; 319size_t md_longopts_size = sizeof (md_longopts); 320 321/* Initialize the default opcode arch and word size from the default 322 architecture name. */ 323static void --- 231 unchanged lines hidden (view full) --- 555 } 556 /* val is ok, now restrict it to operand->bits bits. */ 557 uval = (addressT) val & ((((addressT) 1 << (operand->bits-1)) << 1) - 1); 558 } 559 else 560 { 561 addressT min, max; 562 | 316struct option md_longopts[] = { 317 {NULL, no_argument, NULL, 0} 318}; 319size_t md_longopts_size = sizeof (md_longopts); 320 321/* Initialize the default opcode arch and word size from the default 322 architecture name. */ 323static void --- 231 unchanged lines hidden (view full) --- 555 } 556 /* val is ok, now restrict it to operand->bits bits. */ 557 uval = (addressT) val & ((((addressT) 1 << (operand->bits-1)) << 1) - 1); 558 } 559 else 560 { 561 addressT min, max; 562 |
563 max = (((addressT) 1 << (operand->bits - 1))<<1) - 1; | 563 max = (((addressT) 1 << (operand->bits - 1)) << 1) - 1; |
564 min = (offsetT) 0; 565 uval = (addressT) val; 566 /* Length x in an instructions has real length x+1. */ 567 if (operand->flags & S390_OPERAND_LENGTH) 568 uval--; 569 /* Check for underflow / overflow. */ 570 if (uval < min || uval > max) 571 { --- 14 unchanged lines hidden (view full) --- 586 as_bad_where (file, line, err, buf, (int) min, (int) max); 587 return; 588 } 589 } 590 591 /* Insert fragments of the operand byte for byte. */ 592 offset = operand->shift + operand->bits; 593 uval <<= (-offset) & 7; | 564 min = (offsetT) 0; 565 uval = (addressT) val; 566 /* Length x in an instructions has real length x+1. */ 567 if (operand->flags & S390_OPERAND_LENGTH) 568 uval--; 569 /* Check for underflow / overflow. */ 570 if (uval < min || uval > max) 571 { --- 14 unchanged lines hidden (view full) --- 586 as_bad_where (file, line, err, buf, (int) min, (int) max); 587 return; 588 } 589 } 590 591 /* Insert fragments of the operand byte for byte. */ 592 offset = operand->shift + operand->bits; 593 uval <<= (-offset) & 7; |
594 insn += (offset - 1)/8; | 594 insn += (offset - 1) / 8; |
595 while (uval != 0) 596 { 597 *insn-- |= uval; 598 uval >>= 8; 599 } 600} 601 602/* Structure used to hold suffixes. */ --- 116 unchanged lines hidden (view full) --- 719static struct s390_lpe *lpe_free_list = NULL; 720static struct s390_lpe *lpe_list = NULL; 721static struct s390_lpe *lpe_list_tail = NULL; 722static symbolS *lp_sym = NULL; 723static int lp_count = 0; 724static int lpe_count = 0; 725 726static int | 595 while (uval != 0) 596 { 597 *insn-- |= uval; 598 uval >>= 8; 599 } 600} 601 602/* Structure used to hold suffixes. */ --- 116 unchanged lines hidden (view full) --- 719static struct s390_lpe *lpe_free_list = NULL; 720static struct s390_lpe *lpe_list = NULL; 721static struct s390_lpe *lpe_list_tail = NULL; 722static symbolS *lp_sym = NULL; 723static int lp_count = 0; 724static int lpe_count = 0; 725 726static int |
727s390_exp_compare(exp1, exp2) | 727s390_exp_compare (exp1, exp2) |
728 expressionS *exp1; 729 expressionS *exp2; 730{ 731 if (exp1->X_op != exp2->X_op) 732 return 0; 733 734 switch (exp1->X_op) 735 { --- 30 unchanged lines hidden (view full) --- 766 case O_ge: 767 case O_gt: 768 case O_logical_and: 769 case O_logical_or: 770 return (exp1->X_add_symbol == exp2->X_add_symbol) 771 && (exp1->X_op_symbol == exp2->X_op_symbol) 772 && (exp1->X_add_number == exp2->X_add_number); 773 default: | 728 expressionS *exp1; 729 expressionS *exp2; 730{ 731 if (exp1->X_op != exp2->X_op) 732 return 0; 733 734 switch (exp1->X_op) 735 { --- 30 unchanged lines hidden (view full) --- 766 case O_ge: 767 case O_gt: 768 case O_logical_and: 769 case O_logical_or: 770 return (exp1->X_add_symbol == exp2->X_add_symbol) 771 && (exp1->X_op_symbol == exp2->X_op_symbol) 772 && (exp1->X_add_number == exp2->X_add_number); 773 default: |
774 return 0; 775 } | 774 return 0; 775 } |
776} 777 778/* Test for @lit and if its present make an entry in the literal pool and 779 modify the current expression to be an offset into the literal pool. */ 780static elf_suffix_type 781s390_lit_suffix (str_p, exp_p, suffix) 782 char **str_p; 783 expressionS *exp_p; --- 63 unchanged lines hidden (view full) --- 847 } 848 } 849 } 850 else 851 { 852 /* Processing for 'normal' data types. */ 853 for (lpe = lpe_list; lpe != NULL; lpe = lpe->next) 854 if (lpe->nbytes == nbytes && lpe->reloc == reloc | 776} 777 778/* Test for @lit and if its present make an entry in the literal pool and 779 modify the current expression to be an offset into the literal pool. */ 780static elf_suffix_type 781s390_lit_suffix (str_p, exp_p, suffix) 782 char **str_p; 783 expressionS *exp_p; --- 63 unchanged lines hidden (view full) --- 847 } 848 } 849 } 850 else 851 { 852 /* Processing for 'normal' data types. */ 853 for (lpe = lpe_list; lpe != NULL; lpe = lpe->next) 854 if (lpe->nbytes == nbytes && lpe->reloc == reloc |
855 && s390_exp_compare(exp_p, &lpe->ex) != 0) | 855 && s390_exp_compare (exp_p, &lpe->ex) != 0) |
856 break; 857 } 858 859 if (lpe == NULL) 860 { 861 /* A new literal. */ 862 if (lpe_free_list != NULL) 863 { 864 lpe = lpe_free_list; 865 lpe_free_list = lpe_free_list->next; 866 } 867 else 868 { | 856 break; 857 } 858 859 if (lpe == NULL) 860 { 861 /* A new literal. */ 862 if (lpe_free_list != NULL) 863 { 864 lpe = lpe_free_list; 865 lpe_free_list = lpe_free_list->next; 866 } 867 else 868 { |
869 lpe = (struct s390_lpe *) xmalloc(sizeof (struct s390_lpe)); | 869 lpe = (struct s390_lpe *) xmalloc (sizeof (struct s390_lpe)); |
870 } 871 872 lpe->ex = *exp_p; 873 874 if (exp_p->X_op == O_big) 875 { 876 if (exp_p->X_add_number <= 0) 877 lpe->floatnum = generic_floating_point_number; 878 else if (exp_p->X_add_number <= 4) 879 memcpy (lpe->bignum, generic_bignum, | 870 } 871 872 lpe->ex = *exp_p; 873 874 if (exp_p->X_op == O_big) 875 { 876 if (exp_p->X_add_number <= 0) 877 lpe->floatnum = generic_floating_point_number; 878 else if (exp_p->X_add_number <= 4) 879 memcpy (lpe->bignum, generic_bignum, |
880 exp_p->X_add_number*sizeof (LITTLENUM_TYPE)); | 880 exp_p->X_add_number * sizeof (LITTLENUM_TYPE)); |
881 else 882 as_bad (_("Big number is too big")); 883 } 884 885 lpe->nbytes = nbytes; 886 lpe->reloc = reloc; 887 /* Literal pool name defined ? */ 888 if (lp_sym == NULL) 889 { 890 sprintf (tmp_name, ".L\001%i", lp_count); | 881 else 882 as_bad (_("Big number is too big")); 883 } 884 885 lpe->nbytes = nbytes; 886 lpe->reloc = reloc; 887 /* Literal pool name defined ? */ 888 if (lp_sym == NULL) 889 { 890 sprintf (tmp_name, ".L\001%i", lp_count); |
891 lp_sym = symbol_make(tmp_name); | 891 lp_sym = symbol_make (tmp_name); |
892 } 893 894 /* Make name for literal pool entry. */ 895 sprintf (tmp_name, ".L\001%i\002%i", lp_count, lpe_count); 896 lpe_count++; | 892 } 893 894 /* Make name for literal pool entry. */ 895 sprintf (tmp_name, ".L\001%i\002%i", lp_count, lpe_count); 896 lpe_count++; |
897 lpe->sym = symbol_make(tmp_name); | 897 lpe->sym = symbol_make (tmp_name); |
898 899 /* Add to literal pool list. */ 900 lpe->next = NULL; 901 if (lpe_list_tail != NULL) 902 { 903 lpe_list_tail->next = lpe; 904 lpe_list_tail = lpe; 905 } --- 73 unchanged lines hidden (view full) --- 979 else 980 as_bad (_("relocation not applicable")); 981 } 982 else 983 emit_expr (&exp, (unsigned int) nbytes); 984 } 985 while (*input_line_pointer++ == ','); 986 | 898 899 /* Add to literal pool list. */ 900 lpe->next = NULL; 901 if (lpe_list_tail != NULL) 902 { 903 lpe_list_tail->next = lpe; 904 lpe_list_tail = lpe; 905 } --- 73 unchanged lines hidden (view full) --- 979 else 980 as_bad (_("relocation not applicable")); 981 } 982 else 983 emit_expr (&exp, (unsigned int) nbytes); 984 } 985 while (*input_line_pointer++ == ','); 986 |
987 input_line_pointer--; /* Put terminator back into stream. */ | 987 input_line_pointer--; /* Put terminator back into stream. */ |
988 demand_empty_rest_of_line (); 989} 990 991/* We need to keep a list of fixups. We can't simply generate them as 992 we go, because that would require us to first create the frag, and 993 that would screw up references to ``.''. */ 994 995struct s390_fixup --- 18 unchanged lines hidden (view full) --- 1014 const unsigned char *opindex_ptr; 1015 elf_suffix_type suffix; 1016 bfd_reloc_code_real_type reloc; 1017 int skip_optional; 1018 int parentheses; 1019 char *f; 1020 int fc, i; 1021 | 988 demand_empty_rest_of_line (); 989} 990 991/* We need to keep a list of fixups. We can't simply generate them as 992 we go, because that would require us to first create the frag, and 993 that would screw up references to ``.''. */ 994 995struct s390_fixup --- 18 unchanged lines hidden (view full) --- 1014 const unsigned char *opindex_ptr; 1015 elf_suffix_type suffix; 1016 bfd_reloc_code_real_type reloc; 1017 int skip_optional; 1018 int parentheses; 1019 char *f; 1020 int fc, i; 1021 |
1022 while (ISSPACE (*str)) str++; | 1022 while (ISSPACE (*str)) 1023 str++; |
1023 1024 parentheses = 0; 1025 skip_optional = 0; 1026 1027 /* Gather the operands. */ 1028 fc = 0; 1029 for (opindex_ptr = opcode->operands; *opindex_ptr != 0; opindex_ptr++) 1030 { --- 11 unchanged lines hidden (view full) --- 1042 skip_optional = 0; 1043 continue; 1044 } 1045 1046 /* Gather the operand. */ 1047 hold = input_line_pointer; 1048 input_line_pointer = str; 1049 | 1024 1025 parentheses = 0; 1026 skip_optional = 0; 1027 1028 /* Gather the operands. */ 1029 fc = 0; 1030 for (opindex_ptr = opcode->operands; *opindex_ptr != 0; opindex_ptr++) 1031 { --- 11 unchanged lines hidden (view full) --- 1043 skip_optional = 0; 1044 continue; 1045 } 1046 1047 /* Gather the operand. */ 1048 hold = input_line_pointer; 1049 input_line_pointer = str; 1050 |
1050 if (! register_name (&ex)) /* parse the operand */ | 1051 /* Parse the operand. */ 1052 if (! register_name (&ex)) |
1051 expression (&ex); 1052 1053 str = input_line_pointer; 1054 input_line_pointer = hold; 1055 1056 /* Write the operand to the insn. */ 1057 if (ex.X_op == O_illegal) 1058 as_bad (_("illegal operand")); --- 333 unchanged lines hidden (view full) --- 1392 else 1393 as_bad (_("Invalid .insn format\n")); 1394 } 1395 else 1396 as_bad (_("second operand of .insn not a constant\n")); 1397 1398 if (strcmp (opformat->name, "e") != 0 && *input_line_pointer++ != ',') 1399 as_bad (_("missing comma after insn constant\n")); | 1053 expression (&ex); 1054 1055 str = input_line_pointer; 1056 input_line_pointer = hold; 1057 1058 /* Write the operand to the insn. */ 1059 if (ex.X_op == O_illegal) 1060 as_bad (_("illegal operand")); --- 333 unchanged lines hidden (view full) --- 1394 else 1395 as_bad (_("Invalid .insn format\n")); 1396 } 1397 else 1398 as_bad (_("second operand of .insn not a constant\n")); 1399 1400 if (strcmp (opformat->name, "e") != 0 && *input_line_pointer++ != ',') 1401 as_bad (_("missing comma after insn constant\n")); |
1400 | 1402 |
1401 if ((s = strchr (input_line_pointer, '\n')) != NULL) 1402 *s = '\0'; 1403 input_line_pointer = md_gather_operands (input_line_pointer, insn, 1404 opformat); 1405 if (s != NULL) 1406 *s = '\n'; 1407 demand_empty_rest_of_line (); 1408} --- 39 unchanged lines hidden (view full) --- 1448 1449static void 1450s390_literals (ignore) 1451 int ignore ATTRIBUTE_UNUSED; 1452{ 1453 struct s390_lpe *lpe; 1454 1455 if (lp_sym == NULL || lpe_count == 0) | 1403 if ((s = strchr (input_line_pointer, '\n')) != NULL) 1404 *s = '\0'; 1405 input_line_pointer = md_gather_operands (input_line_pointer, insn, 1406 opformat); 1407 if (s != NULL) 1408 *s = '\n'; 1409 demand_empty_rest_of_line (); 1410} --- 39 unchanged lines hidden (view full) --- 1450 1451static void 1452s390_literals (ignore) 1453 int ignore ATTRIBUTE_UNUSED; 1454{ 1455 struct s390_lpe *lpe; 1456 1457 if (lp_sym == NULL || lpe_count == 0) |
1456 return; /* nothing to be done */ | 1458 return; /* Nothing to be done. */ |
1457 1458 /* Emit symbol for start of literal pool. */ 1459 S_SET_SEGMENT (lp_sym, now_seg); 1460 S_SET_VALUE (lp_sym, (valueT) frag_now_fix ()); 1461 lp_sym->sy_frag = frag_now; 1462 1463 while (lpe_list) 1464 { --- 22 unchanged lines hidden (view full) --- 1487 else 1488 { 1489 if (lpe->ex.X_op == O_big) 1490 { 1491 if (lpe->ex.X_add_number <= 0) 1492 generic_floating_point_number = lpe->floatnum; 1493 else 1494 memcpy (generic_bignum, lpe->bignum, | 1459 1460 /* Emit symbol for start of literal pool. */ 1461 S_SET_SEGMENT (lp_sym, now_seg); 1462 S_SET_VALUE (lp_sym, (valueT) frag_now_fix ()); 1463 lp_sym->sy_frag = frag_now; 1464 1465 while (lpe_list) 1466 { --- 22 unchanged lines hidden (view full) --- 1489 else 1490 { 1491 if (lpe->ex.X_op == O_big) 1492 { 1493 if (lpe->ex.X_add_number <= 0) 1494 generic_floating_point_number = lpe->floatnum; 1495 else 1496 memcpy (generic_bignum, lpe->bignum, |
1495 lpe->ex.X_add_number*sizeof (LITTLENUM_TYPE)); | 1497 lpe->ex.X_add_number * sizeof (LITTLENUM_TYPE)); |
1496 } 1497 emit_expr (&lpe->ex, lpe->nbytes); 1498 } 1499 1500 lpe->next = lpe_free_list; 1501 lpe_free_list = lpe; 1502 } 1503 lpe_list_tail = NULL; --- 81 unchanged lines hidden (view full) --- 1585{ 1586 abort (); 1587} 1588 1589symbolS * 1590md_undefined_symbol (name) 1591 char *name; 1592{ | 1498 } 1499 emit_expr (&lpe->ex, lpe->nbytes); 1500 } 1501 1502 lpe->next = lpe_free_list; 1503 lpe_free_list = lpe; 1504 } 1505 lpe_list_tail = NULL; --- 81 unchanged lines hidden (view full) --- 1587{ 1588 abort (); 1589} 1590 1591symbolS * 1592md_undefined_symbol (name) 1593 char *name; 1594{ |
1593 if (*name == '_' && *(name+1) == 'G' | 1595 if (*name == '_' && *(name + 1) == 'G' |
1594 && strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0) | 1596 && strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0) |
1595 { 1596 if (!GOT_symbol) 1597 { 1598 if (symbol_find (name)) 1599 as_bad (_("GOT already in symbol table")); 1600 GOT_symbol = symbol_new (name, undefined_section, 1601 (valueT) 0, &zero_address_frag); 1602 } 1603 return GOT_symbol; 1604 } | 1597 { 1598 if (!GOT_symbol) 1599 { 1600 if (symbol_find (name)) 1601 as_bad (_("GOT already in symbol table")); 1602 GOT_symbol = symbol_new (name, undefined_section, 1603 (valueT) 0, &zero_address_frag); 1604 } 1605 return GOT_symbol; 1606 } |
1605 return 0; 1606} 1607 1608/* Functions concerning relocs. */ 1609 1610/* The location from which a PC relative jump should be calculated, 1611 given a PC relative reloc. */ 1612 --- 5 unchanged lines hidden (view full) --- 1618 return fixp->fx_frag->fr_address + fixp->fx_where; 1619} 1620 1621/* Here we decide which fixups can be adjusted to make them relative to 1622 the beginning of the section instead of the symbol. Basically we need 1623 to make sure that the dynamic relocations are done correctly, so in 1624 some cases we force the original symbol to be used. */ 1625int | 1607 return 0; 1608} 1609 1610/* Functions concerning relocs. */ 1611 1612/* The location from which a PC relative jump should be calculated, 1613 given a PC relative reloc. */ 1614 --- 5 unchanged lines hidden (view full) --- 1620 return fixp->fx_frag->fr_address + fixp->fx_where; 1621} 1622 1623/* Here we decide which fixups can be adjusted to make them relative to 1624 the beginning of the section instead of the symbol. Basically we need 1625 to make sure that the dynamic relocations are done correctly, so in 1626 some cases we force the original symbol to be used. */ 1627int |
1626tc_s390_fix_adjustable(fixP) 1627 fixS * fixP; | 1628tc_s390_fix_adjustable (fixP) 1629 fixS *fixP; |
1628{ 1629 /* Prevent all adjustments to global symbols. */ 1630 if (S_IS_EXTERN (fixP->fx_addsy)) 1631 return 0; 1632 if (S_IS_WEAK (fixP->fx_addsy)) 1633 return 0; | 1630{ 1631 /* Prevent all adjustments to global symbols. */ 1632 if (S_IS_EXTERN (fixP->fx_addsy)) 1633 return 0; 1634 if (S_IS_WEAK (fixP->fx_addsy)) 1635 return 0; |
1634 /* Don't adjust pc-relative references to merge sections. */ 1635 if ((S_GET_SEGMENT(fixP->fx_addsy)->flags & SEC_MERGE) != 0 1636 && fixP->fx_pcrel) | 1636 /* Don't adjust references to merge sections. */ 1637 if ((S_GET_SEGMENT (fixP->fx_addsy)->flags & SEC_MERGE) != 0) |
1637 return 0; 1638 /* adjust_reloc_syms doesn't know about the GOT. */ 1639 if ( fixP->fx_r_type == BFD_RELOC_32_GOTOFF 1640 || fixP->fx_r_type == BFD_RELOC_390_PLT16DBL 1641 || fixP->fx_r_type == BFD_RELOC_390_PLT32 1642 || fixP->fx_r_type == BFD_RELOC_390_PLT32DBL 1643 || fixP->fx_r_type == BFD_RELOC_390_PLT64 1644 || fixP->fx_r_type == BFD_RELOC_390_GOT12 --- 48 unchanged lines hidden (view full) --- 1693 1694void 1695md_apply_fix3 (fixP, valP, seg) 1696 fixS *fixP; 1697 valueT *valP; 1698 segT seg; 1699{ 1700 char *where; | 1638 return 0; 1639 /* adjust_reloc_syms doesn't know about the GOT. */ 1640 if ( fixP->fx_r_type == BFD_RELOC_32_GOTOFF 1641 || fixP->fx_r_type == BFD_RELOC_390_PLT16DBL 1642 || fixP->fx_r_type == BFD_RELOC_390_PLT32 1643 || fixP->fx_r_type == BFD_RELOC_390_PLT32DBL 1644 || fixP->fx_r_type == BFD_RELOC_390_PLT64 1645 || fixP->fx_r_type == BFD_RELOC_390_GOT12 --- 48 unchanged lines hidden (view full) --- 1694 1695void 1696md_apply_fix3 (fixP, valP, seg) 1697 fixS *fixP; 1698 valueT *valP; 1699 segT seg; 1700{ 1701 char *where; |
1701 valueT value = * valP; | 1702 valueT value = *valP; |
1702 1703 where = fixP->fx_frag->fr_literal + fixP->fx_where; 1704 | 1703 1704 where = fixP->fx_frag->fr_literal + fixP->fx_where; 1705 |
1705 if (fixP->fx_subsy != NULL) | 1706 if (fixP->fx_subsy != NULL) |
1706 { 1707 if ((fixP->fx_addsy != NULL 1708 && S_GET_SEGMENT (fixP->fx_addsy) == S_GET_SEGMENT (fixP->fx_subsy) 1709 && SEG_NORMAL (S_GET_SEGMENT (fixP->fx_addsy))) 1710 || (S_GET_SEGMENT (fixP->fx_subsy) == absolute_section)) 1711 value += S_GET_VALUE (fixP->fx_subsy); 1712 if (!S_IS_DEFINED (fixP->fx_subsy)) 1713 as_bad_where (fixP->fx_file, fixP->fx_line, 1714 _("unresolved fx_subsy symbol that must be resolved")); | 1707 { 1708 if ((fixP->fx_addsy != NULL 1709 && S_GET_SEGMENT (fixP->fx_addsy) == S_GET_SEGMENT (fixP->fx_subsy) 1710 && SEG_NORMAL (S_GET_SEGMENT (fixP->fx_addsy))) 1711 || (S_GET_SEGMENT (fixP->fx_subsy) == absolute_section)) 1712 value += S_GET_VALUE (fixP->fx_subsy); 1713 if (!S_IS_DEFINED (fixP->fx_subsy)) 1714 as_bad_where (fixP->fx_file, fixP->fx_line, 1715 _("unresolved fx_subsy symbol that must be resolved")); |
1715 value -= S_GET_VALUE(fixP->fx_subsy); | 1716 value -= S_GET_VALUE (fixP->fx_subsy); |
1716 1717 if (S_GET_SEGMENT (fixP->fx_subsy) == seg && ! fixP->fx_pcrel) 1718 value += MD_PCREL_FROM_SECTION (fixP, seg); 1719 } | 1717 1718 if (S_GET_SEGMENT (fixP->fx_subsy) == seg && ! fixP->fx_pcrel) 1719 value += MD_PCREL_FROM_SECTION (fixP, seg); 1720 } |
1720 1721 if (fixP->fx_addsy != NULL) | 1721 1722 if (fixP->fx_addsy != NULL) |
1722 { 1723 if ((fixP->fx_subsy != NULL 1724 && S_GET_SEGMENT (fixP->fx_addsy) == S_GET_SEGMENT (fixP->fx_subsy) | 1723 { 1724 if ((fixP->fx_subsy != NULL 1725 && S_GET_SEGMENT (fixP->fx_addsy) == S_GET_SEGMENT (fixP->fx_subsy) |
1725 && SEG_NORMAL (S_GET_SEGMENT(fixP->fx_addsy))) | 1726 && SEG_NORMAL (S_GET_SEGMENT (fixP->fx_addsy))) |
1726 || (S_GET_SEGMENT (fixP->fx_addsy) == seg 1727 && fixP->fx_pcrel && TC_RELOC_RTSYM_LOC_FIXUP (fixP)) | 1727 || (S_GET_SEGMENT (fixP->fx_addsy) == seg 1728 && fixP->fx_pcrel && TC_RELOC_RTSYM_LOC_FIXUP (fixP)) |
1728 || (!fixP->fx_pcrel | 1729 || (!fixP->fx_pcrel |
1729 && S_GET_SEGMENT (fixP->fx_addsy) == absolute_section) 1730 || (S_GET_SEGMENT (fixP->fx_addsy) != undefined_section 1731 && !bfd_is_com_section (S_GET_SEGMENT (fixP->fx_addsy)) | 1730 && S_GET_SEGMENT (fixP->fx_addsy) == absolute_section) 1731 || (S_GET_SEGMENT (fixP->fx_addsy) != undefined_section 1732 && !bfd_is_com_section (S_GET_SEGMENT (fixP->fx_addsy)) |
1732 && TC_FIX_ADJUSTABLE(fixP))) | 1733 && TC_FIX_ADJUSTABLE (fixP))) |
1733 value -= S_GET_VALUE (fixP->fx_addsy); 1734 1735 if (fixP->fx_pcrel) 1736 value += fixP->fx_frag->fr_address + fixP->fx_where; 1737 } 1738 else 1739 fixP->fx_done = 1; 1740 --- 219 unchanged lines hidden (view full) --- 1960 reloc = (arelent *) xmalloc (sizeof (arelent)); 1961 reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *)); 1962 *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy); 1963 reloc->address = fixp->fx_frag->fr_address + fixp->fx_where; 1964 reloc->howto = bfd_reloc_type_lookup (stdoutput, code); 1965 if (reloc->howto == NULL) 1966 { 1967 as_bad_where (fixp->fx_file, fixp->fx_line, | 1734 value -= S_GET_VALUE (fixP->fx_addsy); 1735 1736 if (fixP->fx_pcrel) 1737 value += fixP->fx_frag->fr_address + fixP->fx_where; 1738 } 1739 else 1740 fixP->fx_done = 1; 1741 --- 219 unchanged lines hidden (view full) --- 1961 reloc = (arelent *) xmalloc (sizeof (arelent)); 1962 reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *)); 1963 *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy); 1964 reloc->address = fixp->fx_frag->fr_address + fixp->fx_where; 1965 reloc->howto = bfd_reloc_type_lookup (stdoutput, code); 1966 if (reloc->howto == NULL) 1967 { 1968 as_bad_where (fixp->fx_file, fixp->fx_line, |
1968 _("cannot represent relocation type %s"), 1969 bfd_get_reloc_code_name (code)); | 1969 _("cannot represent relocation type %s"), 1970 bfd_get_reloc_code_name (code)); |
1970 /* Set howto to a garbage value so that we can keep going. */ 1971 reloc->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_32); 1972 assert (reloc->howto != NULL); 1973 } 1974 reloc->addend = fixp->fx_offset; 1975 1976 return reloc; 1977} | 1971 /* Set howto to a garbage value so that we can keep going. */ 1972 reloc->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_32); 1973 assert (reloc->howto != NULL); 1974 } 1975 reloc->addend = fixp->fx_offset; 1976 1977 return reloc; 1978} |