Add dummy handlers for .global/.globl directives
MODIFY
src/assembler/gnudirectives.cpp
src/assembler/gnudirectives.cpp
@@ -26,6 +26,9 @@ DirectiveVec gnuDirectives() {
add_directive(directives, textDirective());
add_directive(directives, bssDirective());
+ add_directive(directives, dummyDirective(".global"));
+ add_directive(directives, dummyDirective(".globl"));
+
return directives;
}
@@ -111,6 +114,15 @@ Directive stringDirective() {
return Directive(".string", &stringFunctor);
}
+/**
+ * @brief dummyDirective
+ * Generates a directive handler for @p name, which returns nothing. To be used for compatability reasons.
+ */
+Directive dummyDirective(const QString& name) {
+ return Directive(name,
+ [](const AssemblerBase*, const DirectiveArg&) -> HandleDirectiveRes { return {QByteArray()}; });
+}
+
Directive::DirectiveHandler genSegmentChangeFunctor(const QString& segment) {
return [segment](const AssemblerBase* assembler, const DirectiveArg& arg) {
if (arg.line.tokens.length() != 0) {

MODIFY
src/assembler/gnudirectives.h
src/assembler/gnudirectives.h
@@ -27,6 +27,8 @@ Directive fourByteDirective();
Directive longDirective();
Directive alignDirective();
+Directive dummyDirective(const QString& name);
+
Directive textDirective();
Directive dataDirective();
Directive bssDirective();

Add dummy handlers for .global/.globl directives