Remove target-specific alignment from test.
Escape # and $ in dependency files.

Fixes PR15642.