Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 1 | Currently, non-IA builds are not reproducibile since build paths are |
| 2 | being injected into the debug symbols. These are coming from the use of |
| 3 | .S assembler files during the glibc build. No STT_FILE section is added |
| 4 | during the assembly but when linking, ld decides to add one to aid |
| 5 | debugging and ensure references between the different object files its |
| 6 | linking remain clear. |
| 7 | |
| 8 | We can avoid this by injecting a file header into the assembler files |
| 9 | ahead of time, choosing a filename which does not contain build system |
| 10 | paths. |
| 11 | |
| 12 | This is a bit of a workaround/hack but does significantly reduce the |
| 13 | build system references in target binaries for the non-IA architectures |
| 14 | which use .S files. |
| 15 | |
| 16 | RP |
| 17 | 2018/10/3 |
| 18 | |
| 19 | Upstream-Status: Pending |
| 20 | |
| 21 | diff --git a/csu/abi-note.S b/csu/abi-note.S |
| 22 | index 5d0ca7803d..8ce41581b1 100644 |
| 23 | --- a/csu/abi-note.S |
| 24 | +++ b/csu/abi-note.S |
| 25 | @@ -56,6 +56,8 @@ offset length contents |
| 26 | #include <config.h> |
| 27 | #include <abi-tag.h> /* OS-specific ABI tag value */ |
| 28 | |
| 29 | + .file "abi-note.S" |
| 30 | + |
| 31 | /* The linker (GNU ld 2.8 and later) recognizes an allocated section whose |
| 32 | name begins with `.note' and creates a PT_NOTE program header entry |
| 33 | pointing at it. */ |
| 34 | diff --git a/sysdeps/aarch64/crti.S b/sysdeps/aarch64/crti.S |
| 35 | index 2b213758b2..736f33e314 100644 |
| 36 | --- a/sysdeps/aarch64/crti.S |
| 37 | +++ b/sysdeps/aarch64/crti.S |
| 38 | @@ -50,6 +50,8 @@ |
| 39 | # define PREINIT_FUNCTION_WEAK 1 |
| 40 | #endif |
| 41 | |
| 42 | + .file "crti.S" |
| 43 | + |
| 44 | #if PREINIT_FUNCTION_WEAK |
| 45 | weak_extern (PREINIT_FUNCTION) |
| 46 | #else |
| 47 | diff --git a/sysdeps/aarch64/crtn.S b/sysdeps/aarch64/crtn.S |
| 48 | index d72300af80..cb249bf3ca 100644 |
| 49 | --- a/sysdeps/aarch64/crtn.S |
| 50 | +++ b/sysdeps/aarch64/crtn.S |
| 51 | @@ -37,6 +37,8 @@ |
| 52 | /* crtn.S puts function epilogues in the .init and .fini sections |
| 53 | corresponding to the prologues in crti.S. */ |
| 54 | |
| 55 | + .file "crtn.S" |
| 56 | + |
| 57 | .section .init,"ax",%progbits |
| 58 | ldp x29, x30, [sp], 16 |
| 59 | RET |
| 60 | diff --git a/sysdeps/aarch64/start.S b/sysdeps/aarch64/start.S |
| 61 | index bad000f555..5957c028cd 100644 |
| 62 | --- a/sysdeps/aarch64/start.S |
| 63 | +++ b/sysdeps/aarch64/start.S |
| 64 | @@ -18,6 +18,8 @@ |
| 65 | |
| 66 | #include <sysdep.h> |
| 67 | |
| 68 | + .file "start.S" |
| 69 | + |
| 70 | /* This is the canonical entry point, usually the first thing in the text |
| 71 | segment. |
| 72 | |
| 73 | diff --git a/sysdeps/unix/sysv/linux/aarch64/__read_tp.S b/sysdeps/unix/sysv/linux/aarch64/__read_tp.S |
| 74 | index 92fc0191a5..715bfcb9e4 100644 |
| 75 | --- a/sysdeps/unix/sysv/linux/aarch64/__read_tp.S |
| 76 | +++ b/sysdeps/unix/sysv/linux/aarch64/__read_tp.S |
| 77 | @@ -18,6 +18,8 @@ |
| 78 | |
| 79 | #include <sysdep.h> |
| 80 | |
| 81 | + .file "__read_tp.S" |
| 82 | + |
| 83 | .hidden __read_tp |
| 84 | ENTRY (__read_tp) |
| 85 | mrs x0, tpidr_el0 |
| 86 | diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S |
| 87 | index 43a62ef307..42f85cdde9 100644 |
| 88 | --- a/sysdeps/aarch64/dl-tlsdesc.S |
| 89 | +++ b/sysdeps/aarch64/dl-tlsdesc.S |
| 90 | @@ -22,6 +22,8 @@ |
| 91 | #include <tls.h> |
| 92 | #include "tlsdesc.h" |
| 93 | |
| 94 | + .file "dl-tlsdesc.S" |
| 95 | + |
| 96 | #define NSAVEDQREGPAIRS 16 |
| 97 | #define SAVE_Q_REGISTERS \ |
| 98 | stp q0, q1, [sp, #-32*NSAVEDQREGPAIRS]!; \ |
| 99 | diff --git a/sysdeps/aarch64/dl-trampoline.S b/sysdeps/aarch64/dl-trampoline.S |
| 100 | index a86d0722d4..92edab1d01 100644 |
| 101 | --- a/sysdeps/aarch64/dl-trampoline.S |
| 102 | +++ b/sysdeps/aarch64/dl-trampoline.S |
| 103 | @@ -21,6 +21,8 @@ |
| 104 | |
| 105 | #include "dl-link.h" |
| 106 | |
| 107 | + .file "dl-trampoline.S" |
| 108 | + |
| 109 | #define ip0 x16 |
| 110 | #define ip0l PTR_REG (16) |
| 111 | #define ip1 x17 |
| 112 | diff --git a/sysdeps/arm/abi-note.S b/sysdeps/arm/abi-note.S |
| 113 | index 07bd4c4619..7213b16f27 100644 |
| 114 | --- a/sysdeps/arm/abi-note.S |
| 115 | +++ b/sysdeps/arm/abi-note.S |
| 116 | @@ -1,3 +1,5 @@ |
| 117 | + .file "abi-note.S" |
| 118 | + |
| 119 | /* Tag_ABI_align8_preserved: This code preserves 8-byte |
| 120 | alignment in any callee. */ |
| 121 | .eabi_attribute 25, 1 |
| 122 | diff --git a/sysdeps/arm/crti.S b/sysdeps/arm/crti.S |
| 123 | index a1424d0333..bca1dab256 100644 |
| 124 | --- a/sysdeps/arm/crti.S |
| 125 | +++ b/sysdeps/arm/crti.S |
| 126 | @@ -57,6 +57,8 @@ |
| 127 | .hidden PREINIT_FUNCTION |
| 128 | #endif |
| 129 | |
| 130 | + .file "crti.S" |
| 131 | + |
| 132 | #if PREINIT_FUNCTION_WEAK |
| 133 | .p2align 2 |
| 134 | .type call_weak_fn, %function |
| 135 | diff --git a/sysdeps/arm/crtn.S b/sysdeps/arm/crtn.S |
| 136 | index 26027693ce..65a0502826 100644 |
| 137 | --- a/sysdeps/arm/crtn.S |
| 138 | +++ b/sysdeps/arm/crtn.S |
| 139 | @@ -37,6 +37,8 @@ |
| 140 | #define NO_THUMB |
| 141 | #include <sysdep.h> |
| 142 | |
| 143 | + .file "crtn.S" |
| 144 | + |
| 145 | /* crtn.S puts function epilogues in the .init and .fini sections |
| 146 | corresponding to the prologues in crti.S. */ |
| 147 | |
| 148 | diff --git a/sysdeps/arm/dl-tlsdesc.S b/sysdeps/arm/dl-tlsdesc.S |
| 149 | index 056e17d52d..a98c68dfb9 100644 |
| 150 | --- a/sysdeps/arm/dl-tlsdesc.S |
| 151 | +++ b/sysdeps/arm/dl-tlsdesc.S |
| 152 | @@ -21,6 +21,8 @@ |
| 153 | #include <tls.h> |
| 154 | #include "tlsdesc.h" |
| 155 | |
| 156 | + .file "dl-tlsdesc.S" |
| 157 | + |
| 158 | .text |
| 159 | @ emit debug information with cfi |
| 160 | @ use arm-specific pseudos for unwinding itself |
| 161 | diff --git a/sysdeps/arm/dl-trampoline.S b/sysdeps/arm/dl-trampoline.S |
| 162 | index c731b01286..4b37b25344 100644 |
| 163 | --- a/sysdeps/arm/dl-trampoline.S |
| 164 | +++ b/sysdeps/arm/dl-trampoline.S |
| 165 | @@ -21,6 +21,8 @@ |
| 166 | #include <sysdep.h> |
| 167 | #include <libc-symbols.h> |
| 168 | |
| 169 | + .file "dl-trampoline.S" |
| 170 | + |
| 171 | .text |
| 172 | .globl _dl_runtime_resolve |
| 173 | .type _dl_runtime_resolve, #function |
| 174 | diff --git a/sysdeps/arm/start.S b/sysdeps/arm/start.S |
| 175 | index adef090717..d22e4128e0 100644 |
| 176 | --- a/sysdeps/arm/start.S |
| 177 | +++ b/sysdeps/arm/start.S |
| 178 | @@ -57,6 +57,8 @@ |
| 179 | NULL |
| 180 | */ |
| 181 | |
| 182 | + .file "start.S" |
| 183 | + |
| 184 | /* Tag_ABI_align8_preserved: This code preserves 8-byte |
| 185 | alignment in any callee. */ |
| 186 | .eabi_attribute 25, 1 |
| 187 | diff --git a/sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S b/sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S |
| 188 | index 871702317a..20a942dbac 100644 |
| 189 | --- a/sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S |
| 190 | +++ b/sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S |
| 191 | @@ -39,6 +39,8 @@ |
| 192 | a normal function call) in a high page of memory; tail call to the |
| 193 | helper. */ |
| 194 | |
| 195 | + .file "aeabi_read_tp.S" |
| 196 | + |
| 197 | .hidden __aeabi_read_tp |
| 198 | ENTRY (__aeabi_read_tp) |
| 199 | #ifdef ARCH_HAS_HARD_TP |
| 200 | diff --git a/sysdeps/mips/start.S b/sysdeps/mips/start.S |
| 201 | index a4c4ef0fae..d00fff31a8 100644 |
| 202 | --- a/sysdeps/mips/start.S |
| 203 | +++ b/sysdeps/mips/start.S |
| 204 | @@ -38,6 +38,8 @@ |
| 205 | #include <sgidefs.h> |
| 206 | #include <sys/asm.h> |
| 207 | |
| 208 | + .file "start.S" |
| 209 | + |
| 210 | #ifndef ENTRY_POINT |
| 211 | #error ENTRY_POINT needs to be defined for start.S on MIPS/ELF. |
| 212 | #endif |
| 213 | diff --git a/sysdeps/unix/sysv/linux/powerpc/dl-brk.S b/sysdeps/unix/sysv/linux/powerpc/dl-brk.S |
| 214 | index eeb96544e3..da182b28f8 100644 |
| 215 | --- a/sysdeps/unix/sysv/linux/powerpc/dl-brk.S |
| 216 | +++ b/sysdeps/unix/sysv/linux/powerpc/dl-brk.S |
| 217 | @@ -1 +1,3 @@ |
| 218 | + .file "dl-brk.S" |
| 219 | + |
| 220 | #include <brk.S> |
| 221 | diff --git a/sysdeps/powerpc/powerpc32/start.S b/sysdeps/powerpc/powerpc32/start.S |
| 222 | index 5c10a22f8a..2b52627f27 100644 |
| 223 | --- a/sysdeps/powerpc/powerpc32/start.S |
| 224 | +++ b/sysdeps/powerpc/powerpc32/start.S |
| 225 | @@ -35,6 +35,8 @@ |
| 226 | |
| 227 | #include <sysdep.h> |
| 228 | |
| 229 | + .file "start.S" |
| 230 | + |
| 231 | /* We do not want .eh_frame info for crt1.o since crt1.o is linked |
| 232 | before crtbegin.o, the file defining __EH_FRAME_BEGIN__. */ |
| 233 | #undef cfi_startproc |
| 234 | diff --git a/sysdeps/powerpc/powerpc64/start.S b/sysdeps/powerpc/powerpc64/start.S |
| 235 | index bd7189310c..2e22b8472d 100644 |
| 236 | --- a/sysdeps/powerpc/powerpc64/start.S |
| 237 | +++ b/sysdeps/powerpc/powerpc64/start.S |
| 238 | @@ -35,6 +35,8 @@ |
| 239 | |
| 240 | #include <sysdep.h> |
| 241 | |
| 242 | + .file "start.S" |
| 243 | + |
| 244 | /* We do not want .eh_frame info for crt1.o since crt1.o is linked |
| 245 | before crtbegin.o, the file defining __EH_FRAME_BEGIN__. */ |
| 246 | #undef cfi_startproc |
| 247 | diff --git a/sysdeps/powerpc/powerpc32/dl-start.S b/sysdeps/powerpc/powerpc32/dl-start.S |
| 248 | index 244d87fb6d..14d3e2ce14 100644 |
| 249 | --- a/sysdeps/powerpc/powerpc32/dl-start.S |
| 250 | +++ b/sysdeps/powerpc/powerpc32/dl-start.S |
| 251 | @@ -18,6 +18,8 @@ |
| 252 | |
| 253 | #include <sysdep.h> |
| 254 | |
| 255 | + .file "dl-start.S" |
| 256 | + |
| 257 | /* Initial entry point code for the dynamic linker. |
| 258 | The C function `_dl_start' is the real entry point; |
| 259 | its return value is the user program's entry point. */ |
| 260 | diff --git a/sysdeps/unix/sysv/linux/arm/libc-do-syscall.S b/sysdeps/unix/sysv/linux/arm/libc-do-syscall.S |
| 261 | index d26ad1f8d3..a0de10bf81 100644 |
| 262 | --- a/sysdeps/unix/sysv/linux/arm/libc-do-syscall.S |
| 263 | +++ b/sysdeps/unix/sysv/linux/arm/libc-do-syscall.S |
| 264 | @@ -27,6 +27,8 @@ |
| 265 | ARM unwind tables for register to register moves, the actual opcodes |
| 266 | are not defined. */ |
| 267 | |
| 268 | + .file "libc-do-syscall.S" |
| 269 | + |
| 270 | #if defined(__thumb__) |
| 271 | .thumb |
| 272 | .syntax unified |