Skip to content

Commit 0db37b7

Browse files
author
Jenkins
committed
Merge remote-tracking branch 'origin/master' into merge-job
2 parents 7e50709 + 48e2cc4 commit 0db37b7

30 files changed

Lines changed: 225 additions & 167 deletions

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ repos:
7171
rev: v2.4.2
7272
hooks:
7373
- id: codespell
74-
files: '^(gdbsupport|gdbserver|gdb/(dwarf2|tui|target|data-directory|po|system-gdbinit|mi|syscalls|arch|regformats|compile|python|guile|config|unittests|cli|testsuite/gdb.(ctf|dap|debuginfod|gdb|go|guile|mi|modula2|objc|opencl|opt|pascal|perf|replay|reverse|rocm|server|stabs|testsuite|tui|xml)))/'
75-
args: [--config, gdb/contrib/setup.cfg]
74+
files: '^(gdbsupport|gdbserver|gdb/(doc|stubs|features|nat|contrib|dwarf2|tui|target|data-directory|po|system-gdbinit|mi|syscalls|arch|regformats|compile|python|guile|config|unittests|cli|testsuite/gdb.(ctf|dap|debuginfod|gdb|go|guile|mi|modula2|objc|opencl|opt|pascal|perf|replay|reverse|rocm|server|stabs|testsuite|tui|xml)))/'
75+
args: [--toml, gdb/pyproject.toml]
7676
- id: codespell
7777
name: codespell-log
7878
entry: gdb/contrib/codespell-log.sh
79-
args: [--config, gdb/contrib/setup.cfg]
79+
args: [--toml, gdb/pyproject.toml]
8080
always_run: true
8181
verbose: true
8282
stages: [commit-msg]

binutils/stabs.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,6 +1293,12 @@ parse_stab_type (void * dhandle,
12931293
}
12941294
}
12951295

1296+
if (*pp >= p_end)
1297+
{
1298+
bad_stab (orig);
1299+
return DEBUG_TYPE_NULL;
1300+
}
1301+
12961302
descriptor = **pp;
12971303
++*pp;
12981304

