When you buy stock, you are buying an ownership stake in a corporation. That's it.
Corporations issue stock as a way to raise capital as with an initial public offering (IPO) or preferred shares. Investors that participated in the IPO or preferred share offering can sell those shares once the lock-up period (if any) ends.
By the time you buy stock through an exchange, the corporation has already raised its capital. When you buy shares in Big Evil Corporation, you're not “supporting” the corporation in the sense of funding it. I think that's a pretty common misconception. You are participating in a market for the corporation’s shares, not endorsing the corporation.
In other words, the moral or ethical question of stock ownership is not "Do I want to fund Big Evil Corporation?" It's "Do I want a share of the profits genereated when people buy products or services from Big Evil Corporation?"
You're not boycotting or punishing a company by not owning its shares. You're missing out on the appreciation (or decline) of its share price and any dividends that may be paid from its profits. You're also missing out on the opportunity to shape the corporation's governance by voting with your shares in a proxy vote.1
It's easy to feel conflicted about accepting a piece of the profits from a gun manufacturer, an oil company, or a bank with racist lending practices. I've rationalized it this way: I can only do good with that money if it's in my hands.
Elections held during annual meetings let you vote for or against board members and shareholder proposals. You vote with your shares. Unless you own a significant stake in a corporation, however, you probably aren't getting much of a say. Plus proxy votes for shareholder proposals aren't necessarily binding. Still, sometimes it's fun to yell at the clouds and vote your shares. ↩