///
class YAMLAbsoluteAtom : public AbsoluteAtom {
public:
- YAMLAbsoluteAtom(YAMLFile &f, int32_t, StringRef name, uint64_t v)
+ YAMLAbsoluteAtom(YAMLFile &f, int32_t, StringRef name, uint64_t v, Atom::Scope scope)
: _file(f)
, _name(name)
- , _value(v) {
+ , _value(v)
+ , _scope(scope){
}
virtual const class File &file() const {
}
virtual Scope scope() const {
- return scopeGlobal;
+ return _scope;
}
virtual StringRef name() const {
YAMLFile &_file;
StringRef _name;
uint64_t _value;
+ Atom::Scope _scope;
};
+ "' has attributes only allowed on shared library atoms");
_error = make_error_code(yaml_reader_error::illegal_value);
}
- AbsoluteAtom *a = new YAMLAbsoluteAtom(*_file, _ordinal, _name, _value);
+ AbsoluteAtom *a = new YAMLAbsoluteAtom(*_file, _ordinal, _name, _value,
+ _scope);
_file->addAbsoluteAtom(a);
}
_stream->printError(node, "Invalid value for 'scope:'");
_error = make_error_code(yaml_reader_error::illegal_value);
}
- _hasDefinedAtomAttributes = true;
}
void YAMLState::parseAtomDefinition(ScalarNode *node) {
--- /dev/null
+# RUN: lld-core %s | FileCheck %s
+
+#
+# Test that absolute symbols with local scope do not cause name conflict
+#
+---
+atoms:
+ - name: putchar
+ definition: absolute
+ value: 0xFFFF0040
+ scope: static
+
+ - name: putchar
+ definition: absolute
+ value: 0xFFFF0040
+ scope: static
+...
+
+# CHECK: ---
+# CHECK: - name: putchar
+# CHECK: definition: absolute
+# CHECK: value: 0xffff0040
+# CHECK: - name: putchar
+# CHECK: definition: absolute
+# CHECK: value: 0xffff0040
+# CHECK: ...