This is an archive of the discontinued LLVM Phabricator instance.

Properly pass through the PIC mode to the integrated assembler when doing assembly-only, and unify the Driver's PIC argument parsing.
ClosedPublic

Authored by jyknight on Aug 7 2015, 1:21 PM.

Details

Summary

On a few architectures, parsing of assembly files annoyingly depends
on whether PIC is enabled or not. This was handled for external 'as'
already (passing -KPIC), but was missed for calls to the standalone
internal assembler.

The integrated-as.s test needed to be modified to not expect
-fsanitize=address to be unused, as now fsanitize *IS* used for
assembly, since -fsanitize=memory can sometimes imply -fPIE, which the
assembler needs to know (gack!!).

Diff Detail

Repository
rL LLVM

Event Timeline

jyknight updated this revision to Diff 31540.Aug 7 2015, 1:21 PM
jyknight retitled this revision from to Properly pass through the PIC mode to the integrated assembler when doing assembly-only, and unify the Driver's PIC argument parsing..
jyknight updated this object.
jyknight added reviewers: rnk, echristo.
jyknight added a subscriber: cfe-commits.
joerg added a subscriber: joerg.Aug 11 2015, 1:31 PM

I agree in principle. The "-static" thing is already in the initial code, but doesn't make sense to me.

lib/Driver/Tools.cpp
2928 ↗(On Diff #31540)

Drop the last with?

2930 ↗(On Diff #31540)

Not a native speaker, but "returns as tuple" sounds more natural?

Why is the PICLevel signed?

2998 ↗(On Diff #31540)

No need to rant about GCC behavior that much. Just state that older GCC versions provided different (inconsistent behavior).

3022 ↗(On Diff #31540)

Difficult to parse. Please rewrite the second sentence.

3032 ↗(On Diff #31540)

This check doesn't make sense to me. When using just -S, -static is completely ignored. So why should it be relevant here?

3087 ↗(On Diff #31540)

This part looks like a clean up that can be applied separately first?

jyknight updated this revision to Diff 32216.Aug 14 2015, 8:54 PM

Updated for review comments

lib/Driver/Tools.cpp
2928 ↗(On Diff #31540)

Done.

2930 ↗(On Diff #31540)

It's signed because I just used 'int' as a default; doesn't seem like it makes a difference, but made it unsigned.

2998 ↗(On Diff #31540)

I don't think it's even worth saying that much -- the original comment was from 2012, and isn't really relevant information to anyone reading this. Removed.

3022 ↗(On Diff #31540)

Done.

3032 ↗(On Diff #31540)

Not sure what you mean? This code isn't only used with -S -- it's used for all clang compile and assemble actions.

3087 ↗(On Diff #31540)

Committed separately as r245154.

Joerg said LGTM on #llvm; going ahead with commit.

This revision was automatically updated to reflect the committed changes.