Several years ago, IATA passed "Resolution 302" which covers baggage fees for trips like this.
Basically, this resolution states :
1) If the published baggage provisions among all participating
carriers are the same; these provisions will apply.
2) Where the one or more published baggage provisions differ between
participating carriers, apply any common provisions and where
provisions differ the published baggage provisions of the Most
Significant Carrier (MSC). (In case of code share flights this will be
the Operating Carrier, unless that carrier publishes a rule
stipulating that it will be the Marketing Carrier).
3) If the MSC does not publish baggage provisions for the journey
concerned apply the published baggage provisions of the carrier
accepting the baggage at check-in.
4) If the carrier accepting the baggage at check-in does not publish
baggage provisions for the interline journey concerned apply the
published baggage provisions of each operating airline
sector-by-sector.
Without going into too much detail, the "Most Significant Carrier (MSC)" is the one that forms the longest part of your journey. (That isn't always correct, but without going into confusing details about IATA regions, it's generally correct).
So in your case, the baggage allowance from Toronto to Rio will be the one that applies, however if there are any fees payable then you will pay them at the start of your journey, not in Toronto.