@@ -3219,18 +3225,16 @@ parse_stab_array_type (void *dhandle,
32193225
{
32203226
index_type = debug_find_named_type (dhandle, "int");
32213227
if (index_type == DEBUG_TYPE_NULL)
3222-
{
3223-
index_type = debug_make_int_type (dhandle, 4, false);
3224-
if (index_type == DEBUG_TYPE_NULL)
3225-
return DEBUG_TYPE_NULL;
3226-
}
3228+
index_type = debug_make_int_type (dhandle, 4, false);
32273229
*pp = p;
32283230
}
32293231
else
32303232
{
32313233
index_type = parse_stab_type (dhandle, info, (const char *) NULL, pp,
32323234
(debug_type **) NULL, p_end);
32333235
}
3236+
if (index_type == DEBUG_TYPE_NULL)
3237+
return DEBUG_TYPE_NULL;
32343238

32353239
if (**pp != ';')
32363240
{

gas/config/obj-macho.c

Lines changed: 48 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,7 +1383,8 @@ void obj_mach_o_frob_label (struct symbol *sp)
13831383

13841384
s = (bfd_mach_o_asymbol *) symbol_get_bfdsym (sp);
13851385
/* Leave debug symbols alone. */
1386-
if ((s->n_type & BFD_MACH_O_N_STAB) != 0)
1386+
if ((s->n_type & BFD_MACH_O_N_STAB) != 0
1387+
|| (s->symbol.section->flags & SEC_DEBUGGING) != 0)
13871388
return;
13881389

13891390
/* This is the base symbol type, that we mask in. */
@@ -1433,7 +1434,8 @@ obj_mach_o_frob_symbol (struct symbol *sp)
14331434

14341435
s = (bfd_mach_o_asymbol *) symbol_get_bfdsym (sp);
14351436
/* Leave debug symbols alone. */
1436-
if ((s->n_type & BFD_MACH_O_N_STAB) != 0)
1437+
if ((s->n_type & BFD_MACH_O_N_STAB) != 0
1438+
|| (s->symbol.section->flags & SEC_DEBUGGING) != 0)
14371439
return 0;
14381440

14391441
base_type = obj_mach_o_type_for_symbol (s);
@@ -1554,68 +1556,6 @@ obj_mach_o_process_stab (int what, const char *string,
15541556
s->symbol.udata.i = SYM_MACHO_FIELDS_NOT_VALIDATED;
15551557
}
15561558

1557-
/* This is a place to check for any errors that we can't detect until we know
1558-
what remains undefined at the end of assembly. */
1559-
1560-
static void
1561-
obj_mach_o_check_before_writing (bfd *abfd ATTRIBUTE_UNUSED,
1562-
asection *sec,
1563-
void *unused ATTRIBUTE_UNUSED)
1564-
{
1565-
fixS *fixP;
1566-
struct frchain *frchp;
1567-
segment_info_type *seginfo = seg_info (sec);
1568-
1569-
if (seginfo == NULL)
1570-
return;
1571-
1572-
/* We are not allowed subtractions where either of the operands is
1573-
undefined. So look through the frags for any fixes to check. */
1574-
for (frchp = seginfo->frchainP; frchp != NULL; frchp = frchp->frch_next)
1575-
for (fixP = frchp->fix_root; fixP != NULL; fixP = fixP->fx_next)
1576-
{
1577-
if (fixP->fx_addsy != NULL
1578-
&& fixP->fx_subsy != NULL
1579-
&& (! S_IS_DEFINED (fixP->fx_addsy)
1580-
|| ! S_IS_DEFINED (fixP->fx_subsy)))
1581-
{
1582-
segT add_symbol_segment = S_GET_SEGMENT (fixP->fx_addsy);
1583-
segT sub_symbol_segment = S_GET_SEGMENT (fixP->fx_subsy);
1584-
1585-
if (! S_IS_DEFINED (fixP->fx_addsy)
1586-
&& S_IS_DEFINED (fixP->fx_subsy))
1587-
{
1588-
as_bad_where (fixP->fx_file, fixP->fx_line,
1589-
_("`%s' can't be undefined in `%s' - `%s' {%s section}"),
1590-
S_GET_NAME (fixP->fx_addsy), S_GET_NAME (fixP->fx_addsy),
1591-
S_GET_NAME (fixP->fx_subsy), segment_name (sub_symbol_segment));
1592-
}
1593-
else if (! S_IS_DEFINED (fixP->fx_subsy)
1594-
&& S_IS_DEFINED (fixP->fx_addsy))
1595-
{
1596-
as_bad_where (fixP->fx_file, fixP->fx_line,
1597-
_("`%s' can't be undefined in `%s' {%s section} - `%s'"),
1598-
S_GET_NAME (fixP->fx_subsy), S_GET_NAME (fixP->fx_addsy),
1599-
segment_name (add_symbol_segment), S_GET_NAME (fixP->fx_subsy));
1600-
}
1601-
else
1602-
{
1603-
as_bad_where (fixP->fx_file, fixP->fx_line,
1604-
_("`%s' and `%s' can't be undefined in `%s' - `%s'"),
1605-
S_GET_NAME (fixP->fx_addsy), S_GET_NAME (fixP->fx_subsy),
1606-
S_GET_NAME (fixP->fx_addsy), S_GET_NAME (fixP->fx_subsy));
1607-
}
1608-
}
1609-
}
1610-
}
1611-
1612-
/* Do any checks that we can't complete without knowing what's undefined. */
1613-
void
1614-
obj_mach_o_pre_output_hook (void)
1615-
{
1616-
bfd_map_over_sections (stdoutput, obj_mach_o_check_before_writing, NULL);
1617-
}
1618-
16191559
/* Here we count up frags in each subsection (where a sub-section is defined
16201560
as starting with a non-local symbol).
16211561
Note that, if there are no non-local symbols in a section, all the frags will
@@ -1632,6 +1572,10 @@ obj_mach_o_set_subsections (bfd *abfd ATTRIBUTE_UNUSED,
16321572
fragS *frag;
16331573
frchainS *chain;
16341574

1575+
/* Don't waste time on debug sections. */
1576+
if ((sec->flags & SEC_DEBUGGING) != 0)
1577+
return;
1578+
16351579
/* Protect against sections not created by gas. */
16361580
if (seginfo == NULL)
16371581
return;
@@ -1925,8 +1869,9 @@ obj_mach_o_allow_local_subtract (expressionS * left ATTRIBUTE_UNUSED,
19251869
return obj_mach_o_is_frame_section (seg);
19261870
}
19271871

1928-
int
1929-
obj_mach_o_in_different_subsection (symbolS *a, symbolS *b)
1872+
static bool
1873+
obj_mach_o_in_different_subsection (symbolS *a, segT aseg, valueT offset,
1874+
symbolS *b)
19301875
{
19311876
fragS *fa;
19321877
fragS *fb;
@@ -1936,55 +1881,72 @@ obj_mach_o_in_different_subsection (symbolS *a, symbolS *b)
19361881
|| !S_IS_DEFINED (b))
19371882
{
19381883
/* Not in the same segment, or undefined symbol. */
1939-
return 1;
1884+
return true;
19401885
}
19411886

1942-
fa = symbol_get_frag (a);
1887+
if (symbol_section_p (a) && aseg != NULL)
1888+
fa = get_frag_for_address (NULL, seg_info (aseg), offset);
1889+
else
1890+
fa = symbol_get_frag (a);
19431891
fb = symbol_get_frag (b);
19441892
if (fa == NULL || fb == NULL)
19451893
{
19461894
/* One of the symbols is not in a subsection. */
1947-
return 1;
1895+
return true;
19481896
}
19491897

19501898
return fa->obj_frag_data.subsection != fb->obj_frag_data.subsection;
19511899
}
19521900

1953-
int
1954-
obj_mach_o_force_reloc_sub_same (fixS *fix, segT seg)
1901+
bool
1902+
obj_mach_o_force_reloc_sub_same (segT seg, fixS *fix, segT addsymseg)
19551903
{
1956-
if (! SEG_NORMAL (seg))
1957-
return 1;
1958-
return obj_mach_o_in_different_subsection (fix->fx_addsy, fix->fx_subsy);
1904+
if (!SEG_NORMAL (addsymseg))
1905+
return true;
1906+
if ((seg->flags & SEC_DEBUGGING) != 0)
1907+
return false;
1908+
return obj_mach_o_in_different_subsection (fix->fx_addsy, addsymseg,
1909+
fix->fx_offset, fix->fx_subsy);
19591910
}
19601911

1961-
int
1962-
obj_mach_o_force_reloc_sub_local (fixS *fix, segT seg ATTRIBUTE_UNUSED)
1912+
bool
1913+
obj_mach_o_force_reloc_sub_local (segT seg, fixS *fix,
1914+
segT addsymseg ATTRIBUTE_UNUSED)
19631915
{
1964-
return obj_mach_o_in_different_subsection (fix->fx_addsy, fix->fx_subsy);
1916+
if ((seg->flags & SEC_DEBUGGING) != 0)
1917+
return false;
1918+
symbolS *fragsym = fix->fx_frag->obj_frag_data.subsection;
1919+
if (fragsym == NULL)
1920+
return false;
1921+
return obj_mach_o_in_different_subsection (fix->fx_subsy, NULL, 0, fragsym);
19651922
}
19661923

1967-
int
1968-
obj_mach_o_force_reloc (fixS *fix)
1924+
bool
1925+
obj_mach_o_force_reloc (segT seg, fixS *fix)
19691926
{
19701927
if (generic_force_reloc (fix))
1971-
return 1;
1928+
return true;
1929+
1930+
if ((seg->flags & SEC_DEBUGGING) != 0)
1931+
return false;
19721932

19731933
/* Force a reloc if the target is not in the same subsection.
19741934
FIXME: handle (a - b) where a and b belongs to the same subsection ? */
19751935
if (fix->fx_addsy != NULL)
19761936
{
19771937
symbolS *subsec = fix->fx_frag->obj_frag_data.subsection;
1978-
symbolS *targ = fix->fx_addsy;
19791938

19801939
/* There might be no subsections at all. */
19811940
if (subsec == NULL)
1982-
return 0;
1941+
return false;
19831942

1984-
if (S_GET_SEGMENT (targ) == absolute_section)
1985-
return 0;
1943+
symbolS *targ = fix->fx_addsy;
1944+
segT targseg = S_GET_SEGMENT (targ);
1945+
if (targseg == absolute_section)
1946+
return false;
19861947

1987-
return obj_mach_o_in_different_subsection (targ, subsec);
1948+
return obj_mach_o_in_different_subsection (targ, targseg,
1949+
fix->fx_offset, subsec);
19881950
}
1989-
return 0;
1951+
return false;
19901952
}

gas/config/obj-macho.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,6 @@ struct obj_mach_o_frag_data
8787

8888
#define OBJ_FRAG_TYPE struct obj_mach_o_frag_data
8989

90-
#define md_pre_output_hook obj_mach_o_pre_output_hook()
91-
extern void obj_mach_o_pre_output_hook(void);
92-
9390
#define md_pre_relax_hook obj_mach_o_pre_relax_hook()
9491
extern void obj_mach_o_pre_relax_hook (void);
9592

@@ -111,9 +108,8 @@ extern int obj_mach_o_allow_local_subtract (expressionS *, expressionS *,
111108
segT);
112109

113110
struct fix;
114-
extern int obj_mach_o_in_different_subsection (symbolS *a, symbolS *b);
115-
extern int obj_mach_o_force_reloc (struct fix *fix);
116-
extern int obj_mach_o_force_reloc_sub_same (struct fix *fix, segT seg);
117-
extern int obj_mach_o_force_reloc_sub_local (struct fix *fix, segT seg);
111+
extern bool obj_mach_o_force_reloc (segT, struct fix *);
112+
extern bool obj_mach_o_force_reloc_sub_same (segT, struct fix *, segT);
113+
extern bool obj_mach_o_force_reloc_sub_local (segT, struct fix *, segT);
118114

119115
#endif /* _OBJ_MACH_O_H */

gas/config/tc-i386.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -498,15 +498,13 @@ void tc_pe_dwarf2_emit_offset (symbolS *, unsigned int);
498498

499499
#ifdef OBJ_MACH_O
500500

501-
#define TC_FORCE_RELOCATION(FIX) (obj_mach_o_force_reloc (FIX))
501+
#define TC_FORCE_RELOCATION(FIX) (obj_mach_o_force_reloc (this_segment, FIX))
502502

503503
#define TC_FORCE_RELOCATION_SUB_SAME(FIX,SEG) \
504-
(obj_mach_o_force_reloc_sub_same (FIX, SEG))
504+
(obj_mach_o_force_reloc_sub_same (this_segment, FIX, SEG))
505505

506506
#define TC_FORCE_RELOCATION_SUB_LOCAL(FIX,SEG) \
507-
(obj_mach_o_force_reloc_sub_local (FIX, SEG))
508-
509-
#define TC_VALIDATE_FIX_SUB(FIX, SEG) 1
507+
(obj_mach_o_force_reloc_sub_local (this_segment, FIX, SEG))
510508

511509
#endif /* OBJ_MACH_O */
512510

gas/testsuite/gas/i386/insn-32.d

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#as: --divide
22
#objdump: -dw
33
#name: .insn (32-bit code)
4-
#xfail: *-*-darwin*
54

65
.*: +file format .*
76

gas/write.c

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,33 +1228,41 @@ install_reloc (asection *sec, arelent *reloc, fragS *fragp,
12281228
}
12291229
}
12301230

