In a wide, heavy-bottomed pan over medium-low heat, heat olive oil until shimmering. Add onions and stir to coat with the oil. Cook, stirring occasionally, for about 5 to 10 minutes. Add sugar and salt. Continue to cook, stirring occasionally, for about 15 to 20 minutes or until softened and of deep brown color. Allow to completely cool.
In a bowl, combine butter, mayo, cheese, olives, caramelized onions, and green onions. Stir until well incorporated. Season with pepper to taste.
Spread mixture onto each bread loaf halves. Arrange in a single layer on a baking sheet and bake in a 350 F for about 15 to 20 minutes or until cheese is melted and bubbly. Cut into serving pieces and serve immediately.