Yes, things could be more complicated than just saying they are not directly related. the problem is, their profits come from those haram companies as well, and you're sharing that profit. Another thing is, they are US companies, but for this question, lets just assume that they are not based in the US
I would like a reply with more evidence
Companies like Microsoft / Google / Amazon make software / hardware that's being used by Gambling and Liquor companies.
Is it halal to invest in shares of these companies according to Ayatollah Khamenei & Ayatollah Sistani?