Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | From 420454f7098b5445730caa855c37b8143bfccc1b Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Thu, 29 Nov 2018 17:29:35 -0800 |
| 4 | Subject: [PATCH] inject file assembly directives |
| 5 | |
| 6 | Currently, non-IA builds are not reproducibile since build paths are |
| 7 | being injected into the debug symbols. These are coming from the use of |
| 8 | .S assembler files during the glibc build. No STT_FILE section is added |
| 9 | during the assembly but when linking, ld decides to add one to aid |
| 10 | debugging and ensure references between the different object files its |
| 11 | linking remain clear. |
| 12 | |
| 13 | We can avoid this by injecting a file header into the assembler files |
| 14 | ahead of time, choosing a filename which does not contain build system |
| 15 | paths. |
| 16 | |
| 17 | This is a bit of a workaround/hack but does significantly reduce the |
| 18 | build system references in target binaries for the non-IA architectures |
| 19 | which use .S files. |
| 20 | |
| 21 | RP |
| 22 | 2018/10/3 |
| 23 | |
| 24 | Upstream-Status: Pending |
| 25 | |
| 26 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 27 | --- |
| 28 | csu/abi-note.S | 2 ++ |
| 29 | sysdeps/aarch64/crti.S | 2 ++ |
| 30 | sysdeps/aarch64/crtn.S | 2 ++ |
| 31 | sysdeps/aarch64/dl-tlsdesc.S | 2 ++ |
| 32 | sysdeps/aarch64/dl-trampoline.S | 2 ++ |
| 33 | sysdeps/aarch64/start.S | 2 ++ |
| 34 | sysdeps/arm/abi-note.S | 2 ++ |
| 35 | sysdeps/arm/crti.S | 2 ++ |
| 36 | sysdeps/arm/crtn.S | 2 ++ |
| 37 | sysdeps/arm/dl-tlsdesc.S | 2 ++ |
| 38 | sysdeps/arm/dl-trampoline.S | 2 ++ |
| 39 | sysdeps/arm/start.S | 2 ++ |
| 40 | sysdeps/mips/start.S | 2 ++ |
| 41 | sysdeps/powerpc/powerpc32/dl-start.S | 2 ++ |
| 42 | sysdeps/powerpc/powerpc32/start.S | 2 ++ |
| 43 | sysdeps/powerpc/powerpc64/start.S | 2 ++ |
| 44 | sysdeps/unix/sysv/linux/aarch64/__read_tp.S | 2 ++ |
| 45 | sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S | 2 ++ |
| 46 | sysdeps/unix/sysv/linux/arm/libc-do-syscall.S | 2 ++ |
| 47 | sysdeps/unix/sysv/linux/powerpc/dl-brk.S | 2 ++ |
| 48 | 20 files changed, 40 insertions(+) |
| 49 | |
| 50 | diff --git a/csu/abi-note.S b/csu/abi-note.S |
| 51 | index 2b4b5f8824..964843016c 100644 |
| 52 | --- a/csu/abi-note.S |
| 53 | +++ b/csu/abi-note.S |
| 54 | @@ -56,6 +56,8 @@ offset length contents |
| 55 | #include <config.h> |
| 56 | #include <abi-tag.h> /* OS-specific ABI tag value */ |
| 57 | |
| 58 | + .file "abi-note.S" |
| 59 | + |
| 60 | /* The linker (GNU ld 2.8 and later) recognizes an allocated section whose |
| 61 | name begins with `.note' and creates a PT_NOTE program header entry |
| 62 | pointing at it. */ |
| 63 | diff --git a/sysdeps/aarch64/crti.S b/sysdeps/aarch64/crti.S |
| 64 | index 1728eac37a..76a8ab590b 100644 |
| 65 | --- a/sysdeps/aarch64/crti.S |
| 66 | +++ b/sysdeps/aarch64/crti.S |
| 67 | @@ -50,6 +50,8 @@ |
| 68 | # define PREINIT_FUNCTION_WEAK 1 |
| 69 | #endif |
| 70 | |
| 71 | + .file "crti.S" |
| 72 | + |
| 73 | #if PREINIT_FUNCTION_WEAK |
| 74 | weak_extern (PREINIT_FUNCTION) |
| 75 | #else |
| 76 | diff --git a/sysdeps/aarch64/crtn.S b/sysdeps/aarch64/crtn.S |
| 77 | index c3e97cc449..fc2e5c2df8 100644 |
| 78 | --- a/sysdeps/aarch64/crtn.S |
| 79 | +++ b/sysdeps/aarch64/crtn.S |
| 80 | @@ -37,6 +37,8 @@ |
| 81 | /* crtn.S puts function epilogues in the .init and .fini sections |
| 82 | corresponding to the prologues in crti.S. */ |
| 83 | |
| 84 | + .file "crtn.S" |
| 85 | + |
| 86 | .section .init,"ax",%progbits |
| 87 | ldp x29, x30, [sp], 16 |
| 88 | RET |
| 89 | diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S |
| 90 | index 557ad1d505..194a8531da 100644 |
| 91 | --- a/sysdeps/aarch64/dl-tlsdesc.S |
| 92 | +++ b/sysdeps/aarch64/dl-tlsdesc.S |
| 93 | @@ -22,6 +22,8 @@ |
| 94 | #include <tls.h> |
| 95 | #include "tlsdesc.h" |
| 96 | |
| 97 | + .file "dl-tlsdesc.S" |
| 98 | + |
| 99 | #define NSAVEDQREGPAIRS 16 |
| 100 | #define SAVE_Q_REGISTERS \ |
| 101 | stp q0, q1, [sp, #-32*NSAVEDQREGPAIRS]!; \ |
| 102 | diff --git a/sysdeps/aarch64/dl-trampoline.S b/sysdeps/aarch64/dl-trampoline.S |
| 103 | index 94e965c096..ba18742f3e 100644 |
| 104 | --- a/sysdeps/aarch64/dl-trampoline.S |
| 105 | +++ b/sysdeps/aarch64/dl-trampoline.S |
| 106 | @@ -21,6 +21,8 @@ |
| 107 | |
| 108 | #include "dl-link.h" |
| 109 | |
| 110 | + .file "dl-trampoline.S" |
| 111 | + |
| 112 | #define ip0 x16 |
| 113 | #define ip0l PTR_REG (16) |
| 114 | #define ip1 x17 |
| 115 | diff --git a/sysdeps/aarch64/start.S b/sysdeps/aarch64/start.S |
| 116 | index d96cf57e2d..07a523978a 100644 |
| 117 | --- a/sysdeps/aarch64/start.S |
| 118 | +++ b/sysdeps/aarch64/start.S |
| 119 | @@ -18,6 +18,8 @@ |
| 120 | |
| 121 | #include <sysdep.h> |
| 122 | |
| 123 | + .file "start.S" |
| 124 | + |
| 125 | /* This is the canonical entry point, usually the first thing in the text |
| 126 | segment. |
| 127 | |
| 128 | diff --git a/sysdeps/arm/abi-note.S b/sysdeps/arm/abi-note.S |
| 129 | index 07bd4c4619..7213b16f27 100644 |
| 130 | --- a/sysdeps/arm/abi-note.S |
| 131 | +++ b/sysdeps/arm/abi-note.S |
| 132 | @@ -1,3 +1,5 @@ |
| 133 | + .file "abi-note.S" |
| 134 | + |
| 135 | /* Tag_ABI_align8_preserved: This code preserves 8-byte |
| 136 | alignment in any callee. */ |
| 137 | .eabi_attribute 25, 1 |
| 138 | diff --git a/sysdeps/arm/crti.S b/sysdeps/arm/crti.S |
| 139 | index 8169783267..f56e0c85a6 100644 |
| 140 | --- a/sysdeps/arm/crti.S |
| 141 | +++ b/sysdeps/arm/crti.S |
| 142 | @@ -57,6 +57,8 @@ |
| 143 | .hidden PREINIT_FUNCTION |
| 144 | #endif |
| 145 | |
| 146 | + .file "crti.S" |
| 147 | + |
| 148 | #if PREINIT_FUNCTION_WEAK |
| 149 | .p2align 2 |
| 150 | .type call_weak_fn, %function |
| 151 | diff --git a/sysdeps/arm/crtn.S b/sysdeps/arm/crtn.S |
| 152 | index d60f9f05de..1e10ec439f 100644 |
| 153 | --- a/sysdeps/arm/crtn.S |
| 154 | +++ b/sysdeps/arm/crtn.S |
| 155 | @@ -37,6 +37,8 @@ |
| 156 | #define NO_THUMB |
| 157 | #include <sysdep.h> |
| 158 | |
| 159 | + .file "crtn.S" |
| 160 | + |
| 161 | /* crtn.S puts function epilogues in the .init and .fini sections |
| 162 | corresponding to the prologues in crti.S. */ |
| 163 | |
| 164 | diff --git a/sysdeps/arm/dl-tlsdesc.S b/sysdeps/arm/dl-tlsdesc.S |
| 165 | index 8415e47607..29c2cb8128 100644 |
| 166 | --- a/sysdeps/arm/dl-tlsdesc.S |
| 167 | +++ b/sysdeps/arm/dl-tlsdesc.S |
| 168 | @@ -21,6 +21,8 @@ |
| 169 | #include <tls.h> |
| 170 | #include "tlsdesc.h" |
| 171 | |
| 172 | + .file "dl-tlsdesc.S" |
| 173 | + |
| 174 | .text |
| 175 | @ emit debug information with cfi |
| 176 | @ use arm-specific pseudos for unwinding itself |
| 177 | diff --git a/sysdeps/arm/dl-trampoline.S b/sysdeps/arm/dl-trampoline.S |
| 178 | index a20baf555e..2dd3bef04e 100644 |
| 179 | --- a/sysdeps/arm/dl-trampoline.S |
| 180 | +++ b/sysdeps/arm/dl-trampoline.S |
| 181 | @@ -21,6 +21,8 @@ |
| 182 | #include <sysdep.h> |
| 183 | #include <libc-symbols.h> |
| 184 | |
| 185 | + .file "dl-trampoline.S" |
| 186 | + |
| 187 | .text |
| 188 | .globl _dl_runtime_resolve |
| 189 | .type _dl_runtime_resolve, #function |
| 190 | diff --git a/sysdeps/arm/start.S b/sysdeps/arm/start.S |
| 191 | index 2ff56179d2..c118046ec6 100644 |
| 192 | --- a/sysdeps/arm/start.S |
| 193 | +++ b/sysdeps/arm/start.S |
| 194 | @@ -57,6 +57,8 @@ |
| 195 | NULL |
| 196 | */ |
| 197 | |
| 198 | + .file "start.S" |
| 199 | + |
| 200 | /* Tag_ABI_align8_preserved: This code preserves 8-byte |
| 201 | alignment in any callee. */ |
| 202 | .eabi_attribute 25, 1 |
| 203 | diff --git a/sysdeps/mips/start.S b/sysdeps/mips/start.S |
| 204 | index fabc8080df..83c6b91d7d 100644 |
| 205 | --- a/sysdeps/mips/start.S |
| 206 | +++ b/sysdeps/mips/start.S |
| 207 | @@ -38,6 +38,8 @@ |
| 208 | #include <sgidefs.h> |
| 209 | #include <sys/asm.h> |
| 210 | |
| 211 | + .file "start.S" |
| 212 | + |
| 213 | #ifndef ENTRY_POINT |
| 214 | #error ENTRY_POINT needs to be defined for start.S on MIPS/ELF. |
| 215 | #endif |
| 216 | diff --git a/sysdeps/powerpc/powerpc32/dl-start.S b/sysdeps/powerpc/powerpc32/dl-start.S |
| 217 | index c15242d3bc..6ca27715a4 100644 |
| 218 | --- a/sysdeps/powerpc/powerpc32/dl-start.S |
| 219 | +++ b/sysdeps/powerpc/powerpc32/dl-start.S |
| 220 | @@ -18,6 +18,8 @@ |
| 221 | |
| 222 | #include <sysdep.h> |
| 223 | |
| 224 | + .file "dl-start.S" |
| 225 | + |
| 226 | /* Initial entry point code for the dynamic linker. |
| 227 | The C function `_dl_start' is the real entry point; |
| 228 | its return value is the user program's entry point. */ |
| 229 | diff --git a/sysdeps/powerpc/powerpc32/start.S b/sysdeps/powerpc/powerpc32/start.S |
| 230 | index b7b9a133a2..8df714f81a 100644 |
| 231 | --- a/sysdeps/powerpc/powerpc32/start.S |
| 232 | +++ b/sysdeps/powerpc/powerpc32/start.S |
| 233 | @@ -35,6 +35,8 @@ |
| 234 | |
| 235 | #include <sysdep.h> |
| 236 | |
| 237 | + .file "start.S" |
| 238 | + |
| 239 | /* We do not want .eh_frame info for crt1.o since crt1.o is linked |
| 240 | before crtbegin.o, the file defining __EH_FRAME_BEGIN__. */ |
| 241 | #undef cfi_startproc |
| 242 | diff --git a/sysdeps/powerpc/powerpc64/start.S b/sysdeps/powerpc/powerpc64/start.S |
| 243 | index 94bf771e83..cffb99500a 100644 |
| 244 | --- a/sysdeps/powerpc/powerpc64/start.S |
| 245 | +++ b/sysdeps/powerpc/powerpc64/start.S |
| 246 | @@ -35,6 +35,8 @@ |
| 247 | |
| 248 | #include <sysdep.h> |
| 249 | |
| 250 | + .file "start.S" |
| 251 | + |
| 252 | /* We do not want .eh_frame info for crt1.o since crt1.o is linked |
| 253 | before crtbegin.o, the file defining __EH_FRAME_BEGIN__. */ |
| 254 | #undef cfi_startproc |
| 255 | diff --git a/sysdeps/unix/sysv/linux/aarch64/__read_tp.S b/sysdeps/unix/sysv/linux/aarch64/__read_tp.S |
| 256 | index 12e1131fe7..767e0d043b 100644 |
| 257 | --- a/sysdeps/unix/sysv/linux/aarch64/__read_tp.S |
| 258 | +++ b/sysdeps/unix/sysv/linux/aarch64/__read_tp.S |
| 259 | @@ -18,6 +18,8 @@ |
| 260 | |
| 261 | #include <sysdep.h> |
| 262 | |
| 263 | + .file "__read_tp.S" |
| 264 | + |
| 265 | .hidden __read_tp |
| 266 | ENTRY (__read_tp) |
| 267 | mrs x0, tpidr_el0 |
| 268 | diff --git a/sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S b/sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S |
| 269 | index 3b0d611039..4a7e476c37 100644 |
| 270 | --- a/sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S |
| 271 | +++ b/sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S |
| 272 | @@ -39,6 +39,8 @@ |
| 273 | a normal function call) in a high page of memory; tail call to the |
| 274 | helper. */ |
| 275 | |
| 276 | + .file "aeabi_read_tp.S" |
| 277 | + |
| 278 | .hidden __aeabi_read_tp |
| 279 | ENTRY (__aeabi_read_tp) |
| 280 | #ifdef ARCH_HAS_HARD_TP |
| 281 | diff --git a/sysdeps/unix/sysv/linux/arm/libc-do-syscall.S b/sysdeps/unix/sysv/linux/arm/libc-do-syscall.S |
| 282 | index fb5e0c7d97..bd07bdb38b 100644 |
| 283 | --- a/sysdeps/unix/sysv/linux/arm/libc-do-syscall.S |
| 284 | +++ b/sysdeps/unix/sysv/linux/arm/libc-do-syscall.S |
| 285 | @@ -27,6 +27,8 @@ |
| 286 | ARM unwind tables for register to register moves, the actual opcodes |
| 287 | are not defined. */ |
| 288 | |
| 289 | + .file "libc-do-syscall.S" |
| 290 | + |
| 291 | #if defined(__thumb__) |
| 292 | .thumb |
| 293 | .syntax unified |
| 294 | diff --git a/sysdeps/unix/sysv/linux/powerpc/dl-brk.S b/sysdeps/unix/sysv/linux/powerpc/dl-brk.S |
| 295 | index eeb96544e3..da182b28f8 100644 |
| 296 | --- a/sysdeps/unix/sysv/linux/powerpc/dl-brk.S |
| 297 | +++ b/sysdeps/unix/sysv/linux/powerpc/dl-brk.S |
| 298 | @@ -1 +1,3 @@ |
| 299 | + .file "dl-brk.S" |
| 300 | + |
| 301 | #include <brk.S> |