1231-
static fragS *
1232-
get_frag_for_reloc (fragS *last_frag,
1233-
const segment_info_type *seginfo,
1234-
const struct reloc_list *r)
1231+
fragS *
1232+
get_frag_for_address (fragS *last_frag,
1233+
const segment_info_type *seginfo,
1234+
addressT addr)
12351235
{
12361236
fragS *f;
12371237

12381238
for (f = last_frag; f != NULL; f = f->fr_next)
1239-
if (f->fr_address <= r->u.b.r.address
1240-
&& r->u.b.r.address < f->fr_address + f->fr_fix)
1239+
if (f->fr_address <= addr && addr < f->fr_address + f->fr_fix)
12411240
return f;
12421241

12431242
for (f = seginfo->frchainP->frch_root; f != NULL; f = f->fr_next)
1244-
if (f->fr_address <= r->u.b.r.address
1245-
&& r->u.b.r.address < f->fr_address + f->fr_fix)
1243+
if (f->fr_address <= addr && addr < f->fr_address + f->fr_fix)
12461244
return f;
12471245

12481246
for (f = seginfo->frchainP->frch_root; f != NULL; f = f->fr_next)
1249-
if (f->fr_address <= r->u.b.r.address
1250-
&& r->u.b.r.address <= f->fr_address + f->fr_fix)
1247+
if (f->fr_address <= addr && addr <= f->fr_address + f->fr_fix)
12511248
return f;
12521249

1253-
as_bad_where (r->file, r->line,
1254-
_("reloc not within (fixed part of) section"));
12551250
return NULL;
12561251
}
12571252

1253+
static fragS *
1254+
get_frag_for_reloc (fragS *last_frag,
1255+
const segment_info_type *seginfo,
1256+
const struct reloc_list *r)
1257+
{
1258+
fragS *f = get_frag_for_address (last_frag, seginfo, r->u.b.r.address);
1259+
1260+
if (f == NULL)
1261+
as_bad_where (r->file, r->line,
1262+
_("reloc not within (fixed part of) section"));
1263+
return f;
1264+
}
1265+
12581266
static void
12591267
write_relocs (bfd *abfd ATTRIBUTE_UNUSED, asection *sec,
12601268
void *xxx ATTRIBUTE_UNUSED)

gas/write.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,5 +188,8 @@ extern fixS *fix_new_exp (fragS *, unsigned long, unsigned long,
188188
const expressionS *, int, bfd_reloc_code_real_type);
189189
extern void write_print_statistics (FILE *);
190190
extern void as_bad_subtract (fixS *);
191+
struct segment_info_struct;
192+
extern fragS *get_frag_for_address (fragS *, const struct segment_info_struct *,
193+
addressT);
191194

192195
#endif /* __write_h__ */

gdb/contrib/ari/update-web-ari.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -877,12 +877,12 @@ EOF
877877

878878
# Check for invalid categories
879879
for a in $all; do
880-
alls="$alls all[$a] = 1 ;"
880+
all2="$all2 all[$a] = 1 ;"
881881
done
882882
cat ari.*.doc | $AWK >> ${newari} '
883883
BEGIN {
884884
FS = ":"
885-
'"$alls"'
885+
'"$all2"'
886886
}
887887
{
888888
# ari.*.doc: <BUG>:<COUNT>:<CATEGORY>:<DOC>

0 commit comments

Comments
 (0)