Implement support for __attribute__((used)) (#3408)