lldb_private::Section objects have a boolean flag that can be set that 
indicates that the section is thread specific. Any functions the load a module
given a slide, will currently ignore any sections that are thread specific.

lldb_private::Section now has:

bool
Section::IsThreadSpecific () const
{
    return m_thread_specific;
}

void
Section::SetIsThreadSpecific (bool b)
{
    m_thread_specific = b;
}

The ELF plug-in has been modified to set this for the ".tdata" and the ".tbss"
sections.

Eventually we need to have each lldb_private::Thread subclass be able to 
resolve a thread specific section, but for now they will just not resolve. The
code for that should be trivual to add, but the address resolving functions
will need to be changed to take a "ExecutionContext" object instead of just
a target so that thread specific sections can be resolved.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@153537 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBTarget.cpp b/source/API/SBTarget.cpp
index 0adbb0a..97b4e47 100644
--- a/source/API/SBTarget.cpp
+++ b/source/API/SBTarget.cpp
@@ -2086,12 +2086,23 @@
         }
         else
         {
-            target_sp->GetSectionLoadList().SetSectionLoadAddress (section.GetSP().get(), section_base_addr);
+            SectionSP section_sp (section.GetSP());
+            if (section_sp)
+            {
+                if (section_sp->IsThreadSpecific())
+                {
+                    sb_error.SetErrorString ("thread specific sections are not yet supported");
+                }
+                else
+                {
+                    target_sp->GetSectionLoadList().SetSectionLoadAddress (section_sp.get(), section_base_addr);
+                }
+            }
         }
     }
     else
     {
-        sb_error.SetErrorStringWithFormat ("invalid target");
+        sb_error.SetErrorString ("invalid target");
     }
     return sb_error;
 }
@@ -2132,30 +2143,17 @@
         ModuleSP module_sp (module.GetSP());
         if (module_sp)
         {
-            ObjectFile *objfile = module_sp->GetObjectFile();
-            if (objfile)
+            bool changed = false;
+            if (module_sp->SetLoadAddress (*target_sp, slide_offset, changed))
             {
-                SectionList *section_list = objfile->GetSectionList();
-                if (section_list)
+                // The load was successful, make sure that at least some sections
+                // changed before we notify that our module was loaded.
+                if (changed)
                 {
-                    const size_t num_sections = section_list->GetSize();
-                    for (size_t sect_idx = 0; sect_idx < num_sections; ++sect_idx)
-                    {
-                        SectionSP section_sp (section_list->GetSectionAtIndex(sect_idx));
-                        if (section_sp)
-                            target_sp->GetSectionLoadList().SetSectionLoadAddress (section_sp.get(), section_sp->GetFileAddress() + slide_offset);
-                    }
+                    ModuleList module_list;
+                    module_list.Append(module_sp);
+                    target_sp->ModulesDidLoad (module_list);
                 }
-                else
-                {
-                    module_sp->GetFileSpec().GetPath (path, sizeof(path));
-                    sb_error.SetErrorStringWithFormat ("no sections in object file '%s'", path);
-                }
-            }
-            else
-            {
-                module_sp->GetFileSpec().GetPath (path, sizeof(path));
-                sb_error.SetErrorStringWithFormat ("no object file for module '%s'", path);
             }
         }
         else