Page MenuHomePhabricator

[PPC] Fix 32-bit build of libunwind
ClosedPublic

Authored by luporl on Fri, May 10, 9:28 AM.

Details

Summary

Clang integrated assembler was unable to build libunwind PPC32 assembly code,
present in functions used to save/restore register context.

This change consists in replacing the assembly style used in libunwind source,
to one that is compatible with both Clang integrated assembler as well as
GNU assembler.

Diff Detail

Repository
rL LLVM

Event Timeline

luporl created this revision.Fri, May 10, 9:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptFri, May 10, 9:28 AM
luporl added a subscriber: MaskRay.Fri, May 10, 9:41 AM
MaskRay added inline comments.Fri, May 10, 7:20 PM
libunwind/src/UnwindRegistersSave.S
559 ↗(On Diff #199029)

Changing the comment marker seems fine from the perspective of consistency.

566 ↗(On Diff #199029)

Nice, if stw r0, 8(r3) is accepted by neither GNU as nor llvm-mc, why was it added in the first place...

Have you considered stw 0, 8(3)? In powerpc assembly, 0 is much more common than %r0.

luporl marked 3 inline comments as done.Mon, May 13, 6:57 AM
luporl added inline comments.
libunwind/src/UnwindRegistersSave.S
566 ↗(On Diff #199029)

Yes, I also don't know how the older powerpc assembly in this file was supposed to work...

Personally, I find stw %r0, 8(%r3) easier to read and understand than stw 0, 8(3), because it makes the distinction between registers and immediates clear.
This change is also consistent with powerpc64 code, that uses "%r" for registers.

MaskRay accepted this revision.Mon, May 13, 7:18 AM
This revision is now accepted and ready to land.Mon, May 13, 7:18 AM
compnerd added inline comments.Mon, May 13, 11:10 AM
libunwind/src/UnwindRegistersSave.S
566 ↗(On Diff #199029)

I believe that these were written against the cctools's assembler, not GNU.

mclow.lists accepted this revision.Mon, May 13, 11:11 AM
mclow.lists added a subscriber: mclow.lists.

As far as I can tell, this should have no effects - is that correct?
If so, this looks fine to me.

compnerd added inline comments.Mon, May 13, 11:20 AM
libunwind/src/assembly.h
32 ↗(On Diff #199029)

Why the removal of this? This is the correct separator IIRC.

luporl marked an inline comment as done.Mon, May 13, 11:31 AM

As far as I can tell, this should have no effects - is that correct?
If so, this looks fine to me.

Correct.

luporl marked an inline comment as done.Mon, May 13, 11:37 AM
luporl added inline comments.
libunwind/src/assembly.h
32 ↗(On Diff #199029)

Because clang's integrated assembler does not recognize '@' as a separator, but both clang and GNU as recognize ';' as a separator.
Maybe this part was also added when cctools were being used?

Bdragon28 marked an inline comment as done.Tue, May 14, 2:50 PM
Bdragon28 added a subscriber: Bdragon28.
Bdragon28 added inline comments.
libunwind/src/assembly.h
32 ↗(On Diff #199029)

Additionally, @ actually means something in PPC64 asm. It's used for indirect references.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptWed, May 15, 11:48 PM