diff options
author | obrien <obrien@FreeBSD.org> | 2000-06-20 07:00:04 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2000-06-20 07:00:04 +0000 |
commit | a6accae28babdbc13d868c3e603ef00ff72a5855 (patch) | |
tree | db7cc9f75d1daeaee67ddf48735c4dfe32cd3fa7 /contrib | |
parent | 971a426ec2c4d61ba96ef580d4ecda8f7133b100 (diff) | |
download | FreeBSD-src-a6accae28babdbc13d868c3e603ef00ff72a5855.zip FreeBSD-src-a6accae28babdbc13d868c3e603ef00ff72a5855.tar.gz |
Use the stock file now. The Binutils maintainers accepted our rev 1.2
changes (don't use "/" to start a comment).
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/binutils/gas/config/tc-i386.c | 87 |
1 files changed, 45 insertions, 42 deletions
diff --git a/contrib/binutils/gas/config/tc-i386.c b/contrib/binutils/gas/config/tc-i386.c index 1c39080..7953327 100644 --- a/contrib/binutils/gas/config/tc-i386.c +++ b/contrib/binutils/gas/config/tc-i386.c @@ -145,7 +145,7 @@ const char extra_symbol_chars[] = "*%-("; /* This array holds the chars that always start a comment. If the pre-processor is disabled, these aren't very useful */ -#if defined (TE_I386AIX) || ((defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)) && ! defined (TE_LINUX) && !defined(TE_FreeBSD)) +#if defined (TE_I386AIX) || ((defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)) && !defined (TE_LINUX) && !defined(TE_FreeBSD)) /* Putting '/' here makes it impossible to use the divide operator. However, we need it for compatibility with SVR4 systems. */ const char comment_chars[] = "#/"; @@ -163,7 +163,7 @@ const char comment_chars[] = "#"; #NO_APP at the beginning of its output. */ /* Also note that comments started like this one will always work if '/' isn't otherwise defined. */ -#if defined (TE_I386AIX) || ((defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)) && ! defined (TE_LINUX) && !defined(TE_FreeBSD)) +#if defined (TE_I386AIX) || ((defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)) && !defined (TE_LINUX) && !defined(TE_FreeBSD)) const char line_comment_chars[] = ""; #else const char line_comment_chars[] = "/"; @@ -939,12 +939,11 @@ int tc_i386_fix_adjustable (fixP) fixS *fixP; { -#if defined (OBJ_ELF) || defined (TE_PE) +#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) || defined (TE_PE) /* Prevent all adjustments to global symbols, or else dynamic linking will not work correctly. */ - if (S_IS_EXTERN (fixP->fx_addsy)) - return 0; - if (S_IS_WEAK (fixP->fx_addsy)) + if (S_IS_EXTERNAL (fixP->fx_addsy) + || S_IS_WEAK (fixP->fx_addsy)) return 0; #endif /* adjust_reloc_syms doesn't know about the GOT */ @@ -2159,10 +2158,11 @@ md_assemble (line) if (prefix) *p++ = DATA_PREFIX_OPCODE; *p = i.tm.base_opcode; - /* 1 possible extra opcode + displacement go in fr_var. */ + /* 1 possible extra opcode + displacement go in var part. + Pass reloc in fr_var. */ frag_var (rs_machine_dependent, 1 + size, - 1, + i.disp_reloc[0], ((unsigned char) *p == JUMP_PC_RELATIVE ? ENCODE_RELAX_STATE (UNCOND_JUMP, SMALL) | code16 : ENCODE_RELAX_STATE (COND_JUMP, SMALL) | code16), @@ -3649,54 +3649,56 @@ i386_operand (operand_string) return 1; /* normal return */ } -/* - * md_estimate_size_before_relax() - * - * Called just before relax(). - * Any symbol that is now undefined will not become defined. - * Return the correct fr_subtype in the frag. - * Return the initial "guess for fr_var" to caller. - * The guess for fr_var is ACTUALLY the growth beyond fr_fix. - * Whatever we do to grow fr_fix or fr_var contributes to our returned value. - * Although it may not be explicit in the frag, pretend fr_var starts with a - * 0 value. - */ +/* md_estimate_size_before_relax() + + Called just before relax() for rs_machine_dependent frags. The x86 + assembler uses these frags to handle variable size jump + instructions. + + Any symbol that is now undefined will not become defined. + Return the correct fr_subtype in the frag. + Return the initial "guess for variable size of frag" to caller. + The guess is actually the growth beyond the fixed part. Whatever + we do to grow the fixed or variable part contributes to our + returned value. */ + int md_estimate_size_before_relax (fragP, segment) register fragS *fragP; register segT segment; { - register unsigned char *opcode; - register int old_fr_fix; - - old_fr_fix = fragP->fr_fix; - opcode = (unsigned char *) fragP->fr_opcode; /* We've already got fragP->fr_subtype right; all we have to do is - check for un-relaxable symbols. */ - if (S_GET_SEGMENT (fragP->fr_symbol) != segment) + check for un-relaxable symbols. On an ELF system, we can't relax + an externally visible symbol, because it may be overridden by a + shared library. */ + if (S_GET_SEGMENT (fragP->fr_symbol) != segment +#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) || defined (TE_PE) + || S_IS_EXTERNAL (fragP->fr_symbol) + || S_IS_WEAK (fragP->fr_symbol) +#endif + ) { - /* symbol is undefined in this segment */ - int code16 = fragP->fr_subtype & CODE16; - int size = code16 ? 2 : 4; + /* Symbol is undefined in this segment, or we need to keep a + reloc so that weak symbols can be overridden. */ + int size = (fragP->fr_subtype & CODE16) ? 2 : 4; #ifdef BFD_ASSEMBLER enum bfd_reloc_code_real reloc_type; #else int reloc_type; #endif + unsigned char *opcode; + int old_fr_fix; - if (GOT_symbol /* Not quite right - we should switch on presence of - @PLT, but I cannot see how to get to that from - here. We should have done this in md_assemble to - really get it right all of the time, but I think it - does not matter that much, as this will be right - most of the time. ERY */ - && S_GET_SEGMENT(fragP->fr_symbol) == undefined_section) - reloc_type = BFD_RELOC_386_PLT32; - else if (code16) + if (fragP->fr_var != NO_RELOC) + reloc_type = fragP->fr_var; + else if (size == 2) reloc_type = BFD_RELOC_16_PCREL; else reloc_type = BFD_RELOC_32_PCREL; + old_fr_fix = fragP->fr_fix; + opcode = (unsigned char *) fragP->fr_opcode; + switch (opcode[0]) { case JUMP_PC_RELATIVE: /* make jmp (0xeb) a dword displacement jump */ @@ -3721,10 +3723,11 @@ md_estimate_size_before_relax (fragP, segment) break; } frag_wane (fragP); + return fragP->fr_fix - old_fr_fix; } - return (fragP->fr_var + fragP->fr_fix - old_fr_fix); -} /* md_estimate_size_before_relax() */ - + return 1; /* Guess a short jump. */ +} + /* * md_convert_frag(); * |