@@ -218,20 +218,21 @@ struct Action
218218 const char * const filename;
219219 const char * const symbol;
220220 const ELF * elf;
221- Plugin *plugin;
221+ Plugin * const plugin;
222222 void *context;
223- std::vector<Argument> args;
224- bool clean;
225- CallKind call;
223+ const std::vector<Argument> args;
224+ const bool clean;
225+ const bool noalign;
226+ const CallKind call;
226227
227228 Action (const char *string, MatchEntries &&entries, ActionKind kind,
228229 const char *name, const char *filename, const char *symbol,
229230 Plugin *plugin, const std::vector<Argument> &&args, bool clean,
230- CallKind call) :
231+ bool noalign, CallKind call) :
231232 string (string), entries(std::move(entries)), kind(kind),
232233 name (name), filename(filename), symbol(symbol), elf(nullptr ),
233234 plugin(plugin), context(nullptr ), args(args), clean(clean),
234- call(call)
235+ noalign(noalign), call(call)
235236 {
236237 ;
237238 }
@@ -635,7 +636,7 @@ static Action *parseAction(const char *str, MatchEntries &entries)
635636 // Parse call or plugin (if necessary):
636637 CallKind call = CALL_BEFORE;
637638 bool clean = false , naked = false , before = false , after = false ,
638- replace = false , conditional = false ;
639+ replace = false , conditional = false , noalign = false ;
639640 const char *symbol = nullptr ;
640641 const char *filename = nullptr ;
641642 Plugin *plugin = nullptr ;
@@ -670,6 +671,8 @@ static Action *parseAction(const char *str, MatchEntries &entries)
670671 conditional = true ; break ;
671672 case TOKEN_NAKED:
672673 naked = true ; break ;
674+ case TOKEN_NOALIGN:
675+ noalign = true ; break ;
673676 case TOKEN_REPLACE:
674677 replace = true ; break ;
675678 default :
@@ -856,6 +859,7 @@ static Action *parseAction(const char *str, MatchEntries &entries)
856859 error (" failed to parse call action; only one of the `before', "
857860 " `after', `replace' and `conditional' attributes can be used "
858861 " together" );
862+ noalign = (naked? true : noalign);
859863 clean = (clean? true : !naked);
860864 call = (after? CALL_AFTER:
861865 (replace? CALL_REPLACE:
@@ -909,7 +913,7 @@ static Action *parseAction(const char *str, MatchEntries &entries)
909913 }
910914
911915 Action *action = new Action (str, std::move (entries), kind, name, filename,
912- symbol, plugin, std::move (args), clean, call);
916+ symbol, plugin, std::move (args), clean, noalign, call);
913917 return action;
914918}
915919
@@ -1436,6 +1440,8 @@ static void usage(FILE *stream, const char *progname)
14361440 fputc (' \n ' , stream);
14371441 fputs (" \t\t\t - OPTION is one of:\n " , stream);
14381442 fputs (" \t\t\t * \" clean\" /\" naked\" for clean/naked calls.\n " , stream);
1443+ fputs (" \t\t\t * \" noalign\" disables stack alignment for clean calls.\n " ,
1444+ stream);
14391445 fputs (" \t\t\t * \" before\" /\" after\" /\" replace\" /\" conditional\" for\n " ,
14401446 stream);
14411447 fputs (" \t\t\t inserting the call before/after the instruction, or\n " ,
@@ -1904,7 +1910,8 @@ int main(int argc, char **argv)
19041910 if (j == have_call.end ())
19051911 {
19061912 sendCallTrampolineMessage (backend.out , action->name ,
1907- action->args , action->clean , action->call );
1913+ action->args , action->clean , action->noalign ,
1914+ action->call );
19081915 have_call.insert (action->name );
19091916 }
19101917 break ;
0 commit comments