[lld] r230190 - [Core] Fix handling of Section Groups.

Shankar Easwaran shankare at codeaurora.org
Sun Feb 22 15:40:58 PST 2015


Author: shankare
Date: Sun Feb 22 17:40:58 2015
New Revision: 230190

URL: http://llvm.org/viewvc/llvm-project?rev=230190&view=rev
Log:
[Core] Fix handling of Section Groups.

There is code(added by me) in the YAMLReader which isn't correct when it handles references
for section groups. The test case was also checking for wrong outputs.

This fixes the bug and the testcase so that they check for proper outputs.

Modified:
    lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
    lld/trunk/test/core/gnulinkonce-resolve.objtxt
    lld/trunk/test/core/gnulinkonce-simple.objtxt
    lld/trunk/test/core/sectiongroup-deadstrip.objtxt
    lld/trunk/test/core/sectiongroup-resolve.objtxt
    lld/trunk/test/core/sectiongroup-simple.objtxt

Modified: lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp?rev=230190&r1=230189&r2=230190&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp (original)
+++ lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp Sun Feb 22 17:40:58 2015
@@ -67,15 +67,6 @@ public:
       if (!atom->name().empty())
         buildDuplicateNameMap(*atom);
 
-      if (atom->isGroupParent()) {
-        for (const lld::Reference *ref : *atom) {
-          if (ref->kindNamespace() != lld::Reference::KindNamespace::all)
-            continue;
-          if (ref->kindValue() == lld::Reference::kindGroupChild)
-            buildDuplicateNameMap(*ref->target());
-        }
-      }
-
       // Find references to unnamed atoms and create ref-names for them.
       for (const lld::Reference *ref : *atom) {
         // create refname for any unnamed reference target

Modified: lld/trunk/test/core/gnulinkonce-resolve.objtxt
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/core/gnulinkonce-resolve.objtxt?rev=230190&r1=230189&r2=230190&view=diff
==============================================================================
--- lld/trunk/test/core/gnulinkonce-resolve.objtxt (original)
+++ lld/trunk/test/core/gnulinkonce-resolve.objtxt Sun Feb 22 17:40:58 2015
@@ -67,27 +67,23 @@ defined-atoms:
 #CHECK:     references:
 #CHECK:       - kind:            group-child
 #CHECK:         offset:          0
-#CHECK:         target:          [[GCHILDONE:[a-zA-Z\.0-9_]+]]
+#CHECK:         target:          f1
 #CHECK:       - kind:            group-child
 #CHECK:         offset:          0
-#CHECK:         target:          [[GCHILDTWO:[a-zA-Z\.0-9_]+]]
+#CHECK:         target:          f2
 #CHECK:       - kind:            group-child
 #CHECK:         offset:          0
-#CHECK:         target:          [[GCHILDTHREE:[a-zA-Z\.0-9_]+]]
+#CHECK:         target:          [[GCHILD:[a-zA-Z\.0-9_]+]]
 #CHECK:       - kind:            group-child
 #CHECK:         offset:          0
-#CHECK:         target:          [[GCHILDFOUR:[a-zA-Z\.0-9_]+]]
+#CHECK:         target:          d1
 #CHECK:   - name:            f1
-#CHECK:     ref-name:        [[GCHILDONE]]
 #CHECK:     scope:           global
 #CHECK:   - name:            f2
-#CHECK:     ref-name:        [[GCHILDTWO]]
 #CHECK:     scope:           global
 #CHECK:   - name:            g1
-#CHECK:     ref-name:        [[GCHILDTHREE]]
+#CHECK:     ref-name:        [[GCHILD]]
 #CHECK:     scope:           global
 #CHECK:   - name:            d1
-#CHECK:     ref-name:        [[GCHILDFOUR]]
 #CHECK:     scope:           global
 #CHECK:     type:            data
-#CHECK: ...

Modified: lld/trunk/test/core/gnulinkonce-simple.objtxt
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/core/gnulinkonce-simple.objtxt?rev=230190&r1=230189&r2=230190&view=diff
==============================================================================
--- lld/trunk/test/core/gnulinkonce-simple.objtxt (original)
+++ lld/trunk/test/core/gnulinkonce-simple.objtxt Sun Feb 22 17:40:58 2015
@@ -51,28 +51,25 @@ undefined-atoms:
 #CHECK:     references:
 #CHECK:       - kind:            group-child
 #CHECK:         offset:          0
-#CHECK:         target:          [[GCHILDONE:[a-zA-Z\.0-9_]+]]
+#CHECK:         target:          f1
 #CHECK:       - kind:            group-child
 #CHECK:         offset:          0
-#CHECK:         target:          [[GCHILDTWO:[a-zA-Z\.0-9_]+]]
+#CHECK:         target:          f2
 #CHECK:       - kind:            group-child
 #CHECK:         offset:          0
-#CHECK:         target:          [[GCHILDTHREE:[a-zA-Z\.0-9_]+]]
+#CHECK:         target:          d1
 #CHECK:       - kind:            group-child
 #CHECK:         offset:          0
-#CHECK:         target:          [[GCHILDFOUR:[a-zA-Z\.0-9_]+]]
+#CHECK:         target:          [[GCHILD:[a-zA-Z\.0-9_]+]]
 #CHECK:   - name:            f1
-#CHECK:     ref-name:        [[GCHILDONE]]
 #CHECK:     scope:           global
 #CHECK:   - name:            f2
-#CHECK:     ref-name:        [[GCHILDTWO]]
 #CHECK:     scope:           global
 #CHECK:   - name:            d1
-#CHECK:     ref-name:        [[GCHILDTHREE]]
 #CHECK:     scope:           global
 #CHECK:     type:            data
 #CHECK:   - name:            g1
-#CHECK:     ref-name:        [[GCHILDFOUR]]
+#CHECK:     ref-name:        [[GCHILD]]
 #CHECK:     scope:           global
 #CHECK:   - name:            anotherfunction
 #CHECK:     scope:           global
@@ -80,5 +77,4 @@ undefined-atoms:
 #CHECK:     references:
 #CHECK:       - kind:            layout-before
 #CHECK:         offset:          0
-#CHECK:         target:          [[GCHILDONE]]
-#CHECK: ...
+#CHECK:         target:          f1

Modified: lld/trunk/test/core/sectiongroup-deadstrip.objtxt
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/core/sectiongroup-deadstrip.objtxt?rev=230190&r1=230189&r2=230190&view=diff
==============================================================================
--- lld/trunk/test/core/sectiongroup-deadstrip.objtxt (original)
+++ lld/trunk/test/core/sectiongroup-deadstrip.objtxt Sun Feb 22 17:40:58 2015
@@ -59,28 +59,25 @@ undefined-atoms:
 #CHECK:     references:
 #CHECK:       - kind:            group-child
 #CHECK:         offset:          0
-#CHECK:         target:          [[GCHILDONE:[a-zA-Z\.0-9_]+]]
+#CHECK:         target:          f1
 #CHECK:       - kind:            group-child
 #CHECK:         offset:          0
-#CHECK:         target:          [[GCHILDTWO:[a-zA-Z\.0-9_]+]]
+#CHECK:         target:          f2
 #CHECK:       - kind:            group-child
 #CHECK:         offset:          0
-#CHECK:         target:          [[GCHILDTHREE:[a-zA-Z\.0-9_]+]]
+#CHECK:         target:          d1
 #CHECK:       - kind:            group-child
 #CHECK:         offset:          0
-#CHECK:         target:          [[GCHILDFOUR:[a-zA-Z\.0-9_]+]]
+#CHECK:         target:          [[GCHILD:[a-zA-Z\.0-9_]+]]
 #CHECK:   - name:            f1
-#CHECK:     ref-name:        [[GCHILDONE]]
 #CHECK:     scope:           global
 #CHECK:   - name:            f2
-#CHECK:     ref-name:        [[GCHILDTWO]]
 #CHECK:     scope:           global
 #CHECK:   - name:            d1
-#CHECK:     ref-name:        [[GCHILDTHREE]]
 #CHECK:     scope:           global
 #CHECK:     type:            data
 #CHECK:   - name:            g1
-#CHECK:     ref-name:        [[GCHILDFOUR]]
+#CHECK:     ref-name:        [[GCHILD]]
 #CHECK:     scope:           global
 #CHECK:   - name:            anotherfunction
 #CHECK:     scope:           global
@@ -88,5 +85,4 @@ undefined-atoms:
 #CHECK:     references:
 #CHECK:       - kind:            layout-before
 #CHECK:         offset:          0
-#CHECK:         target:          [[GCHILDONE]]
-#CHECK: ...
+#CHECK:         target:          f1

Modified: lld/trunk/test/core/sectiongroup-resolve.objtxt
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/core/sectiongroup-resolve.objtxt?rev=230190&r1=230189&r2=230190&view=diff
==============================================================================
--- lld/trunk/test/core/sectiongroup-resolve.objtxt (original)
+++ lld/trunk/test/core/sectiongroup-resolve.objtxt Sun Feb 22 17:40:58 2015
@@ -67,27 +67,24 @@ defined-atoms:
 #CHECK:     references:
 #CHECK:       - kind:            group-child
 #CHECK:         offset:          0
-#CHECK:         target:          [[GCHILDONE:[a-zA-Z\.0-9_]+]]
+#CHECK:         target:          f1
 #CHECK:       - kind:            group-child
 #CHECK:         offset:          0
-#CHECK:         target:          [[GCHILDTWO:[a-zA-Z\.0-9_]+]]
+#CHECK:         target:          f2
 #CHECK:       - kind:            group-child
 #CHECK:         offset:          0
-#CHECK:         target:          [[GCHILDTHREE:[a-zA-Z\.0-9_]+]]
+#CHECK:         target:          [[GCHILD:[a-zA-Z\.0-9_]+]]
 #CHECK:       - kind:            group-child
 #CHECK:         offset:          0
-#CHECK:         target:          [[GCHILDFOUR:[a-zA-Z\.0-9_]+]]
+#CHECK:         target:          d1
 #CHECK:   - name:            f1
-#CHECK:     ref-name:        [[GCHILDONE]]
 #CHECK:     scope:           global
 #CHECK:   - name:            f2
-#CHECK:     ref-name:        [[GCHILDTWO]]
 #CHECK:     scope:           global
 #CHECK:   - name:            g1
-#CHECK:     ref-name:        [[GCHILDTHREE]]
+#CHECK:     ref-name:        [[GCHILD]]
 #CHECK:     scope:           global
 #CHECK:   - name:            d1
-#CHECK:     ref-name:        [[GCHILDFOUR]]
 #CHECK:     scope:           global
 #CHECK:     type:            data
 #CHECK: ...

Modified: lld/trunk/test/core/sectiongroup-simple.objtxt
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/core/sectiongroup-simple.objtxt?rev=230190&r1=230189&r2=230190&view=diff
==============================================================================
--- lld/trunk/test/core/sectiongroup-simple.objtxt (original)
+++ lld/trunk/test/core/sectiongroup-simple.objtxt Sun Feb 22 17:40:58 2015
@@ -51,28 +51,25 @@ undefined-atoms:
 #CHECK:     references:
 #CHECK:       - kind:            group-child
 #CHECK:         offset:          0
-#CHECK:         target:          [[GCHILDONE:[a-zA-Z\.0-9_]+]]
+#CHECK:         target:          f1
 #CHECK:       - kind:            group-child
 #CHECK:         offset:          0
-#CHECK:         target:          [[GCHILDTWO:[a-zA-Z\.0-9_]+]]
+#CHECK:         target:          f2
 #CHECK:       - kind:            group-child
 #CHECK:         offset:          0
-#CHECK:         target:          [[GCHILDTHREE:[a-zA-Z\.0-9_]+]]
+#CHECK:         target:          d1
 #CHECK:       - kind:            group-child
 #CHECK:         offset:          0
-#CHECK:         target:          [[GCHILDFOUR:[a-zA-Z\.0-9_]+]]
+#CHECK:         target:          [[GCHILD:[a-zA-Z\.0-9_]+]]
 #CHECK:   - name:            f1
-#CHECK:     ref-name:        [[GCHILDONE]]
 #CHECK:     scope:           global
 #CHECK:   - name:            f2
-#CHECK:     ref-name:        [[GCHILDTWO]]
 #CHECK:     scope:           global
 #CHECK:   - name:            d1
-#CHECK:     ref-name:        [[GCHILDTHREE]]
 #CHECK:     scope:           global
 #CHECK:     type:            data
 #CHECK:   - name:            g1
-#CHECK:     ref-name:        [[GCHILDFOUR]]
+#CHECK:     ref-name:        [[GCHILD]]
 #CHECK:     scope:           global
 #CHECK:   - name:            anotherfunction
 #CHECK:     scope:           global
@@ -80,5 +77,4 @@ undefined-atoms:
 #CHECK:     references:
 #CHECK:       - kind:            layout-before
 #CHECK:         offset:          0
-#CHECK:         target:          [[GCHILDONE]]
-#CHECK: ...
+#CHECK:         target:          f1





More information about the llvm-commits mailing list