+ int namelen = 0;
+ // DEF: is the version default? LOCAL: is the symbol forced local?
+ bool def = false;
+ bool local = false;
+
+ if (ver != NULL)
+ {
+ // The symbol name is of the form foo@VERSION or foo@@VERSION
+ namelen = ver - name;
+ ++ver;
+ if (*ver == '@')
+ {
+ def = true;
+ ++ver;
+ }
+ }
+ else if (!version_script_.empty())
+ {
+ // The symbol name did not have a version, but
+ // the version script may assign a version anyway.
+ namelen = strlen(name);
+ def = true;
+ // Check the global: entries from the version script.
+ const std::string& version =
+ version_script_.get_symbol_version(name);
+ if (!version.empty())
+ ver = version.c_str();
+ // Check the local: entries from the version script
+ if (version_script_.symbol_is_local(name))
+ local = true;
+ }
+
+ if (just_symbols)
+ {
+ if (psym != &sym2)
+ memcpy(symbuf, p, sym_size);
+ elfcpp::Sym_write<size, big_endian> sw(symbuf);
+ sw.put_st_shndx(elfcpp::SHN_ABS);
+ if (st_shndx != elfcpp::SHN_UNDEF
+ && st_shndx < elfcpp::SHN_LORESERVE)
+ {
+ // Symbol values in object files are section relative.
+ // This is normally what we want, but since here we are
+ // converting the symbol to absolute we need to add the
+ // section address. The section address in an object
+ // file is normally zero, but people can use a linker
+ // script to change it.
+ sw.put_st_value(sym2.get_st_value()
+ + relobj->section_address(st_shndx));
+ }
+ psym = &sym2;
+ }