summaryrefslogtreecommitdiffstats
path: root/scripts/relocate_sdk.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-28 14:23:37 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-31 10:30:58 +0100
commitcd3d874fced2ee4c950d9964d30c0588fd8772e7 (patch)
treea0e9777b7106583e51f3271faae6af06526071ea /scripts/relocate_sdk.py
parent20e585543d3e8c143921de665ceed6c0c2c90e73 (diff)
downloadopenembedded-core-contrib-cd3d874fced2ee4c950d9964d30c0588fd8772e7.tar.gz
gcc: Add support for nativesdk-gcc
Being able to build a nativesdk gcc is useful, particularly in cases where the host compiler may be of an incompatible version (or a 32 bit compiler is needed). Sadly, building nativesdk-gcc is not straight forward. We install nativesdk-gcc into a relocatable location and this means that its library locations can change. "Normal" sysroot support doesn't help in this case since the values of paths like "libdir" change, not just base root directory of the system. In order to handle this we do two things: a) Add %r into spec file markup which can be used for injected paths such as SYSTEMLIBS_DIR (see gcc_multilib_setup()). b) Add other paths which need relocation into a .gccrelocprefix section which the relocation code will notice and adjust automatically. This patch adds tweaks to the relocation script to handle the new section too. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/relocate_sdk.py')
-rwxr-xr-xscripts/relocate_sdk.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/scripts/relocate_sdk.py b/scripts/relocate_sdk.py
index b2dd258c34..992db5c47d 100755
--- a/scripts/relocate_sdk.py
+++ b/scripts/relocate_sdk.py
@@ -161,7 +161,18 @@ def change_dl_sysdirs():
# write it back
f.seek(sh_offset)
f.write(new_ldsocache_path)
-
+ elif name == b(".gccrelocprefix"):
+ offset = 0
+ while (offset + 4096) <= sh_size:
+ path = f.read(4096)
+ new_path = old_prefix.sub(new_prefix, path)
+ # pad with zeros
+ new_path += b("\0") * (4096 - len(new_path))
+ #print "Changing %s to %s at %s" % (str(path), str(new_path), str(offset))
+ # write it back
+ f.seek(sh_offset + offset)
+ f.write(new_path)
+ offset = offset + 4096
if sysdirs != "" and sysdirslen != "":
paths = sysdirs.split(b("\0"))
sysdirs = b("")