1999-05-03 15:29:11 +08:00
|
|
|
/* ehopt.c--optimize gcc exception frame information.
|
2024-01-04 19:52:08 +08:00
|
|
|
Copyright (C) 1998-2024 Free Software Foundation, Inc.
|
1999-05-03 15:29:11 +08:00
|
|
|
Written by Ian Lance Taylor <ian@cygnus.com>.
|
|
|
|
|
2007-07-03 19:01:12 +08:00
|
|
|
This file is part of GAS, the GNU Assembler.
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2007-07-03 19:01:12 +08:00
|
|
|
GAS is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 3, or (at your option)
|
|
|
|
any later version.
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2007-07-03 19:01:12 +08:00
|
|
|
GAS is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2007-07-03 19:01:12 +08:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with GAS; see the file COPYING. If not, write to the Free
|
|
|
|
Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
|
|
|
|
02110-1301, USA. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#include "as.h"
|
|
|
|
#include "subsegs.h"
|
|
|
|
|
|
|
|
/* We include this ELF file, even though we may not be assembling for
|
|
|
|
ELF, since the exception frame information is always in a format
|
|
|
|
derived from DWARF. */
|
|
|
|
|
2009-07-10 23:27:04 +08:00
|
|
|
#include "dwarf2.h"
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
/* Try to optimize gcc 2.8 exception frame information.
|
|
|
|
|
|
|
|
Exception frame information is emitted for every function in the
|
2000-11-18 08:13:28 +08:00
|
|
|
.eh_frame or .debug_frame sections. Simple information for a function
|
|
|
|
with no exceptions looks like this:
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
__FRAME_BEGIN__:
|
|
|
|
.4byte .LLCIE1 / Length of Common Information Entry
|
|
|
|
.LSCIE1:
|
2000-11-18 08:13:28 +08:00
|
|
|
#if .eh_frame
|
1999-05-03 15:29:11 +08:00
|
|
|
.4byte 0x0 / CIE Identifier Tag
|
2000-11-18 08:13:28 +08:00
|
|
|
#elif .debug_frame
|
|
|
|
.4byte 0xffffffff / CIE Identifier Tag
|
|
|
|
#endif
|
1999-05-03 15:29:11 +08:00
|
|
|
.byte 0x1 / CIE Version
|
|
|
|
.byte 0x0 / CIE Augmentation (none)
|
|
|
|
.byte 0x1 / ULEB128 0x1 (CIE Code Alignment Factor)
|
|
|
|
.byte 0x7c / SLEB128 -4 (CIE Data Alignment Factor)
|
|
|
|
.byte 0x8 / CIE RA Column
|
|
|
|
.byte 0xc / DW_CFA_def_cfa
|
|
|
|
.byte 0x4 / ULEB128 0x4
|
|
|
|
.byte 0x4 / ULEB128 0x4
|
|
|
|
.byte 0x88 / DW_CFA_offset, column 0x8
|
|
|
|
.byte 0x1 / ULEB128 0x1
|
|
|
|
.align 4
|
|
|
|
.LECIE1:
|
|
|
|
.set .LLCIE1,.LECIE1-.LSCIE1 / CIE Length Symbol
|
|
|
|
.4byte .LLFDE1 / FDE Length
|
|
|
|
.LSFDE1:
|
|
|
|
.4byte .LSFDE1-__FRAME_BEGIN__ / FDE CIE offset
|
|
|
|
.4byte .LFB1 / FDE initial location
|
|
|
|
.4byte .LFE1-.LFB1 / FDE address range
|
|
|
|
.byte 0x4 / DW_CFA_advance_loc4
|
|
|
|
.4byte .LCFI0-.LFB1
|
|
|
|
.byte 0xe / DW_CFA_def_cfa_offset
|
|
|
|
.byte 0x8 / ULEB128 0x8
|
|
|
|
.byte 0x85 / DW_CFA_offset, column 0x5
|
|
|
|
.byte 0x2 / ULEB128 0x2
|
|
|
|
.byte 0x4 / DW_CFA_advance_loc4
|
|
|
|
.4byte .LCFI1-.LCFI0
|
|
|
|
.byte 0xd / DW_CFA_def_cfa_register
|
|
|
|
.byte 0x5 / ULEB128 0x5
|
|
|
|
.byte 0x4 / DW_CFA_advance_loc4
|
|
|
|
.4byte .LCFI2-.LCFI1
|
|
|
|
.byte 0x2e / DW_CFA_GNU_args_size
|
|
|
|
.byte 0x4 / ULEB128 0x4
|
|
|
|
.byte 0x4 / DW_CFA_advance_loc4
|
|
|
|
.4byte .LCFI3-.LCFI2
|
|
|
|
.byte 0x2e / DW_CFA_GNU_args_size
|
|
|
|
.byte 0x0 / ULEB128 0x0
|
|
|
|
.align 4
|
|
|
|
.LEFDE1:
|
|
|
|
.set .LLFDE1,.LEFDE1-.LSFDE1 / FDE Length Symbol
|
|
|
|
|
|
|
|
The immediate issue we can address in the assembler is the
|
|
|
|
DW_CFA_advance_loc4 followed by a four byte value. The value is
|
|
|
|
the difference of two addresses in the function. Since gcc does
|
|
|
|
not know this value, it always uses four bytes. We will know the
|
|
|
|
value at the end of assembly, so we can do better. */
|
|
|
|
|
2001-05-15 06:37:47 +08:00
|
|
|
struct cie_info
|
|
|
|
{
|
|
|
|
unsigned code_alignment;
|
|
|
|
int z_augmentation;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Extract information from the CIE. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
static int
|
2003-11-23 00:03:03 +08:00
|
|
|
get_cie_info (struct cie_info *info)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
fragS *f;
|
|
|
|
fixS *fix;
|
2019-04-15 20:21:44 +08:00
|
|
|
unsigned int offset;
|
2000-11-18 08:13:28 +08:00
|
|
|
char CIE_id;
|
1999-05-03 15:29:11 +08:00
|
|
|
char augmentation[10];
|
|
|
|
int iaug;
|
2001-05-15 06:37:47 +08:00
|
|
|
int code_alignment = 0;
|
2000-11-18 08:13:28 +08:00
|
|
|
|
|
|
|
/* We should find the CIE at the start of the section. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
f = seg_info (now_seg)->frchainP->frch_root;
|
|
|
|
fix = seg_info (now_seg)->frchainP->fix_root;
|
|
|
|
|
|
|
|
/* Look through the frags of the section to find the code alignment. */
|
|
|
|
|
2000-11-18 08:13:28 +08:00
|
|
|
/* First make sure that the CIE Identifier Tag is 0/-1. */
|
|
|
|
|
2021-03-22 20:33:04 +08:00
|
|
|
if (startswith (segment_name (now_seg), ".debug_frame"))
|
2000-11-18 08:13:28 +08:00
|
|
|
CIE_id = (char)0xff;
|
|
|
|
else
|
|
|
|
CIE_id = 0;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
offset = 4;
|
|
|
|
while (f != NULL && offset >= f->fr_fix)
|
|
|
|
{
|
|
|
|
offset -= f->fr_fix;
|
|
|
|
f = f->fr_next;
|
|
|
|
}
|
|
|
|
if (f == NULL
|
|
|
|
|| f->fr_fix - offset < 4
|
2000-11-18 08:13:28 +08:00
|
|
|
|| f->fr_literal[offset] != CIE_id
|
|
|
|
|| f->fr_literal[offset + 1] != CIE_id
|
|
|
|
|| f->fr_literal[offset + 2] != CIE_id
|
|
|
|
|| f->fr_literal[offset + 3] != CIE_id)
|
2001-05-15 06:37:47 +08:00
|
|
|
return 0;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
/* Next make sure the CIE version number is 1. */
|
|
|
|
|
|
|
|
offset += 4;
|
|
|
|
while (f != NULL && offset >= f->fr_fix)
|
|
|
|
{
|
|
|
|
offset -= f->fr_fix;
|
|
|
|
f = f->fr_next;
|
|
|
|
}
|
|
|
|
if (f == NULL
|
|
|
|
|| f->fr_fix - offset < 1
|
|
|
|
|| f->fr_literal[offset] != 1)
|
2001-05-15 06:37:47 +08:00
|
|
|
return 0;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
/* Skip the augmentation (a null terminated string). */
|
|
|
|
|
|
|
|
iaug = 0;
|
|
|
|
++offset;
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
while (f != NULL && offset >= f->fr_fix)
|
|
|
|
{
|
|
|
|
offset -= f->fr_fix;
|
|
|
|
f = f->fr_next;
|
|
|
|
}
|
|
|
|
if (f == NULL)
|
2001-05-15 06:37:47 +08:00
|
|
|
return 0;
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
while (offset < f->fr_fix && f->fr_literal[offset] != '\0')
|
|
|
|
{
|
|
|
|
if ((size_t) iaug < (sizeof augmentation) - 1)
|
|
|
|
{
|
|
|
|
augmentation[iaug] = f->fr_literal[offset];
|
|
|
|
++iaug;
|
|
|
|
}
|
|
|
|
++offset;
|
|
|
|
}
|
|
|
|
if (offset < f->fr_fix)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
++offset;
|
|
|
|
while (f != NULL && offset >= f->fr_fix)
|
|
|
|
{
|
|
|
|
offset -= f->fr_fix;
|
|
|
|
f = f->fr_next;
|
|
|
|
}
|
|
|
|
if (f == NULL)
|
2001-05-15 06:37:47 +08:00
|
|
|
return 0;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
augmentation[iaug] = '\0';
|
|
|
|
if (augmentation[0] == '\0')
|
|
|
|
{
|
|
|
|
/* No augmentation. */
|
|
|
|
}
|
|
|
|
else if (strcmp (augmentation, "eh") == 0)
|
|
|
|
{
|
|
|
|
/* We have to skip a pointer. Unfortunately, we don't know how
|
|
|
|
large it is. We find out by looking for a matching fixup. */
|
|
|
|
while (fix != NULL
|
|
|
|
&& (fix->fx_frag != f || fix->fx_where != offset))
|
|
|
|
fix = fix->fx_next;
|
|
|
|
if (fix == NULL)
|
|
|
|
offset += 4;
|
|
|
|
else
|
|
|
|
offset += fix->fx_size;
|
|
|
|
while (f != NULL && offset >= f->fr_fix)
|
|
|
|
{
|
|
|
|
offset -= f->fr_fix;
|
|
|
|
f = f->fr_next;
|
|
|
|
}
|
|
|
|
if (f == NULL)
|
2001-05-15 06:37:47 +08:00
|
|
|
return 0;
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
2001-05-15 06:37:47 +08:00
|
|
|
else if (augmentation[0] != 'z')
|
|
|
|
return 0;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
/* We're now at the code alignment factor, which is a ULEB128. If
|
|
|
|
it isn't a single byte, forget it. */
|
|
|
|
|
|
|
|
code_alignment = f->fr_literal[offset] & 0xff;
|
2001-05-15 06:37:47 +08:00
|
|
|
if ((code_alignment & 0x80) != 0)
|
|
|
|
code_alignment = 0;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2001-05-15 06:37:47 +08:00
|
|
|
info->code_alignment = code_alignment;
|
|
|
|
info->z_augmentation = (augmentation[0] == 'z');
|
|
|
|
|
|
|
|
return 1;
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
|
|
|
|
2009-09-11 23:27:38 +08:00
|
|
|
enum frame_state
|
|
|
|
{
|
|
|
|
state_idle,
|
|
|
|
state_saw_size,
|
|
|
|
state_saw_cie_offset,
|
|
|
|
state_saw_pc_begin,
|
|
|
|
state_seeing_aug_size,
|
|
|
|
state_skipping_aug,
|
|
|
|
state_wait_loc4,
|
|
|
|
state_saw_loc4,
|
|
|
|
state_error,
|
|
|
|
};
|
|
|
|
|
2023-03-10 07:35:44 +08:00
|
|
|
struct frame_data
|
|
|
|
{
|
|
|
|
enum frame_state state;
|
|
|
|
|
|
|
|
int cie_info_ok;
|
|
|
|
struct cie_info cie_info;
|
|
|
|
|
|
|
|
symbolS *size_end_sym;
|
|
|
|
fragS *loc4_frag;
|
|
|
|
int loc4_fix;
|
|
|
|
|
|
|
|
int aug_size;
|
|
|
|
int aug_shift;
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct eh_state
|
|
|
|
{
|
|
|
|
struct frame_data eh_data;
|
|
|
|
struct frame_data debug_data;
|
|
|
|
} frame;
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
/* This function is called from emit_expr. It looks for cases which
|
|
|
|
we can optimize.
|
|
|
|
|
|
|
|
Rather than try to parse all this information as we read it, we
|
|
|
|
look for a single byte DW_CFA_advance_loc4 followed by a 4 byte
|
|
|
|
difference. We turn that into a rs_cfa_advance frag, and handle
|
|
|
|
those frags at the end of the assembly. If the gcc output changes
|
|
|
|
somewhat, this optimization may stop working.
|
|
|
|
|
|
|
|
This function returns non-zero if it handled the expression and
|
|
|
|
emit_expr should not do anything, or zero otherwise. It can also
|
|
|
|
change *EXP and *PNBYTES. */
|
|
|
|
|
|
|
|
int
|
2003-11-23 00:03:03 +08:00
|
|
|
check_eh_frame (expressionS *exp, unsigned int *pnbytes)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2000-11-18 08:13:28 +08:00
|
|
|
struct frame_data *d;
|
|
|
|
|
|
|
|
/* Don't optimize. */
|
|
|
|
if (flag_traditional_format)
|
|
|
|
return 0;
|
|
|
|
|
2007-11-07 01:15:10 +08:00
|
|
|
#ifdef md_allow_eh_opt
|
|
|
|
if (! md_allow_eh_opt)
|
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
|
2000-11-18 08:13:28 +08:00
|
|
|
/* Select the proper section data. */
|
2021-03-22 20:33:04 +08:00
|
|
|
if (startswith (segment_name (now_seg), ".eh_frame")
|
2011-04-26 23:28:08 +08:00
|
|
|
&& segment_name (now_seg)[9] != '_')
|
2023-03-10 07:35:44 +08:00
|
|
|
d = &frame.eh_data;
|
2021-03-22 20:33:04 +08:00
|
|
|
else if (startswith (segment_name (now_seg), ".debug_frame"))
|
2023-03-10 07:35:44 +08:00
|
|
|
d = &frame.debug_data;
|
2000-11-18 08:13:28 +08:00
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
|
2001-05-15 06:37:47 +08:00
|
|
|
if (d->state >= state_saw_size && S_IS_DEFINED (d->size_end_sym))
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
/* We have come to the end of the CIE or FDE. See below where
|
|
|
|
we set saw_size. We must check this first because we may now
|
|
|
|
be looking at the next size. */
|
2001-05-15 06:37:47 +08:00
|
|
|
d->state = state_idle;
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
|
|
|
|
2001-05-15 06:37:47 +08:00
|
|
|
switch (d->state)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2001-05-15 06:37:47 +08:00
|
|
|
case state_idle:
|
|
|
|
if (*pnbytes == 4)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2001-05-15 06:37:47 +08:00
|
|
|
/* This might be the size of the CIE or FDE. We want to know
|
|
|
|
the size so that we don't accidentally optimize across an FDE
|
|
|
|
boundary. We recognize the size in one of two forms: a
|
|
|
|
symbol which will later be defined as a difference, or a
|
|
|
|
subtraction of two symbols. Either way, we can tell when we
|
|
|
|
are at the end of the FDE because the symbol becomes defined
|
|
|
|
(in the case of a subtraction, the end symbol, from which the
|
|
|
|
start symbol is being subtracted). Other ways of describing
|
|
|
|
the size will not be optimized. */
|
|
|
|
if ((exp->X_op == O_symbol || exp->X_op == O_subtract)
|
|
|
|
&& ! S_IS_DEFINED (exp->X_add_symbol))
|
|
|
|
{
|
|
|
|
d->state = state_saw_size;
|
|
|
|
d->size_end_sym = exp->X_add_symbol;
|
|
|
|
}
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
2001-05-15 06:37:47 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case state_saw_size:
|
|
|
|
case state_saw_cie_offset:
|
|
|
|
/* Assume whatever form it appears in, it appears atomically. */
|
2009-09-11 23:27:38 +08:00
|
|
|
d->state = (enum frame_state) (d->state + 1);
|
2001-05-15 06:37:47 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case state_saw_pc_begin:
|
|
|
|
/* Decide whether we should see an augmentation. */
|
|
|
|
if (! d->cie_info_ok
|
|
|
|
&& ! (d->cie_info_ok = get_cie_info (&d->cie_info)))
|
|
|
|
d->state = state_error;
|
|
|
|
else if (d->cie_info.z_augmentation)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2001-05-15 06:37:47 +08:00
|
|
|
d->state = state_seeing_aug_size;
|
|
|
|
d->aug_size = 0;
|
|
|
|
d->aug_shift = 0;
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
2001-05-15 06:37:47 +08:00
|
|
|
else
|
|
|
|
d->state = state_wait_loc4;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case state_seeing_aug_size:
|
|
|
|
/* Bytes == -1 means this comes from an leb128 directive. */
|
|
|
|
if ((int)*pnbytes == -1 && exp->X_op == O_constant)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2001-05-15 06:37:47 +08:00
|
|
|
d->aug_size = exp->X_add_number;
|
|
|
|
d->state = state_skipping_aug;
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
2001-05-15 06:37:47 +08:00
|
|
|
else if (*pnbytes == 1 && exp->X_op == O_constant)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2001-05-15 06:37:47 +08:00
|
|
|
unsigned char byte = exp->X_add_number;
|
|
|
|
d->aug_size |= (byte & 0x7f) << d->aug_shift;
|
|
|
|
d->aug_shift += 7;
|
|
|
|
if ((byte & 0x80) == 0)
|
|
|
|
d->state = state_skipping_aug;
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
2001-05-15 06:37:47 +08:00
|
|
|
else
|
|
|
|
d->state = state_error;
|
2003-04-18 19:53:12 +08:00
|
|
|
if (d->state == state_skipping_aug && d->aug_size == 0)
|
|
|
|
d->state = state_wait_loc4;
|
2001-05-15 06:37:47 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case state_skipping_aug:
|
|
|
|
if ((int)*pnbytes < 0)
|
|
|
|
d->state = state_error;
|
|
|
|
else
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2002-05-18 20:53:30 +08:00
|
|
|
int left = (d->aug_size -= *pnbytes);
|
2001-05-15 06:37:47 +08:00
|
|
|
if (left == 0)
|
|
|
|
d->state = state_wait_loc4;
|
|
|
|
else if (left < 0)
|
|
|
|
d->state = state_error;
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
2001-05-15 06:37:47 +08:00
|
|
|
break;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2001-05-15 06:37:47 +08:00
|
|
|
case state_wait_loc4:
|
|
|
|
if (*pnbytes == 1
|
|
|
|
&& exp->X_op == O_constant
|
|
|
|
&& exp->X_add_number == DW_CFA_advance_loc4)
|
|
|
|
{
|
|
|
|
/* This might be a DW_CFA_advance_loc4. Record the frag and the
|
|
|
|
position within the frag, so that we can change it later. */
|
2023-08-10 10:21:40 +08:00
|
|
|
frag_grow (1 + 4);
|
2001-05-15 06:37:47 +08:00
|
|
|
d->state = state_saw_loc4;
|
|
|
|
d->loc4_frag = frag_now;
|
|
|
|
d->loc4_fix = frag_now_fix ();
|
|
|
|
}
|
|
|
|
break;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2001-05-15 06:37:47 +08:00
|
|
|
case state_saw_loc4:
|
|
|
|
d->state = state_wait_loc4;
|
|
|
|
if (*pnbytes != 4)
|
|
|
|
break;
|
|
|
|
if (exp->X_op == O_constant)
|
|
|
|
{
|
|
|
|
/* This is a case which we can optimize. The two symbols being
|
|
|
|
subtracted were in the same frag and the expression was
|
|
|
|
reduced to a constant. We can do the optimization entirely
|
|
|
|
in this function. */
|
2008-11-29 05:28:28 +08:00
|
|
|
if (exp->X_add_number < 0x40)
|
2001-05-15 06:37:47 +08:00
|
|
|
{
|
|
|
|
d->loc4_frag->fr_literal[d->loc4_fix]
|
2008-11-29 05:28:28 +08:00
|
|
|
= DW_CFA_advance_loc | exp->X_add_number;
|
2001-05-15 06:37:47 +08:00
|
|
|
/* No more bytes needed. */
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else if (exp->X_add_number < 0x100)
|
|
|
|
{
|
|
|
|
d->loc4_frag->fr_literal[d->loc4_fix] = DW_CFA_advance_loc1;
|
|
|
|
*pnbytes = 1;
|
|
|
|
}
|
|
|
|
else if (exp->X_add_number < 0x10000)
|
|
|
|
{
|
|
|
|
d->loc4_frag->fr_literal[d->loc4_fix] = DW_CFA_advance_loc2;
|
|
|
|
*pnbytes = 2;
|
|
|
|
}
|
|
|
|
}
|
2008-11-29 05:28:28 +08:00
|
|
|
else if (exp->X_op == O_subtract && d->cie_info.code_alignment == 1)
|
2001-05-15 06:37:47 +08:00
|
|
|
{
|
|
|
|
/* This is a case we can optimize. The expression was not
|
|
|
|
reduced, so we can not finish the optimization until the end
|
|
|
|
of the assembly. We set up a variant frag which we handle
|
|
|
|
later. */
|
2008-11-29 05:28:28 +08:00
|
|
|
frag_var (rs_cfa, 4, 0, 1 << 3, make_expr_symbol (exp),
|
2001-05-15 06:37:47 +08:00
|
|
|
d->loc4_fix, (char *) d->loc4_frag);
|
|
|
|
return 1;
|
|
|
|
}
|
2008-11-29 05:28:28 +08:00
|
|
|
else if ((exp->X_op == O_divide
|
|
|
|
|| exp->X_op == O_right_shift)
|
|
|
|
&& d->cie_info.code_alignment > 1)
|
|
|
|
{
|
Move struc-symbol.h to symbols.c
This file was never supposed to be widely used. The fact that it has
found its way into many gas files led to bugs, typically when code
expecting a symbolS* to point at a struct symbol is presented with a
struct local_symbol. Also, commit 158184ac9e changed these structs in
2012 but didn't catch all places where symbol bsym was being used to
test for a local_symbol.
* Makefile.am (HFILES): Delete struc-symbol.h.
* doc/internals.texi: Delete struc-symbol.h reference and out
of date local symbol description.
* struc-symbol.h: Delete. Move contents to..
* symbols.c: ..here.
(symbol_on_chain, symbol_symbolS): New functions.
* symbols.h (symbol_on_chain, symbol_symbolS): Declare.
* cgen.c: Don't #include struc-symbol.h.
(gas_cgen_parse_operand): Don't test for local_symbol using
bsym, instead call symbol_symbolS. Use symbol_get_bfdsym.
(weak_operand_overflow_check, make_right_shifted_expr): Use
symbol accessors.
* config/obj-coff.c: Don't #include struc-symbol.h.
(GET_FILENAME_STRING): Delete.
* config/obj-elf.c: Don't #include struc-symbol.h.
(elf_file_symbol): Use symbol accessors.
(elf_adjust_symtab): Call symbol_on_chain.
* config/obj-evax.c: Don't #include struc-symbol.h.
* config/tc-nds32.c: Likewise.
* config/tc-rl78.c: Likewise.
* config/tc-rx.c: Likewise.
* config/tc-alpha.c: Likewise.
(add_to_link_pool, s_alpha_comm): Use symbol accessors.
* config/tc-arc.c: Don't #include struc-symbol.h.
(arc_check_relocs): Use symbol accessors, testing gas symbol
section rather than bfd symbol section.
* config/tc-avr.c: Don't #include struc-symbol.h.
(avr_patch_gccisr_frag): Use symbol accessors.
* config/tc-bfin.c: Don't #include struc-symbol.h.
(bfin_loop_beginend): Use symbol accessors.
* config/tc-csky.c: Don't #include struc-symbol.h.
(v2_work_movih, v2_work_ori): Use symbol accessors. Check for
absolute symbol as well as O_constant.
* config/tc-riscv.c: Don't #include struc-symbol.h.
(riscv_pre_output_hook): Use symbol accessors.
* config/tc-s390.c: Don't #include struc-symbol.h.
(s390_literals): Use symbol accessors.
* config/tc-score.c (s3_build_la_pic, s3_build_lwst_pic): Use
symbol accessors.
(s3_relax_branch_inst16, s3_relax_cmpbranch_inst32): Don't
test symbol bsym.
* config/tc-score7.c: Don't #include struc-symbol.h.
(s7_build_la_pic, s7_build_lwst_pic): Use symbol accessors.
(s7_b32_relax_to_b16): Don't test symbol bsym.
* config/tc-sh.c: Don't #include struc-symbol.h.
(insert_loop_bounds): Use symbol accessors.
(sh_frob_section): Remove bogus symbol canonicalization.
* config/tc-tic54x.c: Don't #include struc-symbol.h.
(tic54x_bss): Use symbol accessors.
* config/tc-tilegx.c: Don't #include struc-symbol.h.
(emit_tilegx_instruction, tilegx_parse_name): Use symbol accessors.
* config/tc-tilepro.c: Don't #include struc-symbol.h.
(emit_tilepro_instruction, tilepro_parse_name): Use accessors.
* config/tc-xtensa.c: Don't #include struc-symbol.h.
(xg_assemble_vliw_tokens): Use symbol accessors.
(xg_order_trampoline_chain): Likewise.
* ehopt.c: Don't #include struc-symbol.h.
(check_eh_frame): Correct local symbol test. Use symbol accessors.
* write.c: Don't #include struc-symbol.h.
(create_note_reloc, maybe_generate_build_notes): Use symbol accessors.
* Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
2018-10-29 14:07:24 +08:00
|
|
|
if (symbol_symbolS (exp->X_add_symbol)
|
|
|
|
&& symbol_constant_p (exp->X_op_symbol)
|
|
|
|
&& S_GET_SEGMENT (exp->X_op_symbol) == absolute_section
|
2008-11-29 05:28:28 +08:00
|
|
|
&& ((exp->X_op == O_divide
|
Move struc-symbol.h to symbols.c
This file was never supposed to be widely used. The fact that it has
found its way into many gas files led to bugs, typically when code
expecting a symbolS* to point at a struct symbol is presented with a
struct local_symbol. Also, commit 158184ac9e changed these structs in
2012 but didn't catch all places where symbol bsym was being used to
test for a local_symbol.
* Makefile.am (HFILES): Delete struc-symbol.h.
* doc/internals.texi: Delete struc-symbol.h reference and out
of date local symbol description.
* struc-symbol.h: Delete. Move contents to..
* symbols.c: ..here.
(symbol_on_chain, symbol_symbolS): New functions.
* symbols.h (symbol_on_chain, symbol_symbolS): Declare.
* cgen.c: Don't #include struc-symbol.h.
(gas_cgen_parse_operand): Don't test for local_symbol using
bsym, instead call symbol_symbolS. Use symbol_get_bfdsym.
(weak_operand_overflow_check, make_right_shifted_expr): Use
symbol accessors.
* config/obj-coff.c: Don't #include struc-symbol.h.
(GET_FILENAME_STRING): Delete.
* config/obj-elf.c: Don't #include struc-symbol.h.
(elf_file_symbol): Use symbol accessors.
(elf_adjust_symtab): Call symbol_on_chain.
* config/obj-evax.c: Don't #include struc-symbol.h.
* config/tc-nds32.c: Likewise.
* config/tc-rl78.c: Likewise.
* config/tc-rx.c: Likewise.
* config/tc-alpha.c: Likewise.
(add_to_link_pool, s_alpha_comm): Use symbol accessors.
* config/tc-arc.c: Don't #include struc-symbol.h.
(arc_check_relocs): Use symbol accessors, testing gas symbol
section rather than bfd symbol section.
* config/tc-avr.c: Don't #include struc-symbol.h.
(avr_patch_gccisr_frag): Use symbol accessors.
* config/tc-bfin.c: Don't #include struc-symbol.h.
(bfin_loop_beginend): Use symbol accessors.
* config/tc-csky.c: Don't #include struc-symbol.h.
(v2_work_movih, v2_work_ori): Use symbol accessors. Check for
absolute symbol as well as O_constant.
* config/tc-riscv.c: Don't #include struc-symbol.h.
(riscv_pre_output_hook): Use symbol accessors.
* config/tc-s390.c: Don't #include struc-symbol.h.
(s390_literals): Use symbol accessors.
* config/tc-score.c (s3_build_la_pic, s3_build_lwst_pic): Use
symbol accessors.
(s3_relax_branch_inst16, s3_relax_cmpbranch_inst32): Don't
test symbol bsym.
* config/tc-score7.c: Don't #include struc-symbol.h.
(s7_build_la_pic, s7_build_lwst_pic): Use symbol accessors.
(s7_b32_relax_to_b16): Don't test symbol bsym.
* config/tc-sh.c: Don't #include struc-symbol.h.
(insert_loop_bounds): Use symbol accessors.
(sh_frob_section): Remove bogus symbol canonicalization.
* config/tc-tic54x.c: Don't #include struc-symbol.h.
(tic54x_bss): Use symbol accessors.
* config/tc-tilegx.c: Don't #include struc-symbol.h.
(emit_tilegx_instruction, tilegx_parse_name): Use symbol accessors.
* config/tc-tilepro.c: Don't #include struc-symbol.h.
(emit_tilepro_instruction, tilepro_parse_name): Use accessors.
* config/tc-xtensa.c: Don't #include struc-symbol.h.
(xg_assemble_vliw_tokens): Use symbol accessors.
(xg_order_trampoline_chain): Likewise.
* ehopt.c: Don't #include struc-symbol.h.
(check_eh_frame): Correct local symbol test. Use symbol accessors.
* write.c: Don't #include struc-symbol.h.
(create_note_reloc, maybe_generate_build_notes): Use symbol accessors.
* Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
2018-10-29 14:07:24 +08:00
|
|
|
? *symbol_X_add_number (exp->X_op_symbol)
|
|
|
|
: (offsetT) 1 << *symbol_X_add_number (exp->X_op_symbol))
|
2008-11-29 05:28:28 +08:00
|
|
|
== (offsetT) d->cie_info.code_alignment))
|
|
|
|
{
|
Move struc-symbol.h to symbols.c
This file was never supposed to be widely used. The fact that it has
found its way into many gas files led to bugs, typically when code
expecting a symbolS* to point at a struct symbol is presented with a
struct local_symbol. Also, commit 158184ac9e changed these structs in
2012 but didn't catch all places where symbol bsym was being used to
test for a local_symbol.
* Makefile.am (HFILES): Delete struc-symbol.h.
* doc/internals.texi: Delete struc-symbol.h reference and out
of date local symbol description.
* struc-symbol.h: Delete. Move contents to..
* symbols.c: ..here.
(symbol_on_chain, symbol_symbolS): New functions.
* symbols.h (symbol_on_chain, symbol_symbolS): Declare.
* cgen.c: Don't #include struc-symbol.h.
(gas_cgen_parse_operand): Don't test for local_symbol using
bsym, instead call symbol_symbolS. Use symbol_get_bfdsym.
(weak_operand_overflow_check, make_right_shifted_expr): Use
symbol accessors.
* config/obj-coff.c: Don't #include struc-symbol.h.
(GET_FILENAME_STRING): Delete.
* config/obj-elf.c: Don't #include struc-symbol.h.
(elf_file_symbol): Use symbol accessors.
(elf_adjust_symtab): Call symbol_on_chain.
* config/obj-evax.c: Don't #include struc-symbol.h.
* config/tc-nds32.c: Likewise.
* config/tc-rl78.c: Likewise.
* config/tc-rx.c: Likewise.
* config/tc-alpha.c: Likewise.
(add_to_link_pool, s_alpha_comm): Use symbol accessors.
* config/tc-arc.c: Don't #include struc-symbol.h.
(arc_check_relocs): Use symbol accessors, testing gas symbol
section rather than bfd symbol section.
* config/tc-avr.c: Don't #include struc-symbol.h.
(avr_patch_gccisr_frag): Use symbol accessors.
* config/tc-bfin.c: Don't #include struc-symbol.h.
(bfin_loop_beginend): Use symbol accessors.
* config/tc-csky.c: Don't #include struc-symbol.h.
(v2_work_movih, v2_work_ori): Use symbol accessors. Check for
absolute symbol as well as O_constant.
* config/tc-riscv.c: Don't #include struc-symbol.h.
(riscv_pre_output_hook): Use symbol accessors.
* config/tc-s390.c: Don't #include struc-symbol.h.
(s390_literals): Use symbol accessors.
* config/tc-score.c (s3_build_la_pic, s3_build_lwst_pic): Use
symbol accessors.
(s3_relax_branch_inst16, s3_relax_cmpbranch_inst32): Don't
test symbol bsym.
* config/tc-score7.c: Don't #include struc-symbol.h.
(s7_build_la_pic, s7_build_lwst_pic): Use symbol accessors.
(s7_b32_relax_to_b16): Don't test symbol bsym.
* config/tc-sh.c: Don't #include struc-symbol.h.
(insert_loop_bounds): Use symbol accessors.
(sh_frob_section): Remove bogus symbol canonicalization.
* config/tc-tic54x.c: Don't #include struc-symbol.h.
(tic54x_bss): Use symbol accessors.
* config/tc-tilegx.c: Don't #include struc-symbol.h.
(emit_tilegx_instruction, tilegx_parse_name): Use symbol accessors.
* config/tc-tilepro.c: Don't #include struc-symbol.h.
(emit_tilepro_instruction, tilepro_parse_name): Use accessors.
* config/tc-xtensa.c: Don't #include struc-symbol.h.
(xg_assemble_vliw_tokens): Use symbol accessors.
(xg_order_trampoline_chain): Likewise.
* ehopt.c: Don't #include struc-symbol.h.
(check_eh_frame): Correct local symbol test. Use symbol accessors.
* write.c: Don't #include struc-symbol.h.
(create_note_reloc, maybe_generate_build_notes): Use symbol accessors.
* Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
2018-10-29 14:07:24 +08:00
|
|
|
expressionS *symval;
|
|
|
|
|
|
|
|
symval = symbol_get_value_expression (exp->X_add_symbol);
|
|
|
|
if (symval->X_op == O_subtract)
|
|
|
|
{
|
|
|
|
/* This is a case we can optimize as well. The
|
|
|
|
expression was not reduced, so we can not finish
|
|
|
|
the optimization until the end of the assembly.
|
|
|
|
We set up a variant frag which we handle later. */
|
|
|
|
frag_var (rs_cfa, 4, 0, d->cie_info.code_alignment << 3,
|
|
|
|
make_expr_symbol (symval),
|
|
|
|
d->loc4_fix, (char *) d->loc4_frag);
|
|
|
|
return 1;
|
|
|
|
}
|
2008-11-29 05:28:28 +08:00
|
|
|
}
|
|
|
|
}
|
2001-05-15 06:37:47 +08:00
|
|
|
break;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2001-05-15 06:37:47 +08:00
|
|
|
case state_error:
|
|
|
|
/* Just skipping everything. */
|
|
|
|
break;
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The function estimates the size of a rs_cfa variant frag based on
|
|
|
|
the current values of the symbols. It is called before the
|
2001-05-15 06:37:47 +08:00
|
|
|
relaxation loop. We set fr_subtype{0:2} to the expected length. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
int
|
2003-11-23 00:03:03 +08:00
|
|
|
eh_frame_estimate_size_before_relax (fragS *frag)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
offsetT diff;
|
2001-05-15 06:37:47 +08:00
|
|
|
int ca = frag->fr_subtype >> 3;
|
1999-05-03 15:29:11 +08:00
|
|
|
int ret;
|
|
|
|
|
2001-05-22 18:23:50 +08:00
|
|
|
diff = resolve_symbol_value (frag->fr_symbol);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
* gas/app, gas/as.c, gas/as.h, gas/atof-generic.c, gas/cgen.c,
gas/config/atof-ieee.c, gas/config/obj-aout.c,
gas/config/obj-coff.c, gas/config/obj-ecoff.c,
gas/config/obj-elf.c, gas/config/obj-som.c, gas/config/tc-alpha.c,
gas/config/tc-arc.c, gas/config/tc-arm.c, gas/config/tc-cr16.c,
gas/config/tc-cris.c, gas/config/tc-crx.c, gas/config/tc-d30v.c,
gas/config/tc-dlx.c, gas/config/tc-hppa.c, gas/config/tc-i370.c,
gas/config/tc-i386-intel.c, gas/config/tc-i386.c,
gas/config/tc-i860.c, gas/config/tc-i960.c, gas/config/tc-ia64.c,
gas/config/tc-iq2000.c, gas/config/tc-m32c.c,
gas/config/tc-m32r.c, gas/config/tc-m68hc11.c,
gas/config/tc-m68k.c, gas/config/tc-maxq.c, gas/config/tc-mcore.c,
gas/config/tc-mep.c, gas/config/tc-mips.c, gas/config/tc-mmix.c,
gas/config/tc-mn10300.c, gas/config/tc-moxie.c,
gas/config/tc-ns32k.c, gas/config/tc-pj.c, gas/config/tc-ppc.c,
gas/config/tc-s390.c, gas/config/tc-score.c,
gas/config/tc-score7.c, gas/config/tc-sh.c, gas/config/tc-sparc.c,
gas/config/tc-spu.c, gas/config/tc-tic30.c, gas/config/tc-vax.c,
gas/config/tc-xtensa.c, gas/config/xtensa-relax.c,
gas/dw2gencfi.c, gas/dwarf2dbg.c, gas/ehopt.c, gas/expr.c,
gas/frags.c, gas/input-file.c, gas/read.c, gas/sb.c,
gas/subsegs.c, gas/symbols.c, gas/write.c: Change the name of the
gas macro `assert' to `gas_assert'.
2009-06-23 01:56:02 +08:00
|
|
|
gas_assert (ca > 0);
|
2008-11-29 05:28:28 +08:00
|
|
|
diff /= ca;
|
2019-10-26 16:08:26 +08:00
|
|
|
if (diff == 0)
|
|
|
|
ret = -1;
|
|
|
|
else if (diff < 0x40)
|
1999-05-03 15:29:11 +08:00
|
|
|
ret = 0;
|
|
|
|
else if (diff < 0x100)
|
|
|
|
ret = 1;
|
|
|
|
else if (diff < 0x10000)
|
|
|
|
ret = 2;
|
|
|
|
else
|
|
|
|
ret = 4;
|
|
|
|
|
2019-10-26 16:08:26 +08:00
|
|
|
frag->fr_subtype = (frag->fr_subtype & ~7) | (ret & 7);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This function relaxes a rs_cfa variant frag based on the current
|
2001-05-15 06:37:47 +08:00
|
|
|
values of the symbols. fr_subtype{0:2} is the current length of
|
|
|
|
the frag. This returns the change in frag length. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
int
|
2003-11-23 00:03:03 +08:00
|
|
|
eh_frame_relax_frag (fragS *frag)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
int oldsize, newsize;
|
|
|
|
|
2001-05-15 06:37:47 +08:00
|
|
|
oldsize = frag->fr_subtype & 7;
|
2019-10-26 16:08:26 +08:00
|
|
|
if (oldsize == 7)
|
|
|
|
oldsize = -1;
|
1999-05-03 15:29:11 +08:00
|
|
|
newsize = eh_frame_estimate_size_before_relax (frag);
|
|
|
|
return newsize - oldsize;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This function converts a rs_cfa variant frag into a normal fill
|
|
|
|
frag. This is called after all relaxation has been done.
|
2001-05-15 06:37:47 +08:00
|
|
|
fr_subtype{0:2} will be the desired length of the frag. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
void
|
2003-11-23 00:03:03 +08:00
|
|
|
eh_frame_convert_frag (fragS *frag)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
offsetT diff;
|
|
|
|
fragS *loc4_frag;
|
2008-11-29 05:28:28 +08:00
|
|
|
int loc4_fix, ca;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
loc4_frag = (fragS *) frag->fr_opcode;
|
|
|
|
loc4_fix = (int) frag->fr_offset;
|
|
|
|
|
2001-05-22 18:23:50 +08:00
|
|
|
diff = resolve_symbol_value (frag->fr_symbol);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2008-11-29 05:28:28 +08:00
|
|
|
ca = frag->fr_subtype >> 3;
|
* gas/app, gas/as.c, gas/as.h, gas/atof-generic.c, gas/cgen.c,
gas/config/atof-ieee.c, gas/config/obj-aout.c,
gas/config/obj-coff.c, gas/config/obj-ecoff.c,
gas/config/obj-elf.c, gas/config/obj-som.c, gas/config/tc-alpha.c,
gas/config/tc-arc.c, gas/config/tc-arm.c, gas/config/tc-cr16.c,
gas/config/tc-cris.c, gas/config/tc-crx.c, gas/config/tc-d30v.c,
gas/config/tc-dlx.c, gas/config/tc-hppa.c, gas/config/tc-i370.c,
gas/config/tc-i386-intel.c, gas/config/tc-i386.c,
gas/config/tc-i860.c, gas/config/tc-i960.c, gas/config/tc-ia64.c,
gas/config/tc-iq2000.c, gas/config/tc-m32c.c,
gas/config/tc-m32r.c, gas/config/tc-m68hc11.c,
gas/config/tc-m68k.c, gas/config/tc-maxq.c, gas/config/tc-mcore.c,
gas/config/tc-mep.c, gas/config/tc-mips.c, gas/config/tc-mmix.c,
gas/config/tc-mn10300.c, gas/config/tc-moxie.c,
gas/config/tc-ns32k.c, gas/config/tc-pj.c, gas/config/tc-ppc.c,
gas/config/tc-s390.c, gas/config/tc-score.c,
gas/config/tc-score7.c, gas/config/tc-sh.c, gas/config/tc-sparc.c,
gas/config/tc-spu.c, gas/config/tc-tic30.c, gas/config/tc-vax.c,
gas/config/tc-xtensa.c, gas/config/xtensa-relax.c,
gas/dw2gencfi.c, gas/dwarf2dbg.c, gas/ehopt.c, gas/expr.c,
gas/frags.c, gas/input-file.c, gas/read.c, gas/sb.c,
gas/subsegs.c, gas/symbols.c, gas/write.c: Change the name of the
gas macro `assert' to `gas_assert'.
2009-06-23 01:56:02 +08:00
|
|
|
gas_assert (ca > 0);
|
2008-11-29 05:28:28 +08:00
|
|
|
diff /= ca;
|
2001-05-15 06:37:47 +08:00
|
|
|
switch (frag->fr_subtype & 7)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2001-05-15 06:37:47 +08:00
|
|
|
case 0:
|
* gas/app, gas/as.c, gas/as.h, gas/atof-generic.c, gas/cgen.c,
gas/config/atof-ieee.c, gas/config/obj-aout.c,
gas/config/obj-coff.c, gas/config/obj-ecoff.c,
gas/config/obj-elf.c, gas/config/obj-som.c, gas/config/tc-alpha.c,
gas/config/tc-arc.c, gas/config/tc-arm.c, gas/config/tc-cr16.c,
gas/config/tc-cris.c, gas/config/tc-crx.c, gas/config/tc-d30v.c,
gas/config/tc-dlx.c, gas/config/tc-hppa.c, gas/config/tc-i370.c,
gas/config/tc-i386-intel.c, gas/config/tc-i386.c,
gas/config/tc-i860.c, gas/config/tc-i960.c, gas/config/tc-ia64.c,
gas/config/tc-iq2000.c, gas/config/tc-m32c.c,
gas/config/tc-m32r.c, gas/config/tc-m68hc11.c,
gas/config/tc-m68k.c, gas/config/tc-maxq.c, gas/config/tc-mcore.c,
gas/config/tc-mep.c, gas/config/tc-mips.c, gas/config/tc-mmix.c,
gas/config/tc-mn10300.c, gas/config/tc-moxie.c,
gas/config/tc-ns32k.c, gas/config/tc-pj.c, gas/config/tc-ppc.c,
gas/config/tc-s390.c, gas/config/tc-score.c,
gas/config/tc-score7.c, gas/config/tc-sh.c, gas/config/tc-sparc.c,
gas/config/tc-spu.c, gas/config/tc-tic30.c, gas/config/tc-vax.c,
gas/config/tc-xtensa.c, gas/config/xtensa-relax.c,
gas/dw2gencfi.c, gas/dwarf2dbg.c, gas/ehopt.c, gas/expr.c,
gas/frags.c, gas/input-file.c, gas/read.c, gas/sb.c,
gas/subsegs.c, gas/symbols.c, gas/write.c: Change the name of the
gas macro `assert' to `gas_assert'.
2009-06-23 01:56:02 +08:00
|
|
|
gas_assert (diff < 0x40);
|
2008-11-29 05:28:28 +08:00
|
|
|
loc4_frag->fr_literal[loc4_fix] = DW_CFA_advance_loc | diff;
|
2001-05-15 06:37:47 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
* gas/app, gas/as.c, gas/as.h, gas/atof-generic.c, gas/cgen.c,
gas/config/atof-ieee.c, gas/config/obj-aout.c,
gas/config/obj-coff.c, gas/config/obj-ecoff.c,
gas/config/obj-elf.c, gas/config/obj-som.c, gas/config/tc-alpha.c,
gas/config/tc-arc.c, gas/config/tc-arm.c, gas/config/tc-cr16.c,
gas/config/tc-cris.c, gas/config/tc-crx.c, gas/config/tc-d30v.c,
gas/config/tc-dlx.c, gas/config/tc-hppa.c, gas/config/tc-i370.c,
gas/config/tc-i386-intel.c, gas/config/tc-i386.c,
gas/config/tc-i860.c, gas/config/tc-i960.c, gas/config/tc-ia64.c,
gas/config/tc-iq2000.c, gas/config/tc-m32c.c,
gas/config/tc-m32r.c, gas/config/tc-m68hc11.c,
gas/config/tc-m68k.c, gas/config/tc-maxq.c, gas/config/tc-mcore.c,
gas/config/tc-mep.c, gas/config/tc-mips.c, gas/config/tc-mmix.c,
gas/config/tc-mn10300.c, gas/config/tc-moxie.c,
gas/config/tc-ns32k.c, gas/config/tc-pj.c, gas/config/tc-ppc.c,
gas/config/tc-s390.c, gas/config/tc-score.c,
gas/config/tc-score7.c, gas/config/tc-sh.c, gas/config/tc-sparc.c,
gas/config/tc-spu.c, gas/config/tc-tic30.c, gas/config/tc-vax.c,
gas/config/tc-xtensa.c, gas/config/xtensa-relax.c,
gas/dw2gencfi.c, gas/dwarf2dbg.c, gas/ehopt.c, gas/expr.c,
gas/frags.c, gas/input-file.c, gas/read.c, gas/sb.c,
gas/subsegs.c, gas/symbols.c, gas/write.c: Change the name of the
gas macro `assert' to `gas_assert'.
2009-06-23 01:56:02 +08:00
|
|
|
gas_assert (diff < 0x100);
|
1999-05-03 15:29:11 +08:00
|
|
|
loc4_frag->fr_literal[loc4_fix] = DW_CFA_advance_loc1;
|
|
|
|
frag->fr_literal[frag->fr_fix] = diff;
|
2001-05-15 06:37:47 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
* gas/app, gas/as.c, gas/as.h, gas/atof-generic.c, gas/cgen.c,
gas/config/atof-ieee.c, gas/config/obj-aout.c,
gas/config/obj-coff.c, gas/config/obj-ecoff.c,
gas/config/obj-elf.c, gas/config/obj-som.c, gas/config/tc-alpha.c,
gas/config/tc-arc.c, gas/config/tc-arm.c, gas/config/tc-cr16.c,
gas/config/tc-cris.c, gas/config/tc-crx.c, gas/config/tc-d30v.c,
gas/config/tc-dlx.c, gas/config/tc-hppa.c, gas/config/tc-i370.c,
gas/config/tc-i386-intel.c, gas/config/tc-i386.c,
gas/config/tc-i860.c, gas/config/tc-i960.c, gas/config/tc-ia64.c,
gas/config/tc-iq2000.c, gas/config/tc-m32c.c,
gas/config/tc-m32r.c, gas/config/tc-m68hc11.c,
gas/config/tc-m68k.c, gas/config/tc-maxq.c, gas/config/tc-mcore.c,
gas/config/tc-mep.c, gas/config/tc-mips.c, gas/config/tc-mmix.c,
gas/config/tc-mn10300.c, gas/config/tc-moxie.c,
gas/config/tc-ns32k.c, gas/config/tc-pj.c, gas/config/tc-ppc.c,
gas/config/tc-s390.c, gas/config/tc-score.c,
gas/config/tc-score7.c, gas/config/tc-sh.c, gas/config/tc-sparc.c,
gas/config/tc-spu.c, gas/config/tc-tic30.c, gas/config/tc-vax.c,
gas/config/tc-xtensa.c, gas/config/xtensa-relax.c,
gas/dw2gencfi.c, gas/dwarf2dbg.c, gas/ehopt.c, gas/expr.c,
gas/frags.c, gas/input-file.c, gas/read.c, gas/sb.c,
gas/subsegs.c, gas/symbols.c, gas/write.c: Change the name of the
gas macro `assert' to `gas_assert'.
2009-06-23 01:56:02 +08:00
|
|
|
gas_assert (diff < 0x10000);
|
1999-05-03 15:29:11 +08:00
|
|
|
loc4_frag->fr_literal[loc4_fix] = DW_CFA_advance_loc2;
|
|
|
|
md_number_to_chars (frag->fr_literal + frag->fr_fix, diff, 2);
|
2001-05-15 06:37:47 +08:00
|
|
|
break;
|
|
|
|
|
2019-10-26 16:08:26 +08:00
|
|
|
case 4:
|
2001-05-15 06:37:47 +08:00
|
|
|
md_number_to_chars (frag->fr_literal + frag->fr_fix, diff, 4);
|
|
|
|
break;
|
2019-10-26 16:08:26 +08:00
|
|
|
|
|
|
|
case 7:
|
|
|
|
gas_assert (diff == 0);
|
|
|
|
frag->fr_fix -= 8;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
abort ();
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
|
|
|
|
2001-05-15 14:10:43 +08:00
|
|
|
frag->fr_fix += frag->fr_subtype & 7;
|
1999-05-03 15:29:11 +08:00
|
|
|
frag->fr_type = rs_fill;
|
2001-05-15 14:10:43 +08:00
|
|
|
frag->fr_subtype = 0;
|
1999-05-03 15:29:11 +08:00
|
|
|
frag->fr_offset = 0;
|
|
|
|
}
|
2023-03-10 07:35:44 +08:00
|
|
|
|
|
|
|
void
|
|
|
|
eh_begin (void)
|
|
|
|
{
|
|
|
|
memset (&frame, 0, sizeof (frame));
|
|
|
|
}
|