[ARM] Fix several state persistence bugs
authorKeno Fischer <kfischer@college.harvard.edu>
Tue, 12 Jan 2016 13:38:15 +0000 (13:38 +0000)
committerKeno Fischer <kfischer@college.harvard.edu>
Tue, 12 Jan 2016 13:38:15 +0000 (13:38 +0000)
commit7125c9519fcdbb39eb580398ccfbc1741ddd895c
tree929c288812d1387f7f8a904d1e5a1e225dc178a0
parenta20f3c90ff1ba320bc1af7a56e92ddc11d3b5c03
[ARM] Fix several state persistence bugs

Summary:
This fixes three bugs, in all of which state is not or incorrecly reset between
objects (i.e. when reusing the same pass manager to create multiple object
files):
1) AttributeSection needs to be reset to nullptr, because otherwise the backend
   will try to emit into the old object file's attribute section causing a
   segmentation fault.
2) MappingSymbolCounter needs to be reset, otherwise the second object file
   will start where the first one left off.
3) The MCStreamer base class resets the Streamer's e_flags settings. Since
   EF_ARM_EABI_VER5 is set on streamer creation, we need to set it again
   after the MCStreamer was rest.

Also rename Reset (uppser case) to EHReset to avoid confusion with
reset (lower case).

Reviewers: rengolin
Differential Revision: http://reviews.llvm.org/D15950

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257473 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/MC/MCStreamer.h
lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
lib/Target/ARM/MCTargetDesc/ARMTargetStreamer.cpp
test/MC/ARM/twice.ll [new file with mode: 0644]