Skip to content

Commit 1aaad1d

Browse files
committed
PR27228, .reloc wrong symbol emitted for undefined local symbol
Local symbols are of course supposed to be defined by their object file, but in other cases a local symbol is promoted to global by gas if undefined and referenced. This patch stops gas wrongly replacing a local undefined symbol with the undefined section symbol, resulting in a .reloc undefined local symbol being emitted as global. PR 27228 * write.c (resolve_reloc_expr_symbols): Don't assume local symbol is defined. (cherry picked from commit 68fcee4)
1 parent 74c1e3d commit 1aaad1d

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

gas/ChangeLog

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2021-01-24 Alan Modra <[email protected]>
2+
3+
PR 27228
4+
* write.c (resolve_reloc_expr_symbols): Don't assume local symbol
5+
is defined.
6+
17
2021-01-21 Alan Modra <[email protected]>
28

39
PR 27221

gas/write.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,9 @@ resolve_reloc_expr_symbols (void)
737737
prevent the offset from overflowing the relocated field,
738738
unless it has enough bits to cover the whole address
739739
space. */
740-
if (S_IS_LOCAL (sym) && !symbol_section_p (sym)
740+
if (S_IS_LOCAL (sym)
741+
&& S_IS_DEFINED (sym)
742+
&& !symbol_section_p (sym)
741743
&& (sec->use_rela_p
742744
|| (howto->partial_inplace
743745
&& (!howto->pc_relative

0 commit comments

Comments
 (0)