In a large, heavy pot or casserole over high heat, heat the oil until almost smoking. Add the onions and reduce heat to medium. Cook the onions for about 30 minutes, or until they are soft and an even deep golden brown; stir frequently with a wooden spoon and scrape up all the browned bits from the bottom of the pan. Pour in the wine, raise heat to high, and boil until the soup is reduced by 2/3. Stir in the stock or broth and bring to a boil. Reduce heat to low and simmer for 20 minutes. Season with salt and pepper. Preheat the broiler. Place 8 deep ovenproof soup bowls or crocks on a baking sheet. Ladle the soup into bowls, add a slice of the bread to each bowl, and sprinkle the shredded cheese on top. Broil for 3 to 4 minutes, or until the cheese is golden and bubbling. Serve immediately.