This is an archive of the discontinued LLVM Phabricator instance.

Print unknown section header flags has hex in assembly output
Needs ReviewPublic

Authored by christof on Feb 20 2017, 7:37 AM.

Details

Summary

Use hexadecimal notation for section header flags in case we have a section header with flag without a textual/symbolic representation. The hex syntax is introduced in GNU as version 2.27 [1] and was added to llvm in r289785 [2]. A previous change to do was rejected [3] and this change takes the comments there into account.

I've refactored the section header flags printing to detect if there are any flags we have no symbolic section flag for. In such case, print the section header flags as hex instead.

[1] https://sourceware.org/binutils/docs-2.27/as/Section.html
[2] https://reviews.llvm.org/rL289785
[3] https://reviews.llvm.org/D27986

Diff Detail

Event Timeline

christof created this revision.Feb 20 2017, 7:37 AM
christof updated this revision to Diff 89203.Feb 21 2017, 6:51 AM
christof added reviewers: atanasyan, sdardis.

To clarify. This patch fixes some cases where:

clang -S file.c -o - | clang -c - -o file.o

is not identical to:

clang -c file.c -o file.o

because the assembly output 'forgets' some of the flags in the output assembly.

This impacts some assembly test that cover the MIPS code generator. In general, code generators that have section header flags without any assembly syntax will now use the new hex notation.

atanasyan resigned from this revision.Nov 16 2017, 1:20 PM
espindola edited reviewers, added: espindola; removed: rafael.Mar 15 2018, 9:29 AM