When a company liquidates, bondholders are paid out before stockholders. This is to prevent moral hazard from companies going deep into debt and running off with the cash by liquidating the company.
This is not always true and depends on the structure and terms of the bond. For example in the credit suisse takeover several classes of bond were wiped out while some classes of shares were not.