Chimney flashing has to solve a hard problem: two materials that move differently must stay watertight where they meet. The solution is two overlapping layers rather than one seal. Base flashing is fastened to the roof deck and turns up the masonry; counter flashing is let into a mortar joint, folded down, and laps over the base flashing's vertical leg. Water running down the masonry is intercepted by the counter flashing and shed onto the base flashing, which carries it onto the roof surface. Critically the two pieces are not fastened to each other, so the chimney and the roof can move independently without tearing the assembly apart. That is why a single bead of sealant fails: it bonds two moving surfaces rigidly and cracks within a season or two, and roofing cement smeared over the joint does the same thing more thickly.