If your an at will employee, which almost everyone is today then the company can fire you for no given reason. In practice disclosing salary isn't going to get your fired unless there are other reasons, but will get you labeled as a bad player.

It gives them the right to terminate employment because of a business event (plant closing, large-scale layoff for strategic reasons) without being liable for payment (as opposed to, e.g., a contract where there would be "kill fees" for early termination). It also gives them the right to fire people individually for criminal behavior, violations of well-understood professional ethics, and falling short of an objective, published performance standard. If the company policy requires 150 widgets per hour and one person's coming in at 130, the company can fire that person. That said, if he can establish that someone else (e.g. the boss's son) had the same title and job, produced 120, and wasn't fired, he has a stronger case.

White-collar firings, which are always dressed up to look like "performance"-related firings, are a major gray area. The reason for the kangaroo court of "performance improvement plans" is to make the case that, at the least, the employee was warned. PIPs don't show that the termination was fair, but establish that the employee "should have seen it coming", and that often decides these he-said/she-said sorts of things in the employer's favor.

Termination endgames can be played to a win. For one thing, a lot of the things that people get fired for can be actionable. Let's say you have a bad boss and try to get away from him using a transfer. In most companies, bosses fire people who try to get away from them. However, if company policy is to allow transfers and you can establish that someone of your rank and seniority was allowed transfer anywhere in the company, but your boss blocked it, you have a harassment claim. You used a legitimate HR measure (transfer) in a legitimate way. You can never prove it was the reason for the termination, but if you document everything you do-- every single thing that can make you look good-- it is to your advantage. (If he lets you transfer and get out of his way, that's better. Getting a better job is always better than playing the termination endgame.)

You're almost always better off getting another job, but if you have some reason to want to stay at the company, there's a lot you can do to make yourself hard to fire. Use all internal recourse you have, including HR. (Be respectful and focus on defending yourself and your reputation, not attacking your boss. HR is not your friend, but you can still use them.) That will make your boss angry, and HR will almost always side with management, but if you document everything you can make it look like the firing is retaliatory. Health problems are often protected, and everyone over 25 has at least one health problem. Disclose it, no matter how minor. (If you're presented with a PIP, sign absolutely nothing, leave the room, and disclose a health problem by email immediately.) If you get put on a PIP, dress up interviews as "doctor visits" and force your boss to change the schedule of the PIP (if he doesn't, then start using words like "emotional distress" and CC someone in HR.) This will exhaust him and draw out the process long enough for you to get a better job. The goal, I should mention, is usually not to sue the company. It's to scare them into either slowing down so you can get out, writing a severance, or agreeing to a good reference so you can move on in your career.

TL;DR: At-will employment is much more complicated than employers want people to believe. The problem is that the termination game is something people (if they're lucky) rarely or never have to play, and people who've been through it don't talk about it and share knowledge.