mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 21:53:12 +08:00
Check return value of addOptionalSynthetic before calling a member function on it.
Found with UBSan. llvm-svn: 268410
This commit is contained in:
@@ -1207,9 +1207,11 @@ template <class ELFT> void Writer<ELFT>::addReservedSymbols() {
|
||||
|
||||
// On MIPS O32 ABI, _gp_disp is a magic symbol designates offset between
|
||||
// start of function and 'gp' pointer into GOT.
|
||||
ElfSym<ELFT>::MipsGpDisp =
|
||||
addOptionalSynthetic(Symtab, "_gp_disp", Out<ELFT>::Got, MipsGPOffset)
|
||||
->body();
|
||||
Symbol *Sym =
|
||||
addOptionalSynthetic(Symtab, "_gp_disp", Out<ELFT>::Got, MipsGPOffset);
|
||||
if (Sym)
|
||||
ElfSym<ELFT>::MipsGpDisp = Sym->body();
|
||||
|
||||
// The __gnu_local_gp is a magic symbol equal to the current value of 'gp'
|
||||
// pointer. This symbol is used in the code generated by .cpload pseudo-op
|
||||
// in case of using -mno-shared option.
|
||||
|
||||
Reference in New Issue
Block a user