summaryrefslogtreecommitdiff
path: root/core/binutils/PKGBUILD
blob: 2a55c4932aa712ce429f5b6e2111d4eb23e09a9b (plain)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# add our own bug reporting URL
eval "$(
  declare -f build | \
    sed '
      s,https://bugs.archlinux.org/,https://bugs.archlinux32.org/,
    '
)"

# enable BFD for x86_64 other we have problems with cross-compilation
# or compiling things like grub
eval "$(
  declare -f build | \
    sed '
      s/--enable/--enable-64-bit-bfd \0/
    '
)"

# segfaults in ld of binutils 2.30 needs the binutils_2_30 branch
# for now, see https://sourceware.org/bugzilla/show_bug.cgi?id=23194
# this patch was done by diffing the branch against the tag and removing
# some conflicts, also 0003-PR22836-r-s-doesnt-work-with-g3-using-GCC-7.patch
# needs disabling because it has already been cherry-picked into the branch.
# cherry-picking onlt the fiy for P23194 leads to assertion violations in
# the GOT, so this was not done.
# also conflicted with parts of the gold ld patch 0004-PR22868, eliminated
# conflicts by picking only the necessary things..
source+=(binutils-2.30-glibc-segfault.patch)
sha256sums+=('7c8480f032c85205959ce6aad127d3fca8019789d2d4c138a04a17ca64cba6f2')

eval "$(
  declare -f prepare | \
    sed '
      s/.*0003-PR22836/#\0/
      /0004-PR22868/a patch -p1 -i ${srcdir}/binutils-2.30-glibc-segfault.patch
    '
)"

# "configure: error: debuginfod is missing or unusable"
eval "$(
  declare -f build | \
    sed '
      s/--with-debuginfod//g
    '
)"

# should be in a cross-compilation binutils for targeting EFI binaries IMHO,
# not in the main platform binutils (see also https://bugs.archlinux.org/task/42540)
eval "$(
  declare -f build | \
    sed '
      s/--enable-targets=x86_64-pep//g
    '
)"

# i486-specific
if [ "${CARCH}" = "i486" ]; then
  # disable CET (Control Flow instructions endbr32/enbr64)
  eval "$(
    declare -f build | \
      sed '
        s,configure",configure" --enable-cet=no,
      '
  )"
else
  # explicitely enable CET (Control Flow instructions endbr32/enbr64)
  # avoid "corrupt GNU_PROPERTY_TYPE (5) size: 0" warnings,
  # see:
  # https://bbs.archlinux32.org/viewtopic.php?pid=6160#p6160
  # https://bugs.archlinux32.org/index.php?do=details&task_id=82
  #
  eval "$(
    declare -f build | \
      sed '
        s,configure",configure" --enable-cet=yes,
      '
  )"
fi