arc: Fix potential invalid pointer access when fixing got symbols.
authorClaudiu Zissulescu <claziss@synopsys.com>
Tue, 14 Sep 2021 09:10:54 +0000 (12:10 +0300)
committerClaudiu Zissulescu <claziss@synopsys.com>
Tue, 14 Sep 2021 09:10:54 +0000 (12:10 +0300)
commit09a7e912932db766d5e6badfcba61c55f185503a
tree9e0d738f0382a4cedf8423afe9bef0315070ce75
parentf050cfdd82625e6214c4a77ae3b4b364dede1b52
arc: Fix potential invalid pointer access when fixing got symbols.

When statically linking, it can arrive to an undefined weak symbol of
which its value cannot be determined. However, we are having pieces of
code which doesn't take this situation into account, leading to access
a structure which may not be initialized. Fix this situation and add a
test.

bfd/
xxxx-xx-xx  Cupertino Miranda  <cmiranda@synopsys.com>
            Claudiu Zissulescu  <claziss@synopsys.com>

* arc-got.h (arc_static_sym_data): New structure.
(get_static_sym_data): New function.
(relocate_fix_got_relocs_for_got_info): Move the computation fo
symbol value and section to above introduced function, and use
this new function.

ld/testsuite/
xxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>

* ld-arc/got-weak.d: New file.
* ld-arc/got-weak.s: Likewise.

Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
fix
bfd/ChangeLog
bfd/arc-got.h
ld/ChangeLog
ld/testsuite/ld-arc/got-weak.d [new file with mode: 0644]
ld/testsuite/ld-arc/got-weak.s [new file with mode: 0644]