aboutsummaryrefslogtreecommitdiffstats
path: root/linker
diff options
context:
space:
mode:
authorDmitriy Ivanov2014-09-16 17:51:25 -0500
committerDmitriy Ivanov2014-09-16 20:19:36 -0500
commit4a6e9a835a84aca965f0170f604381dae7f130be (patch)
tree278bb71a8d283adf6c4d2662dea791781a811929 /linker
parentaea393c096460669647acbe803617affc5bc0697 (diff)
downloadplatform-bionic-4a6e9a835a84aca965f0170f604381dae7f130be.tar.gz
platform-bionic-4a6e9a835a84aca965f0170f604381dae7f130be.tar.xz
platform-bionic-4a6e9a835a84aca965f0170f604381dae7f130be.zip
Fix some unused DT_ warnings
* DT_PLTGOT - ignored for non-mips * DT_RELCOUNT/RELACOUNT - ignored * DT_RELENT/RELAENT - sanity checks * DT_SYMENT - sanity check * DT_SONAME - ignore for now. Change-Id: Ied90748d12f733a84f6c38a1250567a2f77608b7
Diffstat (limited to 'linker')
-rw-r--r--linker/linker.cpp39
1 files changed, 35 insertions, 4 deletions
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 5e408877..c46c1e25 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -1859,6 +1859,10 @@ bool soinfo::PrelinkImage() {
1859 DEBUG("d = %p, d[0](tag) = %p d[1](val) = %p", 1859 DEBUG("d = %p, d[0](tag) = %p d[1](val) = %p",
1860 d, reinterpret_cast<void*>(d->d_tag), reinterpret_cast<void*>(d->d_un.d_val)); 1860 d, reinterpret_cast<void*>(d->d_tag), reinterpret_cast<void*>(d->d_un.d_val));
1861 switch (d->d_tag) { 1861 switch (d->d_tag) {
1862 case DT_SONAME:
1863 // TODO: glibc dynamic linker uses this name for
1864 // initial library lookup; consider doing the same here.
1865 break;
1862 case DT_HASH: 1866 case DT_HASH:
1863 nbucket = reinterpret_cast<uint32_t*>(load_bias + d->d_un.d_ptr)[0]; 1867 nbucket = reinterpret_cast<uint32_t*>(load_bias + d->d_un.d_ptr)[0];
1864 nchain = reinterpret_cast<uint32_t*>(load_bias + d->d_un.d_ptr)[1]; 1868 nchain = reinterpret_cast<uint32_t*>(load_bias + d->d_un.d_ptr)[1];
@@ -1871,6 +1875,12 @@ bool soinfo::PrelinkImage() {
1871 case DT_SYMTAB: 1875 case DT_SYMTAB:
1872 symtab = reinterpret_cast<ElfW(Sym)*>(load_bias + d->d_un.d_ptr); 1876 symtab = reinterpret_cast<ElfW(Sym)*>(load_bias + d->d_un.d_ptr);
1873 break; 1877 break;
1878 case DT_SYMENT:
1879 if (d->d_un.d_val != sizeof(ElfW(Sym))) {
1880 DL_ERR("invalid DT_SYMENT: %d", d->d_un.d_val);
1881 return false;
1882 }
1883 break;
1874#if !defined(__LP64__) 1884#if !defined(__LP64__)
1875 case DT_PLTREL: 1885 case DT_PLTREL:
1876 if (d->d_un.d_val != DT_REL) { 1886 if (d->d_un.d_val != DT_REL) {
@@ -1893,12 +1903,13 @@ bool soinfo::PrelinkImage() {
1893 plt_rel_count = d->d_un.d_val / sizeof(ElfW(Rel)); 1903 plt_rel_count = d->d_un.d_val / sizeof(ElfW(Rel));
1894#endif 1904#endif
1895 break; 1905 break;
1896#if defined(__mips__)
1897 case DT_PLTGOT: 1906 case DT_PLTGOT:
1907#if defined(__mips__)
1898 // Used by mips and mips64. 1908 // Used by mips and mips64.
1899 plt_got = reinterpret_cast<ElfW(Addr)**>(load_bias + d->d_un.d_ptr); 1909 plt_got = reinterpret_cast<ElfW(Addr)**>(load_bias + d->d_un.d_ptr);
1900 break;
1901#endif 1910#endif
1911 // Ignore for other platforms... (because RTLD_LAZY is not supported)
1912 break;
1902 case DT_DEBUG: 1913 case DT_DEBUG:
1903 // Set the DT_DEBUG entry to the address of _r_debug for GDB 1914 // Set the DT_DEBUG entry to the address of _r_debug for GDB
1904 // if the dynamic table is writable 1915 // if the dynamic table is writable
@@ -1919,6 +1930,15 @@ bool soinfo::PrelinkImage() {
1919 case DT_RELASZ: 1930 case DT_RELASZ:
1920 rela_count = d->d_un.d_val / sizeof(ElfW(Rela)); 1931 rela_count = d->d_un.d_val / sizeof(ElfW(Rela));
1921 break; 1932 break;
1933 case DT_RELAENT:
1934 if (d->d_un.d_val != sizeof(ElfW(Rela))) {
1935 DL_ERR("invalid DT_RELAENT: %d", d->d_un.d_val);
1936 return false;
1937 }
1938 break;
1939 case DT_RELACOUNT:
1940 // ignored (see DT_RELCOUNT comments for details)
1941 break;
1922 case DT_REL: 1942 case DT_REL:
1923 DL_ERR("unsupported DT_REL in \"%s\"", name); 1943 DL_ERR("unsupported DT_REL in \"%s\"", name);
1924 return false; 1944 return false;
@@ -1932,6 +1952,19 @@ bool soinfo::PrelinkImage() {
1932 case DT_RELSZ: 1952 case DT_RELSZ:
1933 rel_count = d->d_un.d_val / sizeof(ElfW(Rel)); 1953 rel_count = d->d_un.d_val / sizeof(ElfW(Rel));
1934 break; 1954 break;
1955 case DT_RELENT:
1956 if (d->d_un.d_val != sizeof(ElfW(Rel))) {
1957 DL_ERR("invalid DT_RELENT: %d", d->d_un.d_val);
1958 return false;
1959 }
1960 break;
1961 case DT_RELCOUNT:
1962 // "Indicates that all RELATIVE relocations have been concatenated together,
1963 // and specifies the RELATIVE relocation count."
1964 //
1965 // TODO: Spec also mentions that this can be used to optimize relocation process;
1966 // Not currently used by bionic linker - ignored.
1967 break;
1935 case DT_RELA: 1968 case DT_RELA:
1936 DL_ERR("unsupported DT_RELA in \"%s\"", name); 1969 DL_ERR("unsupported DT_RELA in \"%s\"", name);
1937 return false; 1970 return false;
@@ -1991,8 +2024,6 @@ bool soinfo::PrelinkImage() {
1991 break; 2024 break;
1992#if defined(__mips__) 2025#if defined(__mips__)
1993 case DT_STRSZ: 2026 case DT_STRSZ:
1994 case DT_SYMENT:
1995 case DT_RELENT:
1996 break; 2027 break;
1997 case DT_MIPS_RLD_MAP: 2028 case DT_MIPS_RLD_MAP:
1998 // Set the DT_MIPS_RLD_MAP entry to the address of _r_debug for GDB. 2029 // Set the DT_MIPS_RLD_MAP entry to the address of _r_debug for GDB.