I asked about upgrading GCC during the last community meeting and the answer was:
Probably configure options that are not good. Take a look at a success for 5.10 here https://talk.maemo.org/showthread.php?p=1478195
pkcon download . gcc
On Jolla1? Please use the MER platform SDK instead! It'll make your life alot easier.