Skip to content
Snippets Groups Projects
Commit 1ea6111d authored by BenceJanosSzabo's avatar BenceJanosSzabo
Browse files

Fixed makefilegen segfault, forbidden circular references when improved linking is used


Change-Id: I3ae28ea74d6006e7c4d7e667a1f3b0a43fe00baa
Signed-off-by: default avatarBenceJanosSzabo <bence.janos.szabo@ericsson.com>
parent 6d658030
No related branches found
No related tags found
No related merge requests found
...@@ -699,7 +699,9 @@ bool ProjectGenHelper::sanityCheck() ...@@ -699,7 +699,9 @@ bool ProjectGenHelper::sanityCheck()
for (std::map<std::string, ProjectDescriptor>::reverse_iterator rit = projs.rbegin(); rit != projs.rend(); ++rit) { for (std::map<std::string, ProjectDescriptor>::reverse_iterator rit = projs.rbegin(); rit != projs.rend(); ++rit) {
if ((rit->second).isLibrary() && (rit->second).getLinkingStrategy()) { //dynamic library if ((rit->second).isLibrary() && (rit->second).getLinkingStrategy()) { //dynamic library
ProjectDescriptor& proj = rit->second; ProjectDescriptor& proj = rit->second;
found = DynamicLibraryChecker(&proj, found, &execName); std::vector<std::string> history;
history.push_back(proj.getProjectName());
found = DynamicLibraryChecker(&proj, found, &execName, history);
if (found) { if (found) {
ERROR("Project \"%s\" is dynamic linked library. Sub project \"%s\" is executable.\n" ERROR("Project \"%s\" is dynamic linked library. Sub project \"%s\" is executable.\n"
"in TPD file, %s's all sub-level defaultTarget shall be set library too.", "in TPD file, %s's all sub-level defaultTarget shall be set library too.",
...@@ -748,7 +750,8 @@ void ProjectGenHelper::cleanUp() ...@@ -748,7 +750,8 @@ void ProjectGenHelper::cleanUp()
bool ProjectGenHelper::DynamicLibraryChecker(const ProjectDescriptor* desc, bool ProjectGenHelper::DynamicLibraryChecker(const ProjectDescriptor* desc,
bool& found, bool& found,
char** executableName) char** executableName,
std::vector<std::string>& history)
{ {
if (found || !desc) return true; if (found || !desc) return true;
for (size_t i = 0; i < desc->numOfReferencedProjects(); ++i) { for (size_t i = 0; i < desc->numOfReferencedProjects(); ++i) {
...@@ -756,7 +759,19 @@ bool ProjectGenHelper::DynamicLibraryChecker(const ProjectDescriptor* desc, ...@@ -756,7 +759,19 @@ bool ProjectGenHelper::DynamicLibraryChecker(const ProjectDescriptor* desc,
const ProjectDescriptor* subProj = getTargetOfProject(refProjName); const ProjectDescriptor* subProj = getTargetOfProject(refProjName);
if (0 == checkedProjs.count(subProj->getProjectName())) { if (0 == checkedProjs.count(subProj->getProjectName())) {
if (subProj->isLibrary()) { if (subProj->isLibrary()) {
found = DynamicLibraryChecker(subProj, found, executableName); // Check if we already checked this subproject.
bool inHistory = false;
for (size_t j = 0; j < history.size(); j++) {
if (history[j] == subProj->getProjectName()) {
inHistory = true;
ERROR("Project hierarchy has circular references which is not supported when the improved linking method is used.\n"
"For further information see the TITAN referenceguide.");
}
}
if (!inHistory) {
found = DynamicLibraryChecker(subProj, found, executableName, history);
history.push_back(subProj->getProjectName());
}
} }
else { // search for executable under dynamic linked library else { // search for executable under dynamic linked library
found = true; found = true;
......
...@@ -145,7 +145,8 @@ private: ...@@ -145,7 +145,8 @@ private:
const ProjectDescriptor* getProject(const char* projName) const; const ProjectDescriptor* getProject(const char* projName) const;
bool DynamicLibraryChecker(const ProjectDescriptor* desc, bool DynamicLibraryChecker(const ProjectDescriptor* desc,
bool& found, bool& found,
char** executableName); char** executableName,
std::vector<std::string>& history);
private: private:
static ProjectGenHelper& intance; static ProjectGenHelper& intance;
static const std::string emptyString; static const std::string emptyString;
......
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment