This patch resolves crash that occurs when user wanted to remove all
symbols and add a brand new one using:
llvm-objcopy -R .symtab --add-symbol foo=1234 in.o out.o
Before these changes the symbol table internally being null when adding
new symbols. For now we will regenerate symtab in this case.
This fixes: https://bugs.llvm.org/show_bug.cgi?id=43930
You shouldn't need --allow-broken-links.
%t has no symbols in it. I think this test case would be better off using an input file that does contain symbols. I'd recommend splitting this case off into a new file and adding your own YAML with one or more symbols in, showing that the old symbols have been deleted and that new ones have been added. You'll want to show that both the new symbols and the new symtab section header are correct too.