Ignore:
Timestamp:
Oct 15, 2020, 9:41:31 PM (3 years ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
ADT, arm-eh, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
afe2939
Parents:
0b18db7
Message:

Expanding earlier #182 fix to another case of the same issue. Fixes #224?

There is now a reusable helper function addDataSectonAttribute that applies the fix to an ObjectDecl? when we realize it needs it. Test const-init is expanded with case of #224.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/InitTweak.h

    r0b18db7 rf1791a4  
    103103        bool isConstExpr( Initializer * init );
    104104
     105        /// Modifies objDecl to have:
     106        ///    __attribute__((section (".data#")))
     107        /// which makes gcc put the declared variable in the data section,
     108        /// which is helpful for global constants on newer gcc versions,
     109        /// so that CFA's generated initialization won't segfault when writing it via a const cast.
     110        /// The trailing # is an injected assembly comment, to suppress the "a" in
     111        ///    .section .data,"a"
     112        ///    .section .data#,"a"
     113        /// to avoid assembler warning "ignoring changed section attributes for .data"
     114        void addDataSectonAttribute( ObjectDecl * objDecl );
     115
    105116        class InitExpander_old {
    106117        public:
Note: See TracChangeset for help on using the changeset viewer.