Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improved plugin & associated makefile for recent target toolchains #411

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions buildtools/gcc-nexmon-plugin/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
all: nexmon.so

TARGET = ../gcc-arm-none-eabi-5_4-2016q2-linux-x86
TARGET_CXX = $(TARGET)/bin/arm-none-eabi-g++
TARGET_CXX_VERSION = $(shell $(TARGET_CXX) -dumpversion | awk -F "." '{print $$1}')
TARGET_PLUGIN_DIR = $(shell $(TARGET_CXX) -print-file-name=plugin)/include

CXXFLAGS = -std=c++11
CXXFLAGS += -Wall -Wno-literal-suffix
CXXFLAGS += -fno-rtti
CXXFLAGS += -m32
CXXFLAGS += -fPIC
CXXFLAGS += -I$(TARGET_PLUGIN_DIR)
CXXFLAGS += -DTARGET_CXX_VERSION=$(TARGET_CXX_VERSION)

nexmon.so: nexmon.o
g++ -m32 -shared -o $@ $<
g++ -$(CXXFLAGS) -shared -o $@ $<

nexmon.o: nexmon.c
g++ -std=c++11 -Wall -fno-rtti -Wno-literal-suffix -m32 -fPIC -I../gcc-arm-none-eabi-5_4-2016q2-linux-x86/lib/gcc/arm-none-eabi/5.4.1/plugin/include -c -o $@ $<
g++ $(CXXFLAGS) -c -o $@ $<

clean:
rm -f *.o *.so
rm -f *.o *.so
12 changes: 11 additions & 1 deletion buildtools/gcc-nexmon-plugin/nexmon.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#if TARGET_CXX_VERSION >= 6
#include <gcc-plugin.h>
#else
#include <plugin.h>
#endif

#include <tree.h>
#include <print-tree.h>
#include <stdio.h>
Expand Down Expand Up @@ -28,8 +33,13 @@ static struct attribute_spec user_attr =
.decl_required = true,
.type_required = false,
.function_type_required = false,
#if TARGET_CXX_VERSION >= 6
.affects_type_identity = false,
.handler = handle_nexmon_place_at_attribute,
#else
.handler = handle_nexmon_place_at_attribute,
.affects_type_identity = false,
#endif
};

static tree
Expand Down Expand Up @@ -172,4 +182,4 @@ plugin_init(struct plugin_name_args *info, struct plugin_gcc_version *ver)
register_callback("nexmon", PLUGIN_FINISH, handle_plugin_finish, NULL);

return 0;
}
}