* TSX up 2.97 points, or 0.02 percent, at 12,373.77 * Financials weigh, but gold miners boost index * RIM rises more than 11 percent By Allison Martell TORONTO, Dec 27 (Reuters) - Canada's main stock index closed little changed on Thursday, with a gain in the materials sector offsetting lower financial shares, as investors wavered on whether the U.S. budget crisis could be resolved by a Dec. 31 deadline. The index was negative for much of the day following pessimistic comments from a top U.S. lawmaker, but recovered sharply late in the session on news that the House of Representatives had scheduled a session for Sunday. "It's all based on hope, and the hope is that they'll come to some kind of an agreement," said Fred Ketchen, director of equity trading at ScotiaMcLeod, on the late rally. "Maybe there is some middle ground." Earlier in the day, U.S. Senate Majority Leader Harry Reid warned that the country is poised to go off the so-called "fiscal cliff" if squabbling politicians do not reach a deal. The combination of tax hikes and spending cuts will start taking effect next week if no compromise is reached. "We are just seeing more and more indications that nothing is going to happen," said Pat McHugh, Canadian equity strategist at Manulife Asset Management. "Majority Leader Reid is basically saying that there isn't enough time to allow for the resolution of the cliff." The Toronto Stock Exchange closed up 2.97 points, or 0.02 percent, at 12,373.77. Volume was relatively thin as the market reopened after a two-day break for Christmas and Boxing Day. The materials sector, which includes miners, rose 1.1 percent, led by gold miners as the metal's spot price rose. Barrick Gold Corp, the world's top gold producer, was the index's most influential gainer, rising 2.2 percent to C$34.24. Goldcorp Inc rose 1.3 percent to C$35.98. Energy stocks edged up 0.1 percent, along with U.S. crude futures. But these gains were largely offset by a decline in the financial sector, which fell 0.5 percent. Paul Hand, managing director at RBC Capital Markets, said bank stocks were weighed down by worries about the fiscal cliff. "The market hates uncertainty," he said. "And that's what this is. They'd almost prefer a bad outcome than no outcome." Toronto Dominion Bank and the Royal Bank of Canada were the two most influential decliners, falling 0.9 percent to C$83.27 and 0.5 percent to C$60.05 respectively. Research In Motion Ltd boosted the index as it climbed 11.7 percent to C$11.43 in Toronto, tracking similar gains in New York on Wednesday. The bounce followed a sharp decline last week, when the BlackBerry maker reported earnings.