Changes in src/InitTweak/FixGlobalInit.cc [6fbe9a5:07de76b]
- File:
-
- 1 edited
-
src/InitTweak/FixGlobalInit.cc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/FixGlobalInit.cc
r6fbe9a5 r07de76b 112 112 } // if 113 113 if ( Statement * ctor = ctorInit->ctor ) { 114 // Translation 1: Add this attribute on the global declaration:115 // __attribute__((section (".data#")))116 // which makes gcc put the global in the data section,117 // so that the global is writeable (via a const cast) in the init function.118 // The trailing # is an injected assembly comment, to suppress the "a" in119 // .section .data,"a"120 // .section .data#,"a"121 // to avoid assembler warning "ignoring changed section attributes for .data"122 Type *strLitT = new PointerType( Type::Qualifiers( ),123 new BasicType( Type::Qualifiers( ), BasicType::Char ) );124 std::list< Expression * > attr_params;125 attr_params.push_back(126 new ConstantExpr( Constant( strLitT, "\".data#\"", std::nullopt ) ) );127 objDecl->attributes.push_back(new Attribute("section", attr_params));128 // Translation 2: Move the initizliation off the global declaration,129 // into the startup function.130 114 initStatements.push_back( ctor ); 131 115 objDecl->init = nullptr;
Note:
See TracChangeset
for help on using the changeset viewer.