In the movie Jurassic World there is a scene where a specialised military response team engages the Indominus Rex, a genetically modified dinosaur said to be of comparable size to Tyrannosaurus Rex. The weapons they carry are largely typical late twentieth to early-twenty-first century firearms, and even the crew-served weapons - including some kind of machinegun fired from a helicopter, don't seem to do any significant damage to the dinosaur.
This has some precedent, in that even real-world large mammals have proved challenging to dispatch using firearms - the elephant gun was developed specifically for hunting the largest of game.
A realistic dinosaur of the genus mentioned previously would probably weigh somewhere in the region of 15,000kg, whereas the largest African elephant weighs around 6,300kg. This indicates that the movie drastically over-represents the size of a Tyrannosaurus-type dinosaur, which appear in the movie to be the height of a three or four-storey building at least and massing at a rough guess at least ten times their real-world size.
For the sake of the question, let us assume that we are aiming to deal with a movie-type dinosaur - a very large and very durable animal, well in excess of the largest terrestrial species to have been killed with a firearm.
How powerful would a firearm have to be to kill this hypothetical dinosaur with one to three shots placed with skill, and what technological adaptations would be required to make this weapon readily portable in the manner of some kind of small arm? By small arm, I mean a weapon such as a rifle or shotgun, or exotic variations such as gyrojets, with automatic or semi-automatic loading from a magazine, potentially specifically-designed to kill an extremely large animal if this is necessary to achieve the goal. The weapon should be practical to carry and fire on the move by a single operator, including while under attack by the animal. Is such a thing feasible?