summaryrefslogtreecommitdiff
path: root/platform/x11
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-01-16 18:45:20 +0100
committerGitHub <noreply@github.com>2020-01-16 18:45:20 +0100
commit6b64c60b0eade65ca1147a0af39baefec732d652 (patch)
tree4b21f890e3ee4eca81793918a401532474c65226 /platform/x11
parentf2aa99a8e2d33e534fa3adbff2981a9c902bbf32 (diff)
parent4eeae592935920370c75b83dff1883dbd980f20e (diff)
Merge pull request #35209 from RandomShaper/fix_pck_embed_linux
Fix error exporting to X11 with embedded PCK
Diffstat (limited to 'platform/x11')
-rw-r--r--platform/x11/detect.py12
-rw-r--r--platform/x11/pck_embed.ld4
-rw-r--r--platform/x11/pck_embed.legacy.ld10
3 files changed, 21 insertions, 5 deletions
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index a961072bd6..957779ee83 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -171,7 +171,7 @@ def configure(env):
else:
env.Append(CCFLAGS=['-flto'])
env.Append(LINKFLAGS=['-flto'])
-
+
if not env['use_llvm']:
env['RANLIB'] = 'gcc-ranlib'
env['AR'] = 'gcc-ar'
@@ -329,9 +329,15 @@ def configure(env):
if env["execinfo"]:
env.Append(LIBS=['execinfo'])
-
+
if not env['tools']:
- env.Append(LINKFLAGS=['-T', 'platform/x11/pck_embed.ld'])
+ import subprocess
+ import re
+ binutils_version = re.search('\s(\d+\.\d+)', str(subprocess.check_output(['ld', '-v']))).group(1)
+ if float(binutils_version) >= 2.30:
+ env.Append(LINKFLAGS=['-T', 'platform/x11/pck_embed.ld'])
+ else:
+ env.Append(LINKFLAGS=['-T', 'platform/x11/pck_embed.legacy.ld'])
## Cross-compilation
diff --git a/platform/x11/pck_embed.ld b/platform/x11/pck_embed.ld
index fe09144d88..57a1994043 100644
--- a/platform/x11/pck_embed.ld
+++ b/platform/x11/pck_embed.ld
@@ -1,9 +1,9 @@
SECTIONS
{
/* Add a zero-sized section; the exporter will patch it to enclose the data appended to the executable (embedded PCK) */
- pck 0 (NOLOAD) :
+ pck 0 (INFO) :
{
- /* Just some content to avoid the linker discarding the section */
+ /* binutils >= 2.30 allow it being zero-sized, but needs something between the braces to keep the section */
. = ALIGN(8);
}
}
diff --git a/platform/x11/pck_embed.legacy.ld b/platform/x11/pck_embed.legacy.ld
new file mode 100644
index 0000000000..a23013ba7a
--- /dev/null
+++ b/platform/x11/pck_embed.legacy.ld
@@ -0,0 +1,10 @@
+SECTIONS
+{
+ /* The exporter will patch this section to enclose the data appended to the executable (embedded PCK) */
+ pck 0 (INFO) : AT ( ADDR (.rodata) + SIZEOF (.rodata) )
+ {
+ /* binutils < 2.30 need some actual content for the linker not to discard the section */
+ BYTE(0);
+ }
+}
+INSERT AFTER .rodata;