-
Notifications
You must be signed in to change notification settings - Fork 0
/
0007-Check-for-32bit-linker-flag-when-creating-resource-f.patch
43 lines (40 loc) · 1.74 KB
/
0007-Check-for-32bit-linker-flag-when-creating-resource-f.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Douglas <[email protected]>
Date: Tue, 12 Mar 2019 11:26:52 -0700
Subject: [PATCH] Check for 32bit linker flag when creating resource file
When gio builds a test resource file with ld, it will use the
build_machine arch for linking but in the case of the 32bit build this
will cause build failures. Instead check to see if the -m32 linker
flag has been passed and if it has, add an argument to ld to create
the elf_i386 object.
---
gio/tests/meson.build | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/gio/tests/meson.build b/gio/tests/meson.build
index a926ae0..a590b9f 100644
--- a/gio/tests/meson.build
+++ b/gio/tests/meson.build
@@ -798,6 +798,13 @@ if meson.can_run_host_binaries()
else
why_no_external_data = ''
+ ld_subcommand = ['ld', '-r', '-b', 'binary']
+ pym = import('python3')
+ py3 = pym.find_python()
+ res = run_command(py3, '-c', 'import os; print(os.environ["LDFLAGS"])').stdout()
+ if res.contains('-m32')
+ ld_subcommand += ['-m', 'elf_i386']
+ endif
test_gresource_binary = custom_target('test5.gresource',
input : 'test5.gresource.xml',
output : 'test5.gresource',
@@ -928,9 +928,7 @@
test_resources_binary = custom_target('test_resources.o',
input : test_gresource_binary,
output : 'test_resources.o',
- command : cc.cmd_array() + ['-Wl,-z,noexecstack', '-r', '-Wl,-b,binary',
- '-nostdlib', '@INPUT@', '-o','@OUTPUT@'])
-
+ command : ld_subcommand + ['@INPUT@', '-o', '@OUTPUT@'])
# Rename symbol to match the one in the C file
if cc.get_id() == 'gcc' and host_system == 'windows'
underscore = '_'