Preheat the oven to 375 degrees F. Line a rimmed baking sheet with 2 layers of foil.
If your ribs are in a rack, cut them into separate ribs. Drain the sundried tomatoes, reserving the oil. Toss the ribs with the reserved oil, whole garlic cloves, rosemary, 1 1/4 teaspoons salt and a generous amount of pepper. Place the ribs on the prepared baking sheet and cover the baking sheet with foil. Bake until very tender, about 1 1/2 hours.
Meanwhile, finely chop the sun-dried tomatoes. Melt the butter in a medium saucepan over medium heat. Add the tomatoes, minced garlic, shallot and 1/2 teaspoon salt and cook, stirring occasionally, until softened, about 7 minutes. Add the tomato paste and cook, stirring, for 1 minute. Add the sugar, vinegar and 1 cup water. Bring to a boil over medium-high heat, then reduce the heat and simmer until slightly thickened, about 10 minutes. Transfer about half of the mixture to a mini chop or food processor and pulse until smooth; return the puree to the saucepan with the rest of the tomato glaze.
When the ribs are tender, remove from the oven and increase the temperature to 500 degrees F. Uncover the ribs and remove the rosemary. Mash the roasted garlic cloves into the tomato glaze, discarding anything too tough to mash. Spoon half of the tomato glaze over the ribs. Bake until charred in spots, about 8 minutes. Turn the ribs over and add the rest of the tomato glaze. Bake until charred in spots, about 3 minutes more. Transfer the ribs to a platter and spoon any tomato glaze from the pan over top.