Preheat oven to 350. Spread coconut on one side of a large rimmed baking sheet, and pecans on other side, keeping them separate. Toast until fragrant, 15 to 20 minutes, tossing occasionally.
Meanwhile, coat an 8-inch square baking pan with cooking spray; line with a strip of waxed paper (leaving an overhang on two sides). Spray paper.
In a large nonstick pot over medium-low, heat marshmallows and butter until melted, 5 to 10 minutes, stirring frequently.
Stir in cornflakes, coconut, and pecans. Transfer to prepared pan; press in firmly with a metal spatula (coated with spray to prevent sticking). Cool until firm, about 2 hours. Remove from pan; peel off paper. Using a serrated knife, cut into squares.