Compare commits
201 Commits
Author | SHA1 | Date |
---|---|---|
Miloš Prchlík | 9a32411e0c | |
yahmad | 5e53841477 | |
yahmad | f3e2e5419d | |
yahmad | f4b048a78b | |
yahmad | d8e4b1f5a0 | |
yahmad | 1c29d08ae4 | |
yahmad | c1349c74c4 | |
Nick Clifton | 2571e2aaa2 | |
Nick Clifton | c35887d498 | |
yahmad | 6009a5bc1d | |
yahmad | 6007cbaca0 | |
Nick Clifton | db11ef8049 | |
Nick Clifton | 1cb629116d | |
Nick Clifton | 2777742ac4 | |
yahmad | 5c24001c4c | |
yahmad | d56d81b64e | |
Nick Clifton | 325f0aa6e2 | |
Nick Clifton | 33b2864149 | |
Nick Clifton | c13a28efbc | |
Fedora Release Engineering | 95c35f80af | |
Nick Clifton | 9a25c9f346 | |
Nick Clifton | 14b1fc0e7b | |
Luca Boccassi | a2393deeee | |
Nick Clifton | 893b61d358 | |
Nick Clifton | 94be2cd1fb | |
Martin Cermak | 5bb4d15d3c | |
Nick Clifton | 5074d55c3d | |
Václav Kadlčík | 5dbfbba047 | |
Luca Boccassi | 5f97030592 | |
Luca Boccassi | df67e06692 | |
Nick Clifton | 86336d536a | |
Nick Clifton | 9e8ef94636 | |
Orion Poplawski | ca8ef33300 | |
Timm Bäder | 47508dc848 | |
Nick Clifton | 92a1236ab3 | |
Nick Clifton | 752fe419ea | |
Nick Clifton | e59cdcdfc5 | |
Tom Stellard | 73c2d21c11 | |
Nick Clifton | 75c516c6c2 | |
Nick Clifton | 50232d48dc | |
Nick Clifton | dcb64b3d34 | |
Stephen Gallagher | 252f93244d | |
Nick Clifton | a2d562c07d | |
Nick Clifton | f4ad5792af | |
Nick Clifton | ffc81ff11e | |
Nick Clifton | 01ca902e23 | |
Fedora Release Engineering | d5ffebd3b7 | |
Nick Clifton | 9eaca4038a | |
Nick Clifton | 6d1ff8eb0b | |
Nick Clifton | 90f5896dac | |
Václav Kadlčík | acab70872f | |
Václav Kadlčík | 24cc8051d1 | |
Václav Kadlčík | 58f355fcc3 | |
Nick Clifton | fba59c4283 | |
Nick Clifton | fb7c644d99 | |
Václav Kadlčík | c82e600f3f | |
Nick Clifton | 3ebde0f76b | |
Nick Clifton | a4b106ec38 | |
Václav Kadlčík | 284ad2a04b | |
Václav Kadlčík | 8b9a64065d | |
Václav Kadlčík | 518691547f | |
Václav Kadlčík | 8d1431acf8 | |
Václav Kadlčík | f5c84aa932 | |
Václav Kadlčík | 473ccf2683 | |
Václav Kadlčík | 54c8d3242b | |
Nick Clifton | 2680508b04 | |
Václav Kadlčík | 0b3adba8ff | |
Nick Clifton | fc998ec612 | |
Václav Kadlčík | 5069c58e30 | |
Nick Clifton | 616b9e8e44 | |
Václav Kadlčík | 64cf74e8a3 | |
Václav Kadlčík | 22348da57d | |
Václav Kadlčík | 8e50243c45 | |
Václav Kadlčík | 95e9eaea23 | |
Václav Kadlčík | 3740b5fe3f | |
Václav Kadlčík | 2c6bc398b0 | |
Václav Kadlčík | fe3f218ee7 | |
Václav Kadlčík | ba92017b68 | |
Václav Kadlčík | 14a74d027d | |
Václav Kadlčík | 1f73172fe0 | |
Václav Kadlčík | 001cb68e0a | |
Václav Kadlčík | 22c57fab15 | |
Timm Bäder | 117b4ee5c2 | |
Timm Bäder | 5e669f0402 | |
Nick Clifton | 2c147eaf06 | |
Václav Kadlčík | 4594b7d025 | |
Václav Kadlčík | 37d46f62b4 | |
Václav Kadlčík | eb66e6ad98 | |
Václav Kadlčík | 248005fd4b | |
Václav Kadlčík | cf75a87f18 | |
Václav Kadlčík | aa0db47566 | |
Václav Kadlčík | 06dff1c717 | |
Václav Kadlčík | 6becef8c86 | |
Václav Kadlčík | 5368a04b59 | |
Václav Kadlčík | c58376bae6 | |
Václav Kadlčík | d8a8efd579 | |
Václav Kadlčík | 8b0542614c | |
Václav Kadlčík | b0c79a4304 | |
Václav Kadlčík | 6df1ce83dc | |
Václav Kadlčík | 0fc29a6fe4 | |
Václav Kadlčík | 31a5e2d113 | |
Václav Kadlčík | 4504773204 | |
Václav Kadlčík | 565577c240 | |
Václav Kadlčík | d78b2cccc1 | |
Václav Kadlčík | ae526f4dc7 | |
Václav Kadlčík | c468b0dfdd | |
Václav Kadlčík | 484107a803 | |
Václav Kadlčík | 9cd058771f | |
Václav Kadlčík | 57106a8254 | |
Václav Kadlčík | 6a906104d9 | |
Václav Kadlčík | e05b04d76b | |
Václav Kadlčík | c7ad9ce6c4 | |
Václav Kadlčík | e429ddcadc | |
Václav Kadlčík | 195ba30ad9 | |
Václav Kadlčík | a6c5799515 | |
Nick Clifton | 7453caeb33 | |
Nick Clifton | ac55f50329 | |
Nick Clifton | 0b119dd9d5 | |
Nick Clifton | e184e98697 | |
Nick Clifton | 2f53574f32 | |
Nick Clifton | e5b60c3bbb | |
Nick Clifton | 2e8b4af2b9 | |
Nick Clifton | e1785a2a4b | |
Nick Clifton | bbafdb8775 | |
Nick Clifton | c014d04d53 | |
Nick Clifton | 5cef9601f1 | |
Nick Clifton | 34f3e5e618 | |
Nicholas Clifton | 84771fa58a | |
Nick Clifton | 8bb6c79408 | |
Martin Cermak | 49b89d94ef | |
Martin Cermak | 044ff519e9 | |
Nick Clifton | 94c52a6c76 | |
Nick Clifton | 1c9437f634 | |
Nick Clifton | da81b23637 | |
Fedora Release Engineering | 90ca16a5d6 | |
Nick Clifton | 88880dcb05 | |
Václav Kadlčík | 1171dfa950 | |
Václav Kadlčík | 7294ce61bc | |
Václav Kadlčík | 4db8f84f7e | |
Václav Kadlčík | c29a5d4751 | |
Nick Clifton | 433c9b01d4 | |
Nick Clifton | d5e63f6505 | |
Nick Clifton | 0960a4713d | |
Nick Clifton | c3a1a4ef17 | |
Nick Clifton | eeeb57f8ed | |
Nick Clifton | e056abea7e | |
Nick Clifton | 5aee897b5c | |
Nick Clifton | 4b3b7c0eda | |
Tom Stellard | 1c6ed47920 | |
Florian Weimer | 05722a7935 | |
Nick Clifton | 0781ec435c | |
Nick Clifton | b69788edf8 | |
Nick Clifton | c9f1c0ef4c | |
Nick Clifton | 2040d52e17 | |
Nick Clifton | 540feda45b | |
Nick Clifton | 7c556a22c9 | |
Nick Clifton | 9138ef7327 | |
Nick Clifton | a4573e9c3e | |
Nick Clifton | 611c7aa70b | |
Nick Clifton | 63965bc14d | |
Nick Clifton | b5f49511e0 | |
Nick Clifton | a1dc8e2d32 | |
Nick Clifton | 45e67f9ccb | |
Nick Clifton | 9051ca66fa | |
Nick Clifton | 842839bbb1 | |
Nick Clifton | 13a86b8b66 | |
Nick Clifton | 2592e35890 | |
Nick Clifton | a04d2461fb | |
Nick Clifton | 2c9d39bc55 | |
Nick Clifton | 7e6a1748ba | |
Nick Clifton | 7691c28cb0 | |
Nick Clifton | ba80920a4c | |
Nick Clifton | 2e0c2015a5 | |
Nick Clifton | d62f898ae7 | |
Jeff Law | 7bb2daa612 | |
Jeff Law | e315473f6c | |
Nick Clifton | b22933e83e | |
Nick Clifton | 93bf869662 | |
Richard W.M. Jones | 6442193bff | |
Nick Clifton | 722dceebdb | |
Nick Clifton | a8b0efde87 | |
Nick Clifton | 3eb4862ad3 | |
Fedora Release Engineering | 74b3ce8462 | |
Jeff Law | 0af851ae02 | |
Nick Clifton | 15a78ff3d8 | |
Nick Clifton | 5cfc5a91d2 | |
Nick Clifton | 385f20222d | |
Jeff Law | 426edf4a6e | |
Jeff Law | 32bf168f75 | |
Nick Clifton | d8ce39864a | |
Nick Clifton | c548afa128 | |
Nick Clifton | 347bbd0dc5 | |
Nick Clifton | 72f99ab293 | |
Nick Clifton | e8f39243b8 | |
Nick Clifton | d1aeab2109 | |
Nick Clifton | 07a3e80865 | |
Nick Clifton | beb7b8e936 | |
Nick Clifton | 657e3d5a3e | |
Fedora Release Engineering | bf57373ec8 | |
Nick Clifton | dcf3d266fa | |
Nick Clifton | 7111265a8a |
|
@ -0,0 +1 @@
|
|||
1
|
|
@ -1,20 +1,69 @@
|
|||
binutils-2.*/
|
||||
i386
|
||||
i686
|
||||
x86_64
|
||||
/binutils-*.tar.bz2
|
||||
.build-*
|
||||
*.src.rpm
|
||||
*.log
|
||||
HOWTO
|
||||
build-sources
|
||||
*.diff
|
||||
*.orig
|
||||
*.rej
|
||||
|
||||
/binutils-2.29.tar.xz
|
||||
/binutils-2.29.1.tar.xz
|
||||
*~
|
||||
.#*
|
||||
*#
|
||||
|
||||
*.flt
|
||||
*.gmo
|
||||
*.info
|
||||
*.la
|
||||
*.lo
|
||||
*.o
|
||||
*.pyc
|
||||
*.tmp
|
||||
*.a
|
||||
|
||||
.deps
|
||||
.libs
|
||||
|
||||
autom4te.cache
|
||||
config.cache
|
||||
config.h
|
||||
config.intl
|
||||
config.log
|
||||
config.status
|
||||
libtool
|
||||
POTFILES
|
||||
*-POTFILES
|
||||
|
||||
TAGS
|
||||
TAGS.sub
|
||||
|
||||
.local.vimrc
|
||||
.lvimrc
|
||||
|
||||
.clang-format
|
||||
|
||||
.gdbinit
|
||||
.gdb_history
|
||||
|
||||
perf.data
|
||||
perf.data.old
|
||||
|
||||
# ignore core files, but not java/net/protocol/core/
|
||||
core
|
||||
!core/
|
||||
|
||||
lost+found
|
||||
|
||||
# ignore ./contrib/gcc_update output
|
||||
LAST_UPDATED
|
||||
REVISION
|
||||
|
||||
stamp-*
|
||||
*.stamp
|
||||
|
||||
# ignore in-tree prerequisites
|
||||
/mpfr*
|
||||
/mpc*
|
||||
/gmp*
|
||||
/isl*
|
||||
/binutils-2.34.0-5dfc0c955dbe912cd328fc2688e5fceb3239ac2a.tar.xz
|
||||
/binutils-2.19.50.0.1-output-format.sed
|
||||
/binutils-2.30.tar.xz
|
||||
/binutils-2.30.90.tar.xz
|
||||
/binutils-2.31.1.tar.xz
|
||||
/binutils-special-sections-in-groups.patch
|
||||
/binutils-2.32.tar.xz
|
||||
/binutils-2.33.1.tar.xz
|
||||
/binutils-2.35.tar.xz
|
||||
/binutils-2.35.1.tar.xz
|
||||
/binutils-2.36.1.tar.xz
|
||||
/binutils-2.37.tar.xz
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
# Generate OUTPUT_FORMAT line for .so files from the system linker output.
|
||||
# Imported from glibc/Makerules.
|
||||
|
||||
/ld.*[ ]-E[BL]/b f
|
||||
/collect.*[ ]-E[BL]/b f
|
||||
/OUTPUT_FORMAT[^)]*$/{N
|
||||
s/\n[ ]*/ /
|
||||
}
|
||||
t o
|
||||
: o
|
||||
s/^.*OUTPUT_FORMAT(\([^,]*\), \1, \1).*$/OUTPUT_FORMAT(\1)/
|
||||
t q
|
||||
s/^.*OUTPUT_FORMAT(\([^,]*\), \([^,]*\), \([^,]*\)).*$/\1,\2,\3/
|
||||
t s
|
||||
s/^.*OUTPUT_FORMAT(\([^,)]*\).*$)/OUTPUT_FORMAT(\1)/
|
||||
t q
|
||||
d
|
||||
: s
|
||||
s/"//g
|
||||
G
|
||||
s/\n//
|
||||
s/^\([^,]*\),\([^,]*\),\([^,]*\),B/OUTPUT_FORMAT(\2)/p
|
||||
s/^\([^,]*\),\([^,]*\),\([^,]*\),L/OUTPUT_FORMAT(\3)/p
|
||||
s/^\([^,]*\),\([^,]*\),\([^,]*\)/OUTPUT_FORMAT(\1)/p
|
||||
/,/s|^|*** BUG in libc/scripts/output-format.sed *** |p
|
||||
q
|
||||
: q
|
||||
s/"//g
|
||||
p
|
||||
q
|
||||
: f
|
||||
s/^.*[ ]-E\([BL]\)[ ].*$/,\1/
|
||||
t h
|
||||
s/^.*[ ]-E\([BL]\)$/,\1/
|
||||
t h
|
||||
d
|
||||
: h
|
||||
h
|
|
@ -0,0 +1,944 @@
|
|||
diff -rup binutils.orig/bfd/.gitignore binutils-2.37/bfd/.gitignore
|
||||
--- binutils.orig/bfd/.gitignore 2021-12-01 13:35:33.826078119 +0000
|
||||
+++ binutils-2.37/bfd/.gitignore 2021-12-01 13:35:43.138988270 +0000
|
||||
@@ -10,6 +10,7 @@
|
||||
/peigen.c
|
||||
/pepigen.c
|
||||
/pex64igen.c
|
||||
+/pe-aarch64igen.c
|
||||
/stmp-bfd-h
|
||||
/targmatch.h
|
||||
|
||||
diff -rup binutils.orig/bfd/Makefile.am binutils-2.37/bfd/Makefile.am
|
||||
--- binutils.orig/bfd/Makefile.am 2021-12-01 13:35:33.817078206 +0000
|
||||
+++ binutils-2.37/bfd/Makefile.am 2021-12-01 13:35:43.139988261 +0000
|
||||
@@ -567,7 +567,9 @@ BFD64_BACKENDS = \
|
||||
mach-o-aarch64.lo \
|
||||
mach-o-x86-64.lo \
|
||||
mmo.lo \
|
||||
+ pe-aarch64igen.lo \
|
||||
pe-x86_64.lo \
|
||||
+ pei-aarch64lo \
|
||||
pei-ia64.lo \
|
||||
pei-x86_64.lo \
|
||||
pepigen.lo \
|
||||
@@ -607,6 +609,7 @@ BFD64_BACKENDS_CFILES = \
|
||||
mach-o-x86-64.c \
|
||||
mmo.c \
|
||||
pe-x86_64.c \
|
||||
+ pei-aarch64.c \
|
||||
pei-ia64.c \
|
||||
pei-x86_64.c \
|
||||
vms-alpha.c
|
||||
@@ -666,7 +669,7 @@ BUILD_CFILES = \
|
||||
elf32-aarch64.c elf64-aarch64.c \
|
||||
elf32-ia64.c elf64-ia64.c \
|
||||
elf32-riscv.c elf64-riscv.c \
|
||||
- peigen.c pepigen.c pex64igen.c
|
||||
+ peigen.c pepigen.c pex64igen.c pe-aarch64igen.c
|
||||
|
||||
CFILES = $(SOURCE_CFILES) $(BUILD_CFILES)
|
||||
|
||||
@@ -862,6 +865,10 @@ pex64igen.c: peXXigen.c
|
||||
echo "#line 1 \"peXXigen.c\"" > $@
|
||||
$(SED) -e s/XX/pex64/g < $< >> $@
|
||||
|
||||
+pe-aarch64igen.c: peXXigen.c
|
||||
+ echo "#line 1 \"peXXigen.c\"" > $@
|
||||
+ $(SED) -e s/XX/peAArch64/g < $< >> $@
|
||||
+
|
||||
BFD_H_DEPS= $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h $(INCDIR)/diagnostics.h
|
||||
LOCAL_H_DEPS= libbfd.h sysdep.h config.h
|
||||
$(BFD32_LIBS) \
|
||||
diff -rup binutils.orig/bfd/Makefile.in binutils-2.37/bfd/Makefile.in
|
||||
--- binutils.orig/bfd/Makefile.in 2021-12-01 13:35:33.823078148 +0000
|
||||
+++ binutils-2.37/bfd/Makefile.in 2021-12-01 13:35:43.139988261 +0000
|
||||
@@ -994,7 +994,9 @@ BFD64_BACKENDS = \
|
||||
mach-o-aarch64.lo \
|
||||
mach-o-x86-64.lo \
|
||||
mmo.lo \
|
||||
+ pe-aarch64igen.lo \
|
||||
pe-x86_64.lo \
|
||||
+ pei-aarch64.lo \
|
||||
pei-ia64.lo \
|
||||
pei-x86_64.lo \
|
||||
pepigen.lo \
|
||||
@@ -1034,6 +1036,7 @@ BFD64_BACKENDS_CFILES = \
|
||||
mach-o-x86-64.c \
|
||||
mmo.c \
|
||||
pe-x86_64.c \
|
||||
+ pei-aarch64.c \
|
||||
pei-ia64.c \
|
||||
pei-x86_64.c \
|
||||
vms-alpha.c
|
||||
@@ -1092,7 +1095,7 @@ BUILD_CFILES = \
|
||||
elf32-aarch64.c elf64-aarch64.c \
|
||||
elf32-ia64.c elf64-ia64.c \
|
||||
elf32-riscv.c elf64-riscv.c \
|
||||
- peigen.c pepigen.c pex64igen.c
|
||||
+ peigen.c pepigen.c pex64igen.c pe-aarch64igen.c
|
||||
|
||||
CFILES = $(SOURCE_CFILES) $(BUILD_CFILES)
|
||||
SOURCE_HFILES = \
|
||||
@@ -1551,9 +1554,11 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pei-mcore.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pei-sh.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pei-x86_64.Plo@am__quote@
|
||||
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pei-aarch64.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/peigen.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pepigen.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pex64igen.Plo@am__quote@
|
||||
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pe-aarch64igen.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcboot.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reloc.Plo@am__quote@
|
||||
@@ -1991,6 +1996,11 @@ pepigen.c : peXXigen.c
|
||||
pex64igen.c: peXXigen.c
|
||||
echo "#line 1 \"peXXigen.c\"" > $@
|
||||
$(SED) -e s/XX/pex64/g < $< >> $@
|
||||
+
|
||||
+pe-aarch64igen.c: peXXigen.c
|
||||
+ echo "#line 1 \"peXXigen.c\"" > $@
|
||||
+ $(SED) -e s/XX/peAArch64/g < $< >> $@
|
||||
+
|
||||
$(BFD32_LIBS) \
|
||||
$(BFD64_LIBS) \
|
||||
$(ALL_MACHINES) \
|
||||
diff -rup binutils.orig/bfd/bfd.c binutils-2.37/bfd/bfd.c
|
||||
--- binutils.orig/bfd/bfd.c 2021-12-01 13:35:33.821078167 +0000
|
||||
+++ binutils-2.37/bfd/bfd.c 2021-12-01 13:35:43.139988261 +0000
|
||||
@@ -1735,6 +1735,7 @@ bfd_get_sign_extend_vma (bfd *abfd)
|
||||
|| strcmp (name, "pei-i386") == 0
|
||||
|| strcmp (name, "pe-x86-64") == 0
|
||||
|| strcmp (name, "pei-x86-64") == 0
|
||||
+ || strcmp (name, "pei-aarch64-little") == 0
|
||||
|| strcmp (name, "pe-arm-wince-little") == 0
|
||||
|| strcmp (name, "pei-arm-wince-little") == 0
|
||||
|| strcmp (name, "aixcoff-rs6000") == 0
|
||||
Only in binutils-2.37/bfd: coff-aarch64.c
|
||||
diff -rup binutils.orig/bfd/coffcode.h binutils-2.37/bfd/coffcode.h
|
||||
--- binutils.orig/bfd/coffcode.h 2021-12-01 13:35:33.822078158 +0000
|
||||
+++ binutils-2.37/bfd/coffcode.h 2021-12-01 13:35:43.140988251 +0000
|
||||
@@ -2215,6 +2215,12 @@ coff_set_arch_mach_hook (bfd *abfd, void
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
+#ifdef AARCH64MAGIC
|
||||
+ case AARCH64MAGIC:
|
||||
+ arch = bfd_arch_aarch64;
|
||||
+ machine = internal_f->f_flags & F_AARCH64_ARCHITECTURE_MASK;
|
||||
+ break;
|
||||
+#endif
|
||||
#ifdef Z80MAGIC
|
||||
case Z80MAGIC:
|
||||
arch = bfd_arch_z80;
|
||||
@@ -2771,6 +2777,12 @@ coff_set_flags (bfd * abfd,
|
||||
return true;
|
||||
#endif
|
||||
|
||||
+#ifdef AARCH64MAGIC
|
||||
+ case bfd_arch_aarch64:
|
||||
+ * magicp = AARCH64MAGIC;
|
||||
+ return true;
|
||||
+#endif
|
||||
+
|
||||
#ifdef ARMMAGIC
|
||||
case bfd_arch_arm:
|
||||
#ifdef ARM_WINCE
|
||||
@@ -3866,7 +3878,7 @@ coff_write_object_contents (bfd * abfd)
|
||||
internal_f.f_flags |= IMAGE_FILE_LARGE_ADDRESS_AWARE;
|
||||
#endif
|
||||
|
||||
-#ifndef COFF_WITH_pex64
|
||||
+#if !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64)
|
||||
#ifdef COFF_WITH_PE
|
||||
internal_f.f_flags |= IMAGE_FILE_32BIT_MACHINE;
|
||||
#else
|
||||
@@ -3914,6 +3926,11 @@ coff_write_object_contents (bfd * abfd)
|
||||
#define __A_MAGIC_SET__
|
||||
internal_a.magic = ZMAGIC;
|
||||
#endif
|
||||
+
|
||||
+#if defined(AARCH64)
|
||||
+#define __A_MAGIC_SET__
|
||||
+ internal_a.magic = ZMAGIC;
|
||||
+#endif
|
||||
|
||||
#if defined MCORE_PE
|
||||
#define __A_MAGIC_SET__
|
||||
diff -rup binutils.orig/bfd/config.bfd binutils-2.37/bfd/config.bfd
|
||||
--- binutils.orig/bfd/config.bfd 2021-12-01 13:35:33.833078051 +0000
|
||||
+++ binutils-2.37/bfd/config.bfd 2021-12-01 13:35:43.140988251 +0000
|
||||
@@ -232,7 +232,7 @@ case "${targ}" in
|
||||
;;
|
||||
aarch64-*-elf | aarch64-*-rtems* | aarch64-*-genode*)
|
||||
targ_defvec=aarch64_elf64_le_vec
|
||||
- targ_selvecs="aarch64_elf64_be_vec aarch64_elf32_le_vec aarch64_elf32_be_vec arm_elf32_le_vec arm_elf32_be_vec"
|
||||
+ targ_selvecs="aarch64_elf64_be_vec aarch64_elf32_le_vec aarch64_elf32_be_vec arm_elf32_le_vec arm_elf32_be_vec aarch64_pei_vec"
|
||||
want64=true
|
||||
;;
|
||||
aarch64_be-*-elf)
|
||||
@@ -257,7 +257,7 @@ case "${targ}" in
|
||||
;;
|
||||
aarch64-*-linux* | aarch64-*-netbsd*)
|
||||
targ_defvec=aarch64_elf64_le_vec
|
||||
- targ_selvecs="aarch64_elf64_be_vec aarch64_elf32_le_vec aarch64_elf32_be_vec arm_elf32_le_vec arm_elf32_be_vec"
|
||||
+ targ_selvecs="aarch64_elf64_be_vec aarch64_elf32_le_vec aarch64_elf32_be_vec arm_elf32_le_vec arm_elf32_be_vec aarch64_pei_vec"
|
||||
want64=true
|
||||
;;
|
||||
aarch64_be-*-linux* | aarch64_be-*-netbsd*)
|
||||
diff -rup binutils.orig/bfd/configure binutils-2.37/bfd/configure
|
||||
--- binutils.orig/bfd/configure 2021-12-01 13:35:33.817078206 +0000
|
||||
+++ binutils-2.37/bfd/configure 2021-12-01 13:35:43.141988241 +0000
|
||||
@@ -13283,6 +13283,7 @@ do
|
||||
aarch64_elf64_le_vec) tb="$tb elf64-aarch64.lo elfxx-aarch64.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;;
|
||||
aarch64_elf64_le_cloudabi_vec) tb="$tb elf64-aarch64.lo elfxx-aarch64.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;;
|
||||
aarch64_mach_o_vec) tb="$tb mach-o-aarch64.lo"; target_size=64 ;;
|
||||
+ aarch64_pei_vec) tb="$tb pei-aarch64.lo pe-aarch64igen.lo $coff"; target_size=64 ;;
|
||||
alpha_ecoff_le_vec) tb="$tb coff-alpha.lo ecoff.lo $ecoff"; target_size=64 ;;
|
||||
alpha_elf64_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
|
||||
alpha_elf64_fbsd_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
|
||||
diff -rup binutils.orig/bfd/configure.ac binutils-2.37/bfd/configure.ac
|
||||
--- binutils.orig/bfd/configure.ac 2021-12-01 13:35:33.829078090 +0000
|
||||
+++ binutils-2.37/bfd/configure.ac 2021-12-01 13:35:43.141988241 +0000
|
||||
@@ -439,6 +439,7 @@ do
|
||||
aarch64_elf64_le_vec) tb="$tb elf64-aarch64.lo elfxx-aarch64.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;;
|
||||
aarch64_elf64_le_cloudabi_vec) tb="$tb elf64-aarch64.lo elfxx-aarch64.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;;
|
||||
aarch64_mach_o_vec) tb="$tb mach-o-aarch64.lo"; target_size=64 ;;
|
||||
+ aarch64_pei_vec) tb="$tb pei-aarch64.lo pe-aarch64igen.lo $coff"; target_size=64 ;;
|
||||
alpha_ecoff_le_vec) tb="$tb coff-alpha.lo ecoff.lo $ecoff"; target_size=64 ;;
|
||||
alpha_elf64_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
|
||||
alpha_elf64_fbsd_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
|
||||
diff -rup binutils.orig/bfd/libpei.h binutils-2.37/bfd/libpei.h
|
||||
--- binutils.orig/bfd/libpei.h 2021-12-01 13:35:33.830078081 +0000
|
||||
+++ binutils-2.37/bfd/libpei.h 2021-12-01 13:35:43.141988241 +0000
|
||||
@@ -275,6 +275,41 @@
|
||||
#define _bfd_XXi_write_codeview_record _bfd_pepi_write_codeview_record
|
||||
#define _bfd_XXi_slurp_codeview_record _bfd_pepi_slurp_codeview_record
|
||||
|
||||
+#elif defined COFF_WITH_peAArch64
|
||||
+
|
||||
+#define GET_OPTHDR_IMAGE_BASE H_GET_64
|
||||
+#define PUT_OPTHDR_IMAGE_BASE H_PUT_64
|
||||
+#define GET_OPTHDR_SIZE_OF_STACK_RESERVE H_GET_64
|
||||
+#define PUT_OPTHDR_SIZE_OF_STACK_RESERVE H_PUT_64
|
||||
+#define GET_OPTHDR_SIZE_OF_STACK_COMMIT H_GET_64
|
||||
+#define PUT_OPTHDR_SIZE_OF_STACK_COMMIT H_PUT_64
|
||||
+#define GET_OPTHDR_SIZE_OF_HEAP_RESERVE H_GET_64
|
||||
+#define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE H_PUT_64
|
||||
+#define GET_OPTHDR_SIZE_OF_HEAP_COMMIT H_GET_64
|
||||
+#define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT H_PUT_64
|
||||
+#define GET_PDATA_ENTRY bfd_get_32
|
||||
+
|
||||
+#define _bfd_XX_bfd_copy_private_bfd_data_common _bfd_peAArch64_bfd_copy_private_bfd_data_common
|
||||
+#define _bfd_XX_bfd_copy_private_section_data _bfd_peAArch64_bfd_copy_private_section_data
|
||||
+#define _bfd_XX_get_symbol_info _bfd_peAArch64_get_symbol_info
|
||||
+#define _bfd_XX_only_swap_filehdr_out _bfd_peAArch64_only_swap_filehdr_out
|
||||
+#define _bfd_XX_print_private_bfd_data_common _bfd_peAArch64_print_private_bfd_data_common
|
||||
+#define _bfd_XXi_final_link_postscript _bfd_peAArch64i_final_link_postscript
|
||||
+#define _bfd_XXi_only_swap_filehdr_out _bfd_peAArch64i_only_swap_filehdr_out
|
||||
+#define _bfd_XXi_swap_aouthdr_in _bfd_peAArch64i_swap_aouthdr_in
|
||||
+#define _bfd_XXi_swap_aouthdr_out _bfd_peAArch64i_swap_aouthdr_out
|
||||
+#define _bfd_XXi_swap_aux_in _bfd_peAArch64i_swap_aux_in
|
||||
+#define _bfd_XXi_swap_aux_out _bfd_peAArch64i_swap_aux_out
|
||||
+#define _bfd_XXi_swap_lineno_in _bfd_peAArch64i_swap_lineno_in
|
||||
+#define _bfd_XXi_swap_lineno_out _bfd_peAArch64i_swap_lineno_out
|
||||
+#define _bfd_XXi_swap_scnhdr_out _bfd_peAArch64i_swap_scnhdr_out
|
||||
+#define _bfd_XXi_swap_sym_in _bfd_peAArch64i_swap_sym_in
|
||||
+#define _bfd_XXi_swap_sym_out _bfd_peAArch64i_swap_sym_out
|
||||
+#define _bfd_XXi_swap_debugdir_in _bfd_peAArch64i_swap_debugdir_in
|
||||
+#define _bfd_XXi_swap_debugdir_out _bfd_peAArch64i_swap_debugdir_out
|
||||
+#define _bfd_XXi_write_codeview_record _bfd_peAArch64i_write_codeview_record
|
||||
+#define _bfd_XXi_slurp_codeview_record _bfd_peAArch64i_slurp_codeview_record
|
||||
+
|
||||
#else /* !COFF_WITH_pep */
|
||||
|
||||
#define GET_OPTHDR_IMAGE_BASE H_GET_32
|
||||
@@ -369,5 +404,6 @@ bool _bfd_XX_bfd_copy_private_section_da
|
||||
bool _bfd_pe_print_ce_compressed_pdata (bfd *, void *);
|
||||
bool _bfd_pe64_print_ce_compressed_pdata (bfd *, void *);
|
||||
bool _bfd_pex64_print_ce_compressed_pdata (bfd *, void *);
|
||||
+bool _bfd_peAArch64_print_ce_compressed_pdata (bfd *, void *);
|
||||
bool _bfd_pep_print_ce_compressed_pdata (bfd *, void *);
|
||||
|
||||
diff -rup binutils.orig/bfd/peXXigen.c binutils-2.37/bfd/peXXigen.c
|
||||
--- binutils.orig/bfd/peXXigen.c 2021-12-01 13:35:33.827078110 +0000
|
||||
+++ binutils-2.37/bfd/peXXigen.c 2021-12-01 13:35:43.142988232 +0000
|
||||
@@ -60,8 +60,9 @@
|
||||
on this code has a chance of getting something accomplished without
|
||||
wasting too much time. */
|
||||
|
||||
-/* This expands into COFF_WITH_pe, COFF_WITH_pep, or COFF_WITH_pex64
|
||||
- depending on whether we're compiling for straight PE or PE+. */
|
||||
+/* This expands into COFF_WITH_pe, COFF_WITH_pep, COFF_WITH_pex64 or
|
||||
+ COFF_WITH_peAArch64 depending on whether we're compiling for straight
|
||||
+ PE or PE+. */
|
||||
#define COFF_WITH_XX
|
||||
|
||||
#include "sysdep.h"
|
||||
@@ -83,6 +84,8 @@
|
||||
# include "coff/x86_64.h"
|
||||
#elif defined COFF_WITH_pep
|
||||
# include "coff/ia64.h"
|
||||
+#elif defined COFF_WITH_peAArch64
|
||||
+# include "coff/aarch64.h"
|
||||
#else
|
||||
# include "coff/i386.h"
|
||||
#endif
|
||||
@@ -92,7 +95,7 @@
|
||||
#include "libpei.h"
|
||||
#include "safe-ctype.h"
|
||||
|
||||
-#if defined COFF_WITH_pep || defined COFF_WITH_pex64
|
||||
+#if defined COFF_WITH_pep || defined COFF_WITH_pex64 || defined COFF_WITH_peAArch64
|
||||
# undef AOUTSZ
|
||||
# define AOUTSZ PEPAOUTSZ
|
||||
# define PEAOUTHDR PEPAOUTHDR
|
||||
@@ -469,7 +472,7 @@ _bfd_XXi_swap_aouthdr_in (bfd * abfd,
|
||||
aouthdr_int->text_start =
|
||||
GET_AOUTHDR_TEXT_START (abfd, aouthdr_ext->text_start);
|
||||
|
||||
-#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
|
||||
+#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64)
|
||||
/* PE32+ does not have data_start member! */
|
||||
aouthdr_int->data_start =
|
||||
GET_AOUTHDR_DATA_START (abfd, aouthdr_ext->data_start);
|
||||
@@ -555,7 +558,7 @@ _bfd_XXi_swap_aouthdr_in (bfd * abfd,
|
||||
if (aouthdr_int->entry)
|
||||
{
|
||||
aouthdr_int->entry += a->ImageBase;
|
||||
-#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
|
||||
+#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64)
|
||||
aouthdr_int->entry &= 0xffffffff;
|
||||
#endif
|
||||
}
|
||||
@@ -563,12 +566,12 @@ _bfd_XXi_swap_aouthdr_in (bfd * abfd,
|
||||
if (aouthdr_int->tsize)
|
||||
{
|
||||
aouthdr_int->text_start += a->ImageBase;
|
||||
-#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
|
||||
+#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64)
|
||||
aouthdr_int->text_start &= 0xffffffff;
|
||||
#endif
|
||||
}
|
||||
|
||||
-#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
|
||||
+#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64)
|
||||
/* PE32+ does not have data_start member! */
|
||||
if (aouthdr_int->dsize)
|
||||
{
|
||||
@@ -628,7 +631,7 @@ _bfd_XXi_swap_aouthdr_out (bfd * abfd, v
|
||||
if (aouthdr_in->tsize)
|
||||
{
|
||||
aouthdr_in->text_start -= ib;
|
||||
-#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
|
||||
+#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64)
|
||||
aouthdr_in->text_start &= 0xffffffff;
|
||||
#endif
|
||||
}
|
||||
@@ -636,7 +639,7 @@ _bfd_XXi_swap_aouthdr_out (bfd * abfd, v
|
||||
if (aouthdr_in->dsize)
|
||||
{
|
||||
aouthdr_in->data_start -= ib;
|
||||
-#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
|
||||
+#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64)
|
||||
aouthdr_in->data_start &= 0xffffffff;
|
||||
#endif
|
||||
}
|
||||
@@ -644,7 +647,7 @@ _bfd_XXi_swap_aouthdr_out (bfd * abfd, v
|
||||
if (aouthdr_in->entry)
|
||||
{
|
||||
aouthdr_in->entry -= ib;
|
||||
-#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
|
||||
+#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64)
|
||||
aouthdr_in->entry &= 0xffffffff;
|
||||
#endif
|
||||
}
|
||||
@@ -748,7 +751,7 @@ _bfd_XXi_swap_aouthdr_out (bfd * abfd, v
|
||||
PUT_AOUTHDR_TEXT_START (abfd, aouthdr_in->text_start,
|
||||
aouthdr_out->standard.text_start);
|
||||
|
||||
-#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
|
||||
+#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64)
|
||||
/* PE32+ does not have data_start member! */
|
||||
PUT_AOUTHDR_DATA_START (abfd, aouthdr_in->data_start,
|
||||
aouthdr_out->standard.data_start);
|
||||
@@ -1800,7 +1803,7 @@ pe_print_edata (bfd * abfd, void * vfile
|
||||
static bool
|
||||
pe_print_pdata (bfd * abfd, void * vfile)
|
||||
{
|
||||
-#if defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
|
||||
+#if defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64)
|
||||
# define PDATA_ROW_SIZE (3 * 8)
|
||||
#else
|
||||
# define PDATA_ROW_SIZE (5 * 4)
|
||||
@@ -1827,7 +1830,7 @@ pe_print_pdata (bfd * abfd, void * vfile
|
||||
|
||||
fprintf (file,
|
||||
_("\nThe Function Table (interpreted .pdata section contents)\n"));
|
||||
-#if defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
|
||||
+#if defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64)
|
||||
fprintf (file,
|
||||
_(" vma:\t\t\tBegin Address End Address Unwind Info\n"));
|
||||
#else
|
||||
@@ -1864,7 +1867,7 @@ pe_print_pdata (bfd * abfd, void * vfile
|
||||
bfd_vma eh_handler;
|
||||
bfd_vma eh_data;
|
||||
bfd_vma prolog_end_addr;
|
||||
-#if !defined(COFF_WITH_pep) || defined(COFF_WITH_pex64)
|
||||
+#if !defined(COFF_WITH_pep) || defined(COFF_WITH_pex64) || defined(COFF_WITH_peAArch64)
|
||||
int em_data;
|
||||
#endif
|
||||
|
||||
@@ -1882,7 +1885,7 @@ pe_print_pdata (bfd * abfd, void * vfile
|
||||
/* We are probably into the padding of the section now. */
|
||||
break;
|
||||
|
||||
-#if !defined(COFF_WITH_pep) || defined(COFF_WITH_pex64)
|
||||
+#if !defined(COFF_WITH_pep) || defined(COFF_WITH_pex64) || defined(COFF_WITH_peAArch64)
|
||||
em_data = ((eh_handler & 0x1) << 2) | (prolog_end_addr & 0x3);
|
||||
#endif
|
||||
eh_handler &= ~(bfd_vma) 0x3;
|
||||
@@ -1893,7 +1896,7 @@ pe_print_pdata (bfd * abfd, void * vfile
|
||||
bfd_fprintf_vma (abfd, file, begin_addr); fputc (' ', file);
|
||||
bfd_fprintf_vma (abfd, file, end_addr); fputc (' ', file);
|
||||
bfd_fprintf_vma (abfd, file, eh_handler);
|
||||
-#if !defined(COFF_WITH_pep) || defined(COFF_WITH_pex64)
|
||||
+#if !defined(COFF_WITH_pep) || defined(COFF_WITH_pex64) || defined(COFF_WITH_peAArch64)
|
||||
fputc (' ', file);
|
||||
bfd_fprintf_vma (abfd, file, eh_data); fputc (' ', file);
|
||||
bfd_fprintf_vma (abfd, file, prolog_end_addr);
|
||||
@@ -2784,7 +2787,7 @@ _bfd_XX_print_private_bfd_data_common (b
|
||||
bfd_fprintf_vma (abfd, file, i->AddressOfEntryPoint);
|
||||
fprintf (file, "\nBaseOfCode\t\t");
|
||||
bfd_fprintf_vma (abfd, file, i->BaseOfCode);
|
||||
-#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
|
||||
+#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64)
|
||||
/* PE32+ does not have BaseOfData member! */
|
||||
fprintf (file, "\nBaseOfData\t\t");
|
||||
bfd_fprintf_vma (abfd, file, i->BaseOfData);
|
||||
@@ -3085,7 +3088,7 @@ _bfd_XX_get_symbol_info (bfd * abfd, asy
|
||||
coff_get_symbol_info (abfd, symbol, ret);
|
||||
}
|
||||
|
||||
-#if !defined(COFF_WITH_pep) && defined(COFF_WITH_pex64)
|
||||
+#if !defined(COFF_WITH_pep) && defined(COFF_WITH_pex64) && defined(COFF_WITH_peAArch64)
|
||||
static int
|
||||
sort_x64_pdata (const void *l, const void *r)
|
||||
{
|
||||
@@ -4504,7 +4507,7 @@ _bfd_XXi_final_link_postscript (bfd * ab
|
||||
the TLS data directory consists of 4 pointers, followed
|
||||
by two 4-byte integer. This implies that the total size
|
||||
is different for 32-bit and 64-bit executables. */
|
||||
-#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
|
||||
+#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64)
|
||||
pe_data (abfd)->pe_opthdr.DataDirectory[PE_TLS_TABLE].Size = 0x18;
|
||||
#else
|
||||
pe_data (abfd)->pe_opthdr.DataDirectory[PE_TLS_TABLE].Size = 0x28;
|
||||
@@ -4513,7 +4516,7 @@ _bfd_XXi_final_link_postscript (bfd * ab
|
||||
|
||||
/* If there is a .pdata section and we have linked pdata finally, we
|
||||
need to sort the entries ascending. */
|
||||
-#if !defined(COFF_WITH_pep) && defined(COFF_WITH_pex64)
|
||||
+#if !defined(COFF_WITH_pep) && defined(COFF_WITH_pex64) && defined(COFF_WITH_peAArch64)
|
||||
{
|
||||
asection *sec = bfd_get_section_by_name (abfd, ".pdata");
|
||||
|
||||
Only in binutils-2.37/bfd: pei-aarch64.c
|
||||
diff -rup binutils.orig/bfd/peicode.h binutils-2.37/bfd/peicode.h
|
||||
--- binutils.orig/bfd/peicode.h 2021-12-01 13:35:33.829078090 +0000
|
||||
+++ binutils-2.37/bfd/peicode.h 2021-12-01 13:35:43.142988232 +0000
|
||||
@@ -231,7 +231,7 @@ coff_swap_scnhdr_in (bfd * abfd, void *
|
||||
{
|
||||
scnhdr_int->s_vaddr += pe_data (abfd)->pe_opthdr.ImageBase;
|
||||
/* Do not cut upper 32-bits for 64-bit vma. */
|
||||
-#ifndef COFF_WITH_pex64
|
||||
+#if !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64)
|
||||
scnhdr_int->s_vaddr &= 0xffffffff;
|
||||
#endif
|
||||
}
|
||||
@@ -738,6 +738,16 @@ static const jump_table jtab[] =
|
||||
},
|
||||
#endif
|
||||
|
||||
+#ifdef AARCH64MAGIC
|
||||
+/* We don't currently support jumping to DLLs, so if
|
||||
+ someone does try emit a runtime trap. Through UDF #0. */
|
||||
+ { AARCH64MAGIC,
|
||||
+ { 0x00, 0x00, 0x00, 0x00 },
|
||||
+ 4, 0
|
||||
+ },
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
#ifdef ARMPEMAGIC
|
||||
{ ARMPEMAGIC,
|
||||
{ 0x00, 0xc0, 0x9f, 0xe5, 0x00, 0xf0,
|
||||
@@ -910,7 +920,7 @@ pe_ILF_build_a_bfd (bfd * abfd,
|
||||
/* See PR 20907 for a reproducer. */
|
||||
goto error_return;
|
||||
|
||||
-#ifdef COFF_WITH_pex64
|
||||
+#if defined(COFF_WITH_pex64) || defined(COFF_WITH_peAArch64)
|
||||
((unsigned int *) id4->contents)[0] = ordinal;
|
||||
((unsigned int *) id4->contents)[1] = 0x80000000;
|
||||
((unsigned int *) id5->contents)[0] = ordinal;
|
||||
@@ -1206,6 +1216,12 @@ pe_ILF_object_p (bfd * abfd)
|
||||
#endif
|
||||
break;
|
||||
|
||||
+ case IMAGE_FILE_MACHINE_ARM64:
|
||||
+#ifdef AARCH64MAGIC
|
||||
+ magic = AARCH64MAGIC;
|
||||
+#endif
|
||||
+ break;
|
||||
+
|
||||
case IMAGE_FILE_MACHINE_THUMB:
|
||||
#ifdef THUMBPEMAGIC
|
||||
{
|
||||
diff -rup binutils.orig/bfd/targets.c binutils-2.37/bfd/targets.c
|
||||
--- binutils.orig/bfd/targets.c 2021-12-01 13:35:33.829078090 +0000
|
||||
+++ binutils-2.37/bfd/targets.c 2021-12-01 13:35:43.142988232 +0000
|
||||
@@ -679,6 +679,7 @@ extern const bfd_target aarch64_elf64_be
|
||||
extern const bfd_target aarch64_elf64_le_vec;
|
||||
extern const bfd_target aarch64_elf64_le_cloudabi_vec;
|
||||
extern const bfd_target aarch64_mach_o_vec;
|
||||
+extern const bfd_target aarch64_pei_vec;
|
||||
extern const bfd_target alpha_ecoff_le_vec;
|
||||
extern const bfd_target alpha_elf64_vec;
|
||||
extern const bfd_target alpha_elf64_fbsd_vec;
|
||||
@@ -991,6 +992,7 @@ static const bfd_target * const _bfd_tar
|
||||
&aarch64_elf64_le_vec,
|
||||
&aarch64_elf64_le_cloudabi_vec,
|
||||
&aarch64_mach_o_vec,
|
||||
+ &aarch64_pei_vec,
|
||||
#endif
|
||||
|
||||
#ifdef BFD64
|
||||
diff -rup binutils.orig/binutils/NEWS binutils-2.37/binutils/NEWS
|
||||
--- binutils.orig/binutils/NEWS 2021-12-01 13:35:33.320083001 +0000
|
||||
+++ binutils-2.37/binutils/NEWS 2021-12-01 13:35:43.142988232 +0000
|
||||
@@ -9,6 +9,9 @@
|
||||
using --unicode=highlight will display them as unicode escape sequences
|
||||
highlighted in red (if supported by the output device).
|
||||
|
||||
+* Support for efi-app-aarch64, efi-rtdrv-aarch64 and efi-bsdrv-aarch64 has been
|
||||
+ added to objcopy in order to enable UEFI development using binutils.
|
||||
+
|
||||
Changes in 2.37:
|
||||
|
||||
* The readelf tool has a new command line option which can be used to specify
|
||||
Only in binutils.orig/binutils: NEWS.orig
|
||||
Only in binutils.orig/binutils: NEWS.rej
|
||||
Only in binutils.orig/binutils: nm.c.orig
|
||||
diff -rup binutils.orig/binutils/objcopy.c binutils-2.37/binutils/objcopy.c
|
||||
--- binutils.orig/binutils/objcopy.c 2021-12-01 13:35:33.302083174 +0000
|
||||
+++ binutils-2.37/binutils/objcopy.c 2021-12-01 13:35:43.143988222 +0000
|
||||
@@ -4987,6 +4987,13 @@ convert_efi_target (char *efi)
|
||||
/* Change x86_64 to x86-64. */
|
||||
efi[7] = '-';
|
||||
}
|
||||
+ else if (strcmp (efi + 4, "aarch64") == 0)
|
||||
+ {
|
||||
+ /* Change aarch64 to aarch64-little. */
|
||||
+ efi = (char *) xrealloc (efi, strlen (efi) + 7);
|
||||
+ char *t = "aarch64-little";
|
||||
+ strcpy (efi + 4, t);
|
||||
+ }
|
||||
}
|
||||
|
||||
/* Allocate and return a pointer to a struct section_add, initializing the
|
||||
Only in binutils.orig/binutils: objdump.c.orig
|
||||
Only in binutils.orig/binutils: objdump.c.rej
|
||||
Only in binutils.orig/binutils: readelf.c.orig
|
||||
Only in binutils-2.37/binutils/testsuite/binutils-all/aarch64: pei-aarch64-little.d
|
||||
Only in binutils-2.37/binutils/testsuite/binutils-all/aarch64: pei-aarch64-little.s
|
||||
Only in binutils-2.37/include/coff: aarch64.h
|
||||
diff -rup binutils.orig/include/coff/pe.h binutils-2.37/include/coff/pe.h
|
||||
--- binutils.orig/include/coff/pe.h 2021-12-01 13:35:33.251083666 +0000
|
||||
+++ binutils-2.37/include/coff/pe.h 2021-12-01 13:35:43.143988222 +0000
|
||||
@@ -137,6 +137,7 @@
|
||||
#define IMAGE_FILE_MACHINE_AM33 0x01d3
|
||||
#define IMAGE_FILE_MACHINE_AMD64 0x8664
|
||||
#define IMAGE_FILE_MACHINE_ARM 0x01c0
|
||||
+#define IMAGE_FILE_MACHINE_ARM64 0xaa64
|
||||
#define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64
|
||||
#define IMAGE_FILE_MACHINE_CEE 0xc0ee
|
||||
#define IMAGE_FILE_MACHINE_CEF 0x0cef
|
||||
--- /dev/null 2021-12-01 09:13:46.241760896 +0000
|
||||
+++ binutils-2.37/include/coff/aarch64.h 2021-12-01 13:35:43.143988222 +0000
|
||||
@@ -0,0 +1,63 @@
|
||||
+/* AArch64 COFF support for BFD.
|
||||
+ Copyright (C) 2021 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This file is part of BFD, the Binary File Descriptor library.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program; if not, write to the Free Software Foundation,
|
||||
+ Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
+
|
||||
+#define COFFAARCH64 1
|
||||
+
|
||||
+#define L_LNNO_SIZE 2
|
||||
+#define INCLUDE_COMDAT_FIELDS_IN_AUXENT
|
||||
+#include "coff/external.h"
|
||||
+
|
||||
+#define F_AARCH64_ARCHITECTURE_MASK (0x4000)
|
||||
+
|
||||
+#define AARCH64MAGIC 0xaa64 /* From Microsoft specification. */
|
||||
+
|
||||
+#undef BADMAG
|
||||
+#define BADMAG(x) ((x).f_magic != AARCH64MAGIC)
|
||||
+#define AARCH64 1 /* Customize coffcode.h. */
|
||||
+
|
||||
+#define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
|
||||
+
|
||||
+#define OMAGIC 0404 /* Object files, eg as output. */
|
||||
+#define ZMAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC /* Demand load format, eg normal ld output 0x10b. */
|
||||
+#define STMAGIC 0401 /* Target shlib. */
|
||||
+#define SHMAGIC 0443 /* Host shlib. */
|
||||
+
|
||||
+/* define some NT default values */
|
||||
+/* #define NT_IMAGE_BASE 0x400000 moved to internal.h */
|
||||
+#define NT_SECTION_ALIGNMENT 0x1000
|
||||
+#define NT_FILE_ALIGNMENT 0x200
|
||||
+#define NT_DEF_RESERVE 0x100000
|
||||
+#define NT_DEF_COMMIT 0x1000
|
||||
+
|
||||
+/* We use the .rdata section to hold read only data. */
|
||||
+#define _LIT ".rdata"
|
||||
+
|
||||
+/********************** RELOCATION DIRECTIVES **********************/
|
||||
+struct external_reloc
|
||||
+{
|
||||
+ char r_vaddr[4];
|
||||
+ char r_symndx[4];
|
||||
+ char r_type[2];
|
||||
+ char r_offset[4];
|
||||
+};
|
||||
+
|
||||
+#define RELOC struct external_reloc
|
||||
+#define RELSZ 14
|
||||
+
|
||||
+#define ARM_NOTE_SECTION ".note"
|
||||
--- /dev/null 2021-12-01 09:13:46.241760896 +0000
|
||||
+++ binutils-2.37/bfd/coff-aarch64.c 2021-12-01 13:35:43.139988261 +0000
|
||||
@@ -0,0 +1,166 @@
|
||||
+/* BFD back-end for AArch64 COFF files.
|
||||
+ Copyright (C) 2021 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This file is part of BFD, the Binary File Descriptor library.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program; if not, write to the Free Software
|
||||
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
||||
+ MA 02110-1301, USA. */
|
||||
+
|
||||
+
|
||||
+#ifndef COFF_WITH_peAArch64
|
||||
+#define COFF_WITH_peAArch64
|
||||
+#endif
|
||||
+
|
||||
+/* Note we have to make sure not to include headers twice.
|
||||
+ Not all headers are wrapped in #ifdef guards, so we define
|
||||
+ PEI_HEADERS to prevent double including here. */
|
||||
+#ifndef PEI_HEADERS
|
||||
+#include "sysdep.h"
|
||||
+#include "bfd.h"
|
||||
+#include "libbfd.h"
|
||||
+#include "coff/aarch64.h"
|
||||
+#include "coff/internal.h"
|
||||
+#include "coff/pe.h"
|
||||
+#include "libcoff.h"
|
||||
+#include "libiberty.h"
|
||||
+#endif
|
||||
+
|
||||
+#include "libcoff.h"
|
||||
+
|
||||
+/* The page size is a guess based on ELF. */
|
||||
+
|
||||
+#define COFF_PAGE_SIZE 0x1000
|
||||
+
|
||||
+/* All users of this file have bfd_octets_per_byte (abfd, sec) == 1. */
|
||||
+#define OCTETS_PER_BYTE(ABFD, SEC) 1
|
||||
+
|
||||
+#ifndef PCRELOFFSET
|
||||
+#define PCRELOFFSET true
|
||||
+#endif
|
||||
+
|
||||
+/* Currently we don't handle any relocations. */
|
||||
+static reloc_howto_type pe_aarch64_std_reloc_howto[] =
|
||||
+ {
|
||||
+
|
||||
+ };
|
||||
+
|
||||
+#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER 2
|
||||
+#define COFF_PAGE_SIZE 0x1000
|
||||
+
|
||||
+#ifndef NUM_ELEM
|
||||
+#define NUM_ELEM(a) ((sizeof (a)) / sizeof ((a)[0]))
|
||||
+#endif
|
||||
+
|
||||
+#define NUM_RELOCS NUM_ELEM (pe_aarch64_std_reloc_howto)
|
||||
+
|
||||
+#define RTYPE2HOWTO(cache_ptr, dst) \
|
||||
+ (cache_ptr)->howto = NULL
|
||||
+
|
||||
+#ifndef bfd_pe_print_pdata
|
||||
+#define bfd_pe_print_pdata NULL
|
||||
+#endif
|
||||
+
|
||||
+/* Return TRUE if this relocation should
|
||||
+ appear in the output .reloc section. */
|
||||
+
|
||||
+static bool
|
||||
+in_reloc_p (bfd * abfd ATTRIBUTE_UNUSED,
|
||||
+ reloc_howto_type * howto)
|
||||
+{
|
||||
+ return !howto->pc_relative;
|
||||
+}
|
||||
+
|
||||
+#include "coffcode.h"
|
||||
+
|
||||
+/* Target vectors. */
|
||||
+const bfd_target
|
||||
+#ifdef TARGET_SYM
|
||||
+ TARGET_SYM =
|
||||
+#else
|
||||
+ aarch64_pei_vec =
|
||||
+#endif
|
||||
+{
|
||||
+#ifdef TARGET_NAME
|
||||
+ TARGET_NAME,
|
||||
+#else
|
||||
+ "pei-aarch64-little", /* Name. */
|
||||
+#endif
|
||||
+ bfd_target_coff_flavour,
|
||||
+ BFD_ENDIAN_LITTLE, /* Data byte order is little. */
|
||||
+ BFD_ENDIAN_LITTLE, /* Header byte order is little. */
|
||||
+
|
||||
+ (HAS_RELOC | EXEC_P /* Object flags. */
|
||||
+ | HAS_LINENO | HAS_DEBUG
|
||||
+ | HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED | BFD_COMPRESS | BFD_DECOMPRESS),
|
||||
+
|
||||
+ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* Section flags. */
|
||||
+#if defined(COFF_WITH_PE)
|
||||
+ | SEC_LINK_ONCE | SEC_LINK_DUPLICATES | SEC_READONLY | SEC_DEBUGGING
|
||||
+#endif
|
||||
+ | SEC_CODE | SEC_DATA | SEC_EXCLUDE ),
|
||||
+
|
||||
+#ifdef TARGET_UNDERSCORE
|
||||
+ TARGET_UNDERSCORE, /* Leading underscore. */
|
||||
+#else
|
||||
+ 0, /* Leading underscore. */
|
||||
+#endif
|
||||
+ '/', /* Ar_pad_char. */
|
||||
+ 15, /* Ar_max_namelen. */
|
||||
+ 0, /* match priority. */
|
||||
+ TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols. */
|
||||
+
|
||||
+ /* Data conversion functions. */
|
||||
+ bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
||||
+ bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
||||
+ bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Data. */
|
||||
+ /* Header conversion functions. */
|
||||
+ bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
||||
+ bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
||||
+ bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Hdrs. */
|
||||
+
|
||||
+ /* Note that we allow an object file to be treated as a core file as well. */
|
||||
+ { /* bfd_check_format. */
|
||||
+ _bfd_dummy_target,
|
||||
+ coff_object_p,
|
||||
+ bfd_generic_archive_p,
|
||||
+ coff_object_p
|
||||
+ },
|
||||
+ { /* bfd_set_format. */
|
||||
+ _bfd_bool_bfd_false_error,
|
||||
+ coff_mkobject,
|
||||
+ _bfd_generic_mkarchive,
|
||||
+ _bfd_bool_bfd_false_error
|
||||
+ },
|
||||
+ { /* bfd_write_contents. */
|
||||
+ _bfd_bool_bfd_false_error,
|
||||
+ coff_write_object_contents,
|
||||
+ _bfd_write_archive_contents,
|
||||
+ _bfd_bool_bfd_false_error
|
||||
+ },
|
||||
+
|
||||
+ BFD_JUMP_TABLE_GENERIC (coff),
|
||||
+ BFD_JUMP_TABLE_COPY (coff),
|
||||
+ BFD_JUMP_TABLE_CORE (_bfd_nocore),
|
||||
+ BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
|
||||
+ BFD_JUMP_TABLE_SYMBOLS (coff),
|
||||
+ BFD_JUMP_TABLE_RELOCS (coff),
|
||||
+ BFD_JUMP_TABLE_WRITE (coff),
|
||||
+ BFD_JUMP_TABLE_LINK (coff),
|
||||
+ BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
||||
+
|
||||
+ NULL,
|
||||
+
|
||||
+ COFF_SWAP_TABLE
|
||||
+};
|
||||
--- /dev/null 2021-12-01 09:13:46.241760896 +0000
|
||||
+++ binutils-2.37/binutils/testsuite/binutils-all/aarch64/pei-aarch64-little.s 2021-12-01 13:35:43.143988222 +0000
|
||||
@@ -0,0 +1,42 @@
|
||||
+ .arch armv8-a
|
||||
+ .text
|
||||
+ .align 2
|
||||
+ .global foo
|
||||
+ .type foo, %function
|
||||
+foo:
|
||||
+.LFB0:
|
||||
+ .cfi_startproc
|
||||
+ sub sp, sp, #16
|
||||
+ .cfi_def_cfa_offset 16
|
||||
+ str w0, [sp, 12]
|
||||
+ ldr w0, [sp, 12]
|
||||
+ mul w0, w0, w0
|
||||
+ add sp, sp, 16
|
||||
+ .cfi_def_cfa_offset 0
|
||||
+ ret
|
||||
+ .cfi_endproc
|
||||
+.LFE0:
|
||||
+ .size foo, .-foo
|
||||
+ .align 2
|
||||
+ .global main
|
||||
+ .type main, %function
|
||||
+main:
|
||||
+.LFB1:
|
||||
+ .cfi_startproc
|
||||
+ stp x29, x30, [sp, -16]!
|
||||
+ .cfi_def_cfa_offset 16
|
||||
+ .cfi_offset 29, -16
|
||||
+ .cfi_offset 30, -8
|
||||
+ mov x29, sp
|
||||
+ mov w0, 5
|
||||
+ bl foo
|
||||
+ ldp x29, x30, [sp], 16
|
||||
+ .cfi_restore 30
|
||||
+ .cfi_restore 29
|
||||
+ .cfi_def_cfa_offset 0
|
||||
+ ret
|
||||
+ .cfi_endproc
|
||||
+.LFE1:
|
||||
+ .size main, .-main
|
||||
+ .ident "GCC: (fsf-trunk.2870) 12.0.0 20210930 (experimental)"
|
||||
+ .section .note.GNU-stack,"",@progbits
|
||||
--- /dev/null 2021-12-01 09:13:46.241760896 +0000
|
||||
+++ binutils-2.37/binutils/testsuite/binutils-all/aarch64/pei-aarch64-little.d 2021-12-01 13:35:43.143988222 +0000
|
||||
@@ -0,0 +1,16 @@
|
||||
+#skip: aarch64_be-*-*
|
||||
+#ld: -e0
|
||||
+#PROG: objcopy
|
||||
+#objcopy: -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel -j .rela -j .rel.* -j .rela.* -j .rel* -j .rela* -j .reloc --target=efi-app-aarch64
|
||||
+#objdump: -h -f
|
||||
+#name: Check if efi app format is recognized
|
||||
+
|
||||
+.*: file format pei-aarch64-little
|
||||
+architecture: aarch64, flags 0x00000132:
|
||||
+EXEC_P, HAS_SYMS, HAS_LOCALS, D_PAGED
|
||||
+start address 0x0000000000000000
|
||||
+
|
||||
+Sections:
|
||||
+Idx Name Size VMA LMA File off Algn
|
||||
+ 0 \.text 00000030 0[^ ]+ 0[^ ]+ 0[^ ]+ 2\*\*2
|
||||
+ CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||
--- /dev/null 2021-11-30 07:48:35.901044247 +0000
|
||||
+++ binutils-2.35.2/bfd/pei-aarch64.c 2021-11-30 13:38:37.255656936 +0000
|
||||
@@ -0,0 +1,75 @@
|
||||
+/* BFD back-end for AArch64 PE IMAGE COFF files.
|
||||
+ Copyright (C) 2021 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This file is part of BFD, the Binary File Descriptor library.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program; if not, write to the Free Software
|
||||
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
||||
+ MA 02110-1301, USA. */
|
||||
+
|
||||
+#include "sysdep.h"
|
||||
+#include "bfd.h"
|
||||
+
|
||||
+#define TARGET_SYM aarch64_pei_vec
|
||||
+#define TARGET_NAME "pei-aarch64-little"
|
||||
+#define TARGET_ARCHITECTURE bfd_arch_aarch64
|
||||
+#define TARGET_PAGESIZE 4096
|
||||
+#define TARGET_BIG_ENDIAN 0
|
||||
+#define TARGET_ARCHIVE 0
|
||||
+#define TARGET_PRIORITY 0
|
||||
+
|
||||
+#define COFF_IMAGE_WITH_PE
|
||||
+/* Rename the above into.. */
|
||||
+#define COFF_WITH_peAArch64
|
||||
+#define COFF_WITH_PE
|
||||
+#define PCRELOFFSET true
|
||||
+
|
||||
+/* Long section names not allowed in executable images, only object files. */
|
||||
+#define COFF_LONG_SECTION_NAMES 0
|
||||
+
|
||||
+#define COFF_SECTION_ALIGNMENT_ENTRIES \
|
||||
+{ COFF_SECTION_NAME_EXACT_MATCH (".bss"), \
|
||||
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
|
||||
+{ COFF_SECTION_NAME_EXACT_MATCH (".data"), \
|
||||
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
|
||||
+{ COFF_SECTION_NAME_EXACT_MATCH (".rdata"), \
|
||||
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
|
||||
+{ COFF_SECTION_NAME_EXACT_MATCH (".text"), \
|
||||
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
|
||||
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".idata"), \
|
||||
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
|
||||
+{ COFF_SECTION_NAME_EXACT_MATCH (".pdata"), \
|
||||
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
|
||||
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".debug"), \
|
||||
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }, \
|
||||
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi."), \
|
||||
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }
|
||||
+
|
||||
+#define PEI_HEADERS
|
||||
+#include "sysdep.h"
|
||||
+#include "bfd.h"
|
||||
+#include "libbfd.h"
|
||||
+#include "coff/aarch64.h"
|
||||
+#include "coff/internal.h"
|
||||
+#include "coff/pe.h"
|
||||
+#include "libcoff.h"
|
||||
+#include "libpei.h"
|
||||
+#include "libiberty.h"
|
||||
+
|
||||
+/* Make sure we're setting a 64-bit format. */
|
||||
+#undef AOUTSZ
|
||||
+#define AOUTSZ PEPAOUTSZ
|
||||
+#define PEAOUTHDR PEPAOUTHDR
|
||||
+
|
||||
+#include "coff-aarch64.c"
|
|
@ -1,62 +0,0 @@
|
|||
--- binutils.orig/bfd/dwarf2.c 2019-11-13 11:49:52.211121564 +0000
|
||||
+++ binutils-2.33.1/bfd/dwarf2.c 2019-11-13 11:53:26.991423055 +0000
|
||||
@@ -2813,8 +2813,8 @@ static bfd_boolean comp_unit_maybe_decod
|
||||
|
||||
static bfd_boolean
|
||||
find_abstract_instance (struct comp_unit * unit,
|
||||
- bfd_byte * orig_info_ptr,
|
||||
struct attribute * attr_ptr,
|
||||
+ unsigned int recur_count,
|
||||
const char ** pname,
|
||||
bfd_boolean * is_linkage,
|
||||
char ** filename_ptr,
|
||||
@@ -2829,6 +2829,14 @@ find_abstract_instance (struct comp_unit
|
||||
struct attribute attr;
|
||||
const char *name = NULL;
|
||||
|
||||
+ if (recur_count == 100)
|
||||
+ {
|
||||
+ _bfd_error_handler
|
||||
+ (_("DWARF error: abstract instance recursion detected"));
|
||||
+ bfd_set_error (bfd_error_bad_value);
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
/* DW_FORM_ref_addr can reference an entry in a different CU. It
|
||||
is an offset from the .debug_info section, not the current CU. */
|
||||
if (attr_ptr->form == DW_FORM_ref_addr)
|
||||
@@ -2962,15 +2970,7 @@ find_abstract_instance (struct comp_unit
|
||||
info_ptr, info_ptr_end);
|
||||
if (info_ptr == NULL)
|
||||
break;
|
||||
- /* It doesn't ever make sense for DW_AT_specification to
|
||||
- refer to the same DIE. Stop simple recursion. */
|
||||
- if (info_ptr == orig_info_ptr)
|
||||
- {
|
||||
- _bfd_error_handler
|
||||
- (_("DWARF error: abstract instance recursion detected"));
|
||||
- bfd_set_error (bfd_error_bad_value);
|
||||
- return FALSE;
|
||||
- }
|
||||
+
|
||||
switch (attr.name)
|
||||
{
|
||||
case DW_AT_name:
|
||||
@@ -2984,7 +2984,7 @@ find_abstract_instance (struct comp_unit
|
||||
}
|
||||
break;
|
||||
case DW_AT_specification:
|
||||
- if (!find_abstract_instance (unit, info_ptr, &attr,
|
||||
+ if (!find_abstract_instance (unit, &attr, recur_count + 1,
|
||||
&name, is_linkage,
|
||||
filename_ptr, linenumber_ptr))
|
||||
return FALSE;
|
||||
@@ -3200,7 +3200,7 @@ scan_unit_for_symbols (struct comp_unit
|
||||
|
||||
case DW_AT_abstract_origin:
|
||||
case DW_AT_specification:
|
||||
- if (!find_abstract_instance (unit, info_ptr, &attr,
|
||||
+ if (!find_abstract_instance (unit, &attr, 0,
|
||||
&func->name,
|
||||
&func->is_linkage,
|
||||
&func->file,
|
|
@ -1,20 +0,0 @@
|
|||
--- binutils.orig/bfd/dwarf2.c 2019-11-13 11:32:09.395430104 +0000
|
||||
+++ binutils-2.33.1/bfd/dwarf2.c 2019-11-13 11:33:17.272899503 +0000
|
||||
@@ -4440,7 +4440,16 @@ _bfd_dwarf2_slurp_debug_info (bfd *abfd,
|
||||
for (total_size = 0;
|
||||
msec;
|
||||
msec = find_debug_info (debug_bfd, debug_sections, msec))
|
||||
- total_size += msec->size;
|
||||
+ {
|
||||
+ /* Catch PR25070 testcase overflowing size calculation here. */
|
||||
+ if (total_size + msec->size < total_size
|
||||
+ || total_size + msec->size < msec->size)
|
||||
+ {
|
||||
+ bfd_set_error (bfd_error_no_memory);
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+ total_size += msec->size;
|
||||
+ }
|
||||
|
||||
stash->info_ptr_memory = (bfd_byte *) bfd_malloc (total_size);
|
||||
if (stash->info_ptr_memory == NULL)
|
|
@ -0,0 +1,230 @@
|
|||
--- binutils.orig/binutils/stabs.c 2021-12-20 12:51:40.953113439 +0000
|
||||
+++ binutils-2.37/binutils/stabs.c 2021-12-20 12:56:07.607348945 +0000
|
||||
@@ -202,7 +202,7 @@ static debug_type stab_find_type (void *
|
||||
static bool stab_record_type
|
||||
(void *, struct stab_handle *, const int *, debug_type);
|
||||
static debug_type stab_xcoff_builtin_type
|
||||
- (void *, struct stab_handle *, int);
|
||||
+ (void *, struct stab_handle *, unsigned int);
|
||||
static debug_type stab_find_tagged_type
|
||||
(void *, struct stab_handle *, const char *, int, enum debug_type_kind);
|
||||
static debug_type *stab_demangle_argtypes
|
||||
@@ -3496,166 +3496,167 @@ stab_record_type (void *dhandle ATTRIBUT
|
||||
|
||||
static debug_type
|
||||
stab_xcoff_builtin_type (void *dhandle, struct stab_handle *info,
|
||||
- int typenum)
|
||||
+ unsigned int typenum)
|
||||
{
|
||||
debug_type rettype;
|
||||
const char *name;
|
||||
|
||||
- if (typenum >= 0 || typenum < -XCOFF_TYPE_COUNT)
|
||||
+ typenum = -typenum - 1;
|
||||
+ if (typenum >= XCOFF_TYPE_COUNT)
|
||||
{
|
||||
- fprintf (stderr, _("Unrecognized XCOFF type %d\n"), typenum);
|
||||
+ fprintf (stderr, _("Unrecognized XCOFF type %d\n"), -typenum - 1);
|
||||
return DEBUG_TYPE_NULL;
|
||||
}
|
||||
- if (info->xcoff_types[-typenum] != NULL)
|
||||
- return info->xcoff_types[-typenum];
|
||||
+ if (info->xcoff_types[typenum] != NULL)
|
||||
+ return info->xcoff_types[typenum];
|
||||
|
||||
- switch (-typenum)
|
||||
+ switch (typenum)
|
||||
{
|
||||
- case 1:
|
||||
+ case 0:
|
||||
/* The size of this and all the other types are fixed, defined
|
||||
by the debugging format. */
|
||||
name = "int";
|
||||
rettype = debug_make_int_type (dhandle, 4, false);
|
||||
break;
|
||||
- case 2:
|
||||
+ case 1:
|
||||
name = "char";
|
||||
rettype = debug_make_int_type (dhandle, 1, false);
|
||||
break;
|
||||
- case 3:
|
||||
+ case 2:
|
||||
name = "short";
|
||||
rettype = debug_make_int_type (dhandle, 2, false);
|
||||
break;
|
||||
- case 4:
|
||||
+ case 3:
|
||||
name = "long";
|
||||
rettype = debug_make_int_type (dhandle, 4, false);
|
||||
break;
|
||||
- case 5:
|
||||
+ case 4:
|
||||
name = "unsigned char";
|
||||
rettype = debug_make_int_type (dhandle, 1, true);
|
||||
break;
|
||||
- case 6:
|
||||
+ case 5:
|
||||
name = "signed char";
|
||||
rettype = debug_make_int_type (dhandle, 1, false);
|
||||
break;
|
||||
- case 7:
|
||||
+ case 6:
|
||||
name = "unsigned short";
|
||||
rettype = debug_make_int_type (dhandle, 2, true);
|
||||
break;
|
||||
- case 8:
|
||||
+ case 7:
|
||||
name = "unsigned int";
|
||||
rettype = debug_make_int_type (dhandle, 4, true);
|
||||
break;
|
||||
- case 9:
|
||||
+ case 8:
|
||||
name = "unsigned";
|
||||
rettype = debug_make_int_type (dhandle, 4, true);
|
||||
break;
|
||||
- case 10:
|
||||
+ case 9:
|
||||
name = "unsigned long";
|
||||
rettype = debug_make_int_type (dhandle, 4, true);
|
||||
break;
|
||||
- case 11:
|
||||
+ case 10:
|
||||
name = "void";
|
||||
rettype = debug_make_void_type (dhandle);
|
||||
break;
|
||||
- case 12:
|
||||
+ case 11:
|
||||
/* IEEE single precision (32 bit). */
|
||||
name = "float";
|
||||
rettype = debug_make_float_type (dhandle, 4);
|
||||
break;
|
||||
- case 13:
|
||||
+ case 12:
|
||||
/* IEEE double precision (64 bit). */
|
||||
name = "double";
|
||||
rettype = debug_make_float_type (dhandle, 8);
|
||||
break;
|
||||
- case 14:
|
||||
+ case 13:
|
||||
/* This is an IEEE double on the RS/6000, and different machines
|
||||
with different sizes for "long double" should use different
|
||||
negative type numbers. See stabs.texinfo. */
|
||||
name = "long double";
|
||||
rettype = debug_make_float_type (dhandle, 8);
|
||||
break;
|
||||
- case 15:
|
||||
+ case 14:
|
||||
name = "integer";
|
||||
rettype = debug_make_int_type (dhandle, 4, false);
|
||||
break;
|
||||
- case 16:
|
||||
+ case 15:
|
||||
name = "boolean";
|
||||
rettype = debug_make_bool_type (dhandle, 4);
|
||||
break;
|
||||
- case 17:
|
||||
+ case 16:
|
||||
name = "short real";
|
||||
rettype = debug_make_float_type (dhandle, 4);
|
||||
break;
|
||||
- case 18:
|
||||
+ case 17:
|
||||
name = "real";
|
||||
rettype = debug_make_float_type (dhandle, 8);
|
||||
break;
|
||||
- case 19:
|
||||
+ case 18:
|
||||
/* FIXME */
|
||||
name = "stringptr";
|
||||
rettype = NULL;
|
||||
break;
|
||||
- case 20:
|
||||
+ case 19:
|
||||
/* FIXME */
|
||||
name = "character";
|
||||
rettype = debug_make_int_type (dhandle, 1, true);
|
||||
break;
|
||||
- case 21:
|
||||
+ case 20:
|
||||
name = "logical*1";
|
||||
rettype = debug_make_bool_type (dhandle, 1);
|
||||
break;
|
||||
- case 22:
|
||||
+ case 21:
|
||||
name = "logical*2";
|
||||
rettype = debug_make_bool_type (dhandle, 2);
|
||||
break;
|
||||
- case 23:
|
||||
+ case 22:
|
||||
name = "logical*4";
|
||||
rettype = debug_make_bool_type (dhandle, 4);
|
||||
break;
|
||||
- case 24:
|
||||
+ case 23:
|
||||
name = "logical";
|
||||
rettype = debug_make_bool_type (dhandle, 4);
|
||||
break;
|
||||
- case 25:
|
||||
+ case 24:
|
||||
/* Complex type consisting of two IEEE single precision values. */
|
||||
name = "complex";
|
||||
rettype = debug_make_complex_type (dhandle, 8);
|
||||
break;
|
||||
- case 26:
|
||||
+ case 25:
|
||||
/* Complex type consisting of two IEEE double precision values. */
|
||||
name = "double complex";
|
||||
rettype = debug_make_complex_type (dhandle, 16);
|
||||
break;
|
||||
- case 27:
|
||||
+ case 26:
|
||||
name = "integer*1";
|
||||
rettype = debug_make_int_type (dhandle, 1, false);
|
||||
break;
|
||||
- case 28:
|
||||
+ case 27:
|
||||
name = "integer*2";
|
||||
rettype = debug_make_int_type (dhandle, 2, false);
|
||||
break;
|
||||
- case 29:
|
||||
+ case 28:
|
||||
name = "integer*4";
|
||||
rettype = debug_make_int_type (dhandle, 4, false);
|
||||
break;
|
||||
- case 30:
|
||||
+ case 29:
|
||||
/* FIXME */
|
||||
name = "wchar";
|
||||
rettype = debug_make_int_type (dhandle, 2, false);
|
||||
break;
|
||||
- case 31:
|
||||
+ case 30:
|
||||
name = "long long";
|
||||
rettype = debug_make_int_type (dhandle, 8, false);
|
||||
break;
|
||||
- case 32:
|
||||
+ case 31:
|
||||
name = "unsigned long long";
|
||||
rettype = debug_make_int_type (dhandle, 8, true);
|
||||
break;
|
||||
- case 33:
|
||||
+ case 32:
|
||||
name = "logical*8";
|
||||
rettype = debug_make_bool_type (dhandle, 8);
|
||||
break;
|
||||
- case 34:
|
||||
+ case 33:
|
||||
name = "integer*8";
|
||||
rettype = debug_make_int_type (dhandle, 8, false);
|
||||
break;
|
||||
@@ -3664,9 +3665,7 @@ stab_xcoff_builtin_type (void *dhandle,
|
||||
}
|
||||
|
||||
rettype = debug_name_type (dhandle, name, rettype);
|
||||
-
|
||||
- info->xcoff_types[-typenum] = rettype;
|
||||
-
|
||||
+ info->xcoff_types[typenum] = rettype;
|
||||
return rettype;
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
--- binutils.orig/binutils/dwarf.c 2022-08-31 11:58:08.918685348 +0100
|
||||
+++ binutils-2.39/binutils/dwarf.c 2022-08-31 15:24:13.881865797 +0100
|
||||
@@ -6365,7 +6365,11 @@ display_debug_abbrev (struct dwarf_secti
|
||||
list->start_of_next_abbrevs = start;
|
||||
}
|
||||
else
|
||||
- start = list->start_of_next_abbrevs;
|
||||
+ {
|
||||
+ if (start == list->start_of_next_abbrevs)
|
||||
+ break;
|
||||
+ start = list->start_of_next_abbrevs;
|
||||
+ }
|
||||
|
||||
if (list->first_abbrev == NULL)
|
||||
continue;
|
|
@ -0,0 +1,124 @@
|
|||
diff -rup binutils.orig/bfd/dwarf2.c binutils-2.37/bfd/dwarf2.c
|
||||
--- binutils.orig/bfd/dwarf2.c 2022-08-25 17:21:09.023295361 +0200
|
||||
+++ binutils-2.37/bfd/dwarf2.c 2022-09-05 14:26:02.396271516 +0200
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "elf-bfd.h"
|
||||
#include "dwarf2.h"
|
||||
#include "hashtab.h"
|
||||
+#include "splay-tree.h"
|
||||
|
||||
/* The data in the .debug_line statement prologue looks like this. */
|
||||
|
||||
@@ -82,6 +83,45 @@ struct adjusted_section
|
||||
bfd_vma adj_vma;
|
||||
};
|
||||
|
||||
+struct addr_range
|
||||
+{
|
||||
+ bfd_byte *start;
|
||||
+ bfd_byte *end;
|
||||
+};
|
||||
+
|
||||
+/* Return true if address range do intersect. */
|
||||
+
|
||||
+static bool
|
||||
+addr_range_intersects (struct addr_range *r1, struct addr_range *r2)
|
||||
+{
|
||||
+ return (r1->start <= r2->start && r2->start < r1->end)
|
||||
+ || (r1->start <= (r2->end - 1) && (r2->end - 1) < r1->end);
|
||||
+}
|
||||
+
|
||||
+/* Compare function for splay tree of addr_ranges. */
|
||||
+
|
||||
+static int
|
||||
+splay_tree_compare_addr_range (splay_tree_key xa, splay_tree_key xb)
|
||||
+{
|
||||
+ struct addr_range *r1 = (struct addr_range *) xa;
|
||||
+ struct addr_range *r2 = (struct addr_range *) xb;
|
||||
+
|
||||
+ if (addr_range_intersects (r1, r2) || addr_range_intersects (r2, r1))
|
||||
+ return 0;
|
||||
+ else if (r1->end <= r2->start)
|
||||
+ return -1;
|
||||
+ else
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+/* Splay tree release function for keys (addr_range). */
|
||||
+
|
||||
+static void
|
||||
+splay_tree_free_addr_range (splay_tree_key key)
|
||||
+{
|
||||
+ free ((struct addr_range *)key);
|
||||
+}
|
||||
+
|
||||
struct dwarf2_debug_file
|
||||
{
|
||||
/* The actual bfd from which debug info was loaded. Might be
|
||||
@@ -147,6 +187,9 @@ struct dwarf2_debug_file
|
||||
|
||||
/* Hash table to map offsets to decoded abbrevs. */
|
||||
htab_t abbrev_offsets;
|
||||
+
|
||||
+ /* Splay tree to map info_ptr address to compilation units. */
|
||||
+ splay_tree comp_unit_tree;
|
||||
};
|
||||
|
||||
struct dwarf2_debug
|
||||
@@ -2948,16 +2991,12 @@ find_abstract_instance (struct comp_unit
|
||||
else
|
||||
{
|
||||
/* Check other CUs to see if they contain the abbrev. */
|
||||
- struct comp_unit *u;
|
||||
-
|
||||
- for (u = unit->prev_unit; u != NULL; u = u->prev_unit)
|
||||
- if (info_ptr >= u->info_ptr_unit && info_ptr < u->end_ptr)
|
||||
- break;
|
||||
-
|
||||
- if (u == NULL)
|
||||
- for (u = unit->next_unit; u != NULL; u = u->next_unit)
|
||||
- if (info_ptr >= u->info_ptr_unit && info_ptr < u->end_ptr)
|
||||
- break;
|
||||
+ struct comp_unit *u = NULL;
|
||||
+ struct addr_range range = { info_ptr, info_ptr };
|
||||
+ splay_tree_node v = splay_tree_lookup (unit->file->comp_unit_tree,
|
||||
+ (splay_tree_key)&range);
|
||||
+ if (v != NULL)
|
||||
+ u = (struct comp_unit *)v->value;
|
||||
|
||||
if (attr_ptr->form == DW_FORM_ref_addr)
|
||||
while (u == NULL)
|
||||
@@ -4837,6 +4876,22 @@ stash_comp_unit (struct dwarf2_debug *st
|
||||
info_ptr_unit, offset_size);
|
||||
if (each)
|
||||
{
|
||||
+ if (file->comp_unit_tree == NULL)
|
||||
+ file->comp_unit_tree
|
||||
+ = splay_tree_new (splay_tree_compare_addr_range,
|
||||
+ splay_tree_free_addr_range, NULL);
|
||||
+
|
||||
+ struct addr_range *r
|
||||
+ = (struct addr_range *)bfd_malloc (sizeof (struct addr_range));
|
||||
+ r->start = each->info_ptr_unit;
|
||||
+ r->end = each->end_ptr;
|
||||
+ splay_tree_node v = splay_tree_lookup (file->comp_unit_tree,
|
||||
+ (splay_tree_key)r);
|
||||
+ if (v != NULL || r->end <= r->start)
|
||||
+ abort ();
|
||||
+ splay_tree_insert (file->comp_unit_tree, (splay_tree_key)r,
|
||||
+ (splay_tree_value)each);
|
||||
+
|
||||
if (file->all_comp_units)
|
||||
file->all_comp_units->prev_unit = each;
|
||||
else
|
||||
@@ -5288,6 +5343,8 @@ _bfd_dwarf2_cleanup_debug_info (bfd *abf
|
||||
free (file->line_table->dirs);
|
||||
}
|
||||
htab_delete (file->abbrev_offsets);
|
||||
+ if (file->comp_unit_tree != NULL)
|
||||
+ splay_tree_delete (file->comp_unit_tree);
|
||||
|
||||
free (file->dwarf_line_str_buffer);
|
||||
free (file->dwarf_str_buffer);
|
||||
Only in binutils-2.37/bfd: dwarf2.c.orig
|
||||
Only in binutils-2.37/bfd: dwarf2.c.rej
|
|
@ -1,447 +0,0 @@
|
|||
diff -rup binutils.orig/bfd/bfd.c binutils-2.31.1/bfd/bfd.c
|
||||
--- binutils.orig/bfd/bfd.c 2019-02-18 11:53:32.155652114 +0000
|
||||
+++ binutils-2.31.1/bfd/bfd.c 2019-02-18 12:03:21.591459682 +0000
|
||||
@@ -2332,6 +2332,8 @@ bfd_update_compression_header (bfd *abfd
|
||||
bfd_put_32 (abfd, sec->size, &echdr->ch_size);
|
||||
bfd_put_32 (abfd, 1 << sec->alignment_power,
|
||||
&echdr->ch_addralign);
|
||||
+ /* bfd_log2 (alignof (Elf32_Chdr)). */
|
||||
+ bfd_set_section_alignment (abfd, sec, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2342,6 +2344,8 @@ bfd_update_compression_header (bfd *abfd
|
||||
bfd_put_64 (abfd, sec->size, &echdr->ch_size);
|
||||
bfd_put_64 (abfd, 1 << sec->alignment_power,
|
||||
&echdr->ch_addralign);
|
||||
+ /* bfd_log2 (alignof (Elf64_Chdr)). */
|
||||
+ bfd_set_section_alignment (abfd, sec, 3);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2354,6 +2358,8 @@ bfd_update_compression_header (bfd *abfd
|
||||
order. */
|
||||
memcpy (contents, "ZLIB", 4);
|
||||
bfd_putb64 (sec->size, contents + 4);
|
||||
+ /* No way to keep the original alignment, just use 1 always. */
|
||||
+ bfd_set_section_alignment (abfd, sec, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2368,12 +2374,15 @@ bfd_update_compression_header (bfd *abfd
|
||||
SYNOPSIS
|
||||
bfd_boolean bfd_check_compression_header
|
||||
(bfd *abfd, bfd_byte *contents, asection *sec,
|
||||
- bfd_size_type *uncompressed_size);
|
||||
+ bfd_size_type *uncompressed_size,
|
||||
+ unsigned int *uncompressed_alignment_power);
|
||||
+
|
||||
|
||||
DESCRIPTION
|
||||
Check the compression header at CONTENTS of SEC in ABFD and
|
||||
- store the uncompressed size in UNCOMPRESSED_SIZE if the
|
||||
- compression header is valid.
|
||||
+ store the uncompressed size in UNCOMPRESSED_SIZE and the
|
||||
+ uncompressed data alignment in UNCOMPRESSED_ALIGNMENT_POWER
|
||||
+ if the compression header is valid.
|
||||
|
||||
RETURNS
|
||||
Return TRUE if the compression header is valid.
|
||||
@@ -2382,7 +2391,8 @@ RETURNS
|
||||
bfd_boolean
|
||||
bfd_check_compression_header (bfd *abfd, bfd_byte *contents,
|
||||
asection *sec,
|
||||
- bfd_size_type *uncompressed_size)
|
||||
+ bfd_size_type *uncompressed_size,
|
||||
+ unsigned int *uncompressed_alignment_power)
|
||||
{
|
||||
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
|
||||
&& (elf_section_flags (sec) & SHF_COMPRESSED) != 0)
|
||||
@@ -2404,9 +2414,10 @@ bfd_check_compression_header (bfd *abfd,
|
||||
chdr.ch_addralign = bfd_get_64 (abfd, &echdr->ch_addralign);
|
||||
}
|
||||
if (chdr.ch_type == ELFCOMPRESS_ZLIB
|
||||
- && chdr.ch_addralign == 1U << sec->alignment_power)
|
||||
+ && chdr.ch_addralign == (1U << bfd_log2 (chdr.ch_addralign)))
|
||||
{
|
||||
*uncompressed_size = chdr.ch_size;
|
||||
+ *uncompressed_alignment_power = bfd_log2 (chdr.ch_addralign);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
diff -rup binutils.orig/bfd/bfd-in2.h binutils-2.31.1/bfd/bfd-in2.h
|
||||
--- binutils.orig/bfd/bfd-in2.h 2019-02-18 11:53:32.156652107 +0000
|
||||
+++ binutils-2.31.1/bfd/bfd-in2.h 2019-02-18 12:00:23.849723903 +0000
|
||||
@@ -7274,7 +7274,8 @@ void bfd_update_compression_header
|
||||
|
||||
bfd_boolean bfd_check_compression_header
|
||||
(bfd *abfd, bfd_byte *contents, asection *sec,
|
||||
- bfd_size_type *uncompressed_size);
|
||||
+ bfd_size_type *uncompressed_size,
|
||||
+ unsigned int *uncompressed_alignment_power);
|
||||
|
||||
int bfd_get_compression_header_size (bfd *abfd, asection *sec);
|
||||
|
||||
@@ -7850,7 +7851,8 @@ void bfd_cache_section_contents
|
||||
bfd_boolean bfd_is_section_compressed_with_header
|
||||
(bfd *abfd, asection *section,
|
||||
int *compression_header_size_p,
|
||||
- bfd_size_type *uncompressed_size_p);
|
||||
+ bfd_size_type *uncompressed_size_p,
|
||||
+ unsigned int *uncompressed_alignment_power_p);
|
||||
|
||||
bfd_boolean bfd_is_section_compressed
|
||||
(bfd *abfd, asection *section);
|
||||
diff -rup binutils.orig/bfd/compress.c binutils-2.31.1/bfd/compress.c
|
||||
--- binutils.orig/bfd/compress.c 2019-02-18 11:53:32.153652128 +0000
|
||||
+++ binutils-2.31.1/bfd/compress.c 2019-02-18 12:11:44.899886376 +0000
|
||||
@@ -84,11 +84,13 @@ bfd_compress_section_contents (bfd *abfd
|
||||
int zlib_size = 0;
|
||||
int orig_compression_header_size;
|
||||
bfd_size_type orig_uncompressed_size;
|
||||
+ unsigned int orig_uncompressed_alignment_pow;
|
||||
int header_size = bfd_get_compression_header_size (abfd, NULL);
|
||||
bfd_boolean compressed
|
||||
= bfd_is_section_compressed_with_header (abfd, sec,
|
||||
&orig_compression_header_size,
|
||||
- &orig_uncompressed_size);
|
||||
+ &orig_uncompressed_size,
|
||||
+ &orig_uncompressed_alignment_pow);
|
||||
|
||||
/* Either ELF compression header or the 12-byte, "ZLIB" + 8-byte size,
|
||||
overhead in .zdebug* section. */
|
||||
@@ -153,6 +155,8 @@ bfd_compress_section_contents (bfd *abfd
|
||||
return 0;
|
||||
}
|
||||
free (uncompressed_buffer);
|
||||
+ bfd_set_section_alignment (abfd, sec,
|
||||
+ orig_uncompressed_alignment_pow);
|
||||
sec->contents = buffer;
|
||||
sec->compress_status = COMPRESS_SECTION_DONE;
|
||||
return orig_uncompressed_size;
|
||||
@@ -364,20 +368,25 @@ SYNOPSIS
|
||||
bfd_boolean bfd_is_section_compressed_with_header
|
||||
(bfd *abfd, asection *section,
|
||||
int *compression_header_size_p,
|
||||
- bfd_size_type *uncompressed_size_p);
|
||||
+ bfd_size_type *uncompressed_size_p,
|
||||
+ unsigned int *uncompressed_alignment_power_p);
|
||||
+
|
||||
|
||||
DESCRIPTION
|
||||
Return @code{TRUE} if @var{section} is compressed. Compression
|
||||
- header size is returned in @var{compression_header_size_p} and
|
||||
- uncompressed size is returned in @var{uncompressed_size_p}. If
|
||||
- compression is unsupported, compression header size is returned
|
||||
- with -1 and uncompressed size is returned with 0.
|
||||
+ header size is returned in @var{compression_header_size_p},
|
||||
+ uncompressed size is returned in @var{uncompressed_size_p}
|
||||
+ and the uncompressed data alignement power is returned in
|
||||
+ @var{uncompressed_align_pow_p}. If compression is
|
||||
+ unsupported, compression header size is returned with -1
|
||||
+ and uncompressed size is returned with 0.
|
||||
*/
|
||||
|
||||
bfd_boolean
|
||||
bfd_is_section_compressed_with_header (bfd *abfd, sec_ptr sec,
|
||||
int *compression_header_size_p,
|
||||
- bfd_size_type *uncompressed_size_p)
|
||||
+ bfd_size_type *uncompressed_size_p,
|
||||
+ unsigned int *uncompressed_align_pow_p)
|
||||
{
|
||||
bfd_byte header[MAX_COMPRESSION_HEADER_SIZE];
|
||||
int compression_header_size;
|
||||
@@ -385,6 +394,8 @@ bfd_is_section_compressed_with_header (b
|
||||
unsigned int saved = sec->compress_status;
|
||||
bfd_boolean compressed;
|
||||
|
||||
+ *uncompressed_align_pow_p = 0;
|
||||
+
|
||||
compression_header_size = bfd_get_compression_header_size (abfd, sec);
|
||||
if (compression_header_size > MAX_COMPRESSION_HEADER_SIZE)
|
||||
abort ();
|
||||
@@ -412,7 +423,8 @@ bfd_is_section_compressed_with_header (b
|
||||
if (compression_header_size != 0)
|
||||
{
|
||||
if (!bfd_check_compression_header (abfd, header, sec,
|
||||
- uncompressed_size_p))
|
||||
+ uncompressed_size_p,
|
||||
+ uncompressed_align_pow_p))
|
||||
compression_header_size = -1;
|
||||
}
|
||||
/* Check for the pathalogical case of a debug string section that
|
||||
@@ -449,9 +461,11 @@ bfd_is_section_compressed (bfd *abfd, se
|
||||
{
|
||||
int compression_header_size;
|
||||
bfd_size_type uncompressed_size;
|
||||
+ unsigned int uncompressed_align_power;
|
||||
return (bfd_is_section_compressed_with_header (abfd, sec,
|
||||
&compression_header_size,
|
||||
- &uncompressed_size)
|
||||
+ &uncompressed_size,
|
||||
+ &uncompressed_align_power)
|
||||
&& compression_header_size >= 0
|
||||
&& uncompressed_size > 0);
|
||||
}
|
||||
@@ -480,6 +494,7 @@ bfd_init_section_decompress_status (bfd
|
||||
int compression_header_size;
|
||||
int header_size;
|
||||
bfd_size_type uncompressed_size;
|
||||
+ unsigned int uncompressed_alignment_power = 0;
|
||||
|
||||
compression_header_size = bfd_get_compression_header_size (abfd, sec);
|
||||
if (compression_header_size > MAX_COMPRESSION_HEADER_SIZE)
|
||||
@@ -508,7 +523,8 @@ bfd_init_section_decompress_status (bfd
|
||||
uncompressed_size = bfd_getb64 (header + 4);
|
||||
}
|
||||
else if (!bfd_check_compression_header (abfd, header, sec,
|
||||
- &uncompressed_size))
|
||||
+ &uncompressed_size,
|
||||
+ &uncompressed_alignment_power))
|
||||
{
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return FALSE;
|
||||
@@ -516,6 +532,7 @@ bfd_init_section_decompress_status (bfd
|
||||
|
||||
sec->compressed_size = sec->size;
|
||||
sec->size = uncompressed_size;
|
||||
+ bfd_set_section_alignment (abfd, sec, uncompressed_alignment_power);
|
||||
sec->compress_status = DECOMPRESS_SECTION_SIZED;
|
||||
|
||||
return TRUE;
|
||||
diff -rup binutils.orig/bfd/elf.c binutils-2.31.1/bfd/elf.c
|
||||
--- binutils.orig/bfd/elf.c 2019-02-18 11:53:32.161652071 +0000
|
||||
+++ binutils-2.31.1/bfd/elf.c 2019-02-18 12:08:52.135108638 +0000
|
||||
@@ -1177,10 +1177,12 @@ _bfd_elf_make_section_from_shdr (bfd *ab
|
||||
enum { nothing, compress, decompress } action = nothing;
|
||||
int compression_header_size;
|
||||
bfd_size_type uncompressed_size;
|
||||
+ unsigned int uncompressed_align_power;
|
||||
bfd_boolean compressed
|
||||
= bfd_is_section_compressed_with_header (abfd, newsect,
|
||||
&compression_header_size,
|
||||
- &uncompressed_size);
|
||||
+ &uncompressed_size,
|
||||
+ &uncompressed_align_power);
|
||||
|
||||
if (compressed)
|
||||
{
|
||||
diff -rup binutils.orig/binutils/readelf.c binutils-2.31.1/binutils/readelf.c
|
||||
--- binutils.orig/binutils/readelf.c 2019-02-18 11:53:32.947646480 +0000
|
||||
+++ binutils-2.31.1/binutils/readelf.c 2019-02-18 12:10:13.142535034 +0000
|
||||
@@ -13366,12 +13366,6 @@ dump_section_as_strings (Elf_Internal_Sh
|
||||
printable_section_name (filedata, section), chdr.ch_type);
|
||||
return FALSE;
|
||||
}
|
||||
- else if (chdr.ch_addralign != section->sh_addralign)
|
||||
- {
|
||||
- warn (_("compressed section '%s' is corrupted\n"),
|
||||
- printable_section_name (filedata, section));
|
||||
- return FALSE;
|
||||
- }
|
||||
uncompressed_size = chdr.ch_size;
|
||||
start += compression_header_size;
|
||||
new_size -= compression_header_size;
|
||||
@@ -13513,12 +13507,6 @@ dump_section_as_bytes (Elf_Internal_Shdr
|
||||
printable_section_name (filedata, section), chdr.ch_type);
|
||||
return FALSE;
|
||||
}
|
||||
- else if (chdr.ch_addralign != section->sh_addralign)
|
||||
- {
|
||||
- warn (_("compressed section '%s' is corrupted\n"),
|
||||
- printable_section_name (filedata, section));
|
||||
- return FALSE;
|
||||
- }
|
||||
uncompressed_size = chdr.ch_size;
|
||||
start += compression_header_size;
|
||||
new_size -= compression_header_size;
|
||||
@@ -13688,12 +13676,6 @@ load_specific_debug_section (enum dwarf_
|
||||
section->name, chdr.ch_type);
|
||||
return FALSE;
|
||||
}
|
||||
- else if (chdr.ch_addralign != sec->sh_addralign)
|
||||
- {
|
||||
- warn (_("compressed section '%s' is corrupted\n"),
|
||||
- section->name);
|
||||
- return FALSE;
|
||||
- }
|
||||
uncompressed_size = chdr.ch_size;
|
||||
start += compression_header_size;
|
||||
size -= compression_header_size;
|
||||
diff -rup binutils.orig/binutils/testsuite/binutils-all/dw2-3.rS binutils-2.31.1/binutils/testsuite/binutils-all/dw2-3.rS
|
||||
--- binutils.orig/binutils/testsuite/binutils-all/dw2-3.rS 2019-02-18 11:53:32.908646758 +0000
|
||||
+++ binutils-2.31.1/binutils/testsuite/binutils-all/dw2-3.rS 2019-02-18 12:10:40.884338917 +0000
|
||||
@@ -1,3 +1,3 @@
|
||||
#...
|
||||
- +\[[ 0-9]+\] .debug_info +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ [0-9a-f]+ +C +0 +0 +1
|
||||
+ +\[[ 0-9]+\] .debug_info +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ [0-9a-f]+ +C +0 +0 +(4|8)
|
||||
#pass
|
||||
diff -rup binutils.orig/binutils/testsuite/binutils-all/dw2-3.rt binutils-2.31.1/binutils/testsuite/binutils-all/dw2-3.rt
|
||||
--- binutils.orig/binutils/testsuite/binutils-all/dw2-3.rt 2019-02-18 11:53:32.905646779 +0000
|
||||
+++ binutils-2.31.1/binutils/testsuite/binutils-all/dw2-3.rt 2019-02-18 12:11:13.476108521 +0000
|
||||
@@ -1,6 +1,6 @@
|
||||
#...
|
||||
+\[[ 0-9]+\] .debug_info
|
||||
- +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +0 +0 +1
|
||||
+ +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +0 +0 +(4|8)
|
||||
+\[0+800\]: COMPRESSED
|
||||
+ZLIB, 0+9d, 1
|
||||
#pass
|
||||
diff -rup binutils.orig/gold/merge.cc binutils-2.31.1/gold/merge.cc
|
||||
--- binutils.orig/gold/merge.cc 2019-02-18 11:53:32.210651723 +0000
|
||||
+++ binutils-2.31.1/gold/merge.cc 2019-02-18 12:12:59.027362334 +0000
|
||||
@@ -440,9 +440,11 @@ Output_merge_string<Char_type>::do_add_i
|
||||
{
|
||||
section_size_type sec_len;
|
||||
bool is_new;
|
||||
+ uint64_t addralign = this->addralign();
|
||||
const unsigned char* pdata = object->decompressed_section_contents(shndx,
|
||||
&sec_len,
|
||||
- &is_new);
|
||||
+ &is_new,
|
||||
+ &addralign);
|
||||
|
||||
const Char_type* p = reinterpret_cast<const Char_type*>(pdata);
|
||||
const Char_type* pend = p + sec_len / sizeof(Char_type);
|
||||
@@ -494,7 +496,7 @@ Output_merge_string<Char_type>::do_add_i
|
||||
// aligned, so each string within the section must retain the same
|
||||
// modulo.
|
||||
uintptr_t init_align_modulo = (reinterpret_cast<uintptr_t>(pdata)
|
||||
- & (this->addralign() - 1));
|
||||
+ & (addralign - 1));
|
||||
bool has_misaligned_strings = false;
|
||||
|
||||
while (p < pend)
|
||||
@@ -503,7 +505,7 @@ Output_merge_string<Char_type>::do_add_i
|
||||
|
||||
// Within merge input section each string must be aligned.
|
||||
if (len != 0
|
||||
- && ((reinterpret_cast<uintptr_t>(p) & (this->addralign() - 1))
|
||||
+ && ((reinterpret_cast<uintptr_t>(p) & (addralign - 1))
|
||||
!= init_align_modulo))
|
||||
has_misaligned_strings = true;
|
||||
|
||||
diff -rup binutils.orig/gold/object.cc binutils-2.31.1/gold/object.cc
|
||||
--- binutils.orig/gold/object.cc 2019-02-18 11:53:32.208651737 +0000
|
||||
+++ binutils-2.31.1/gold/object.cc 2019-02-18 12:16:35.938828914 +0000
|
||||
@@ -751,11 +751,13 @@ build_compressed_section_map(
|
||||
const unsigned char* contents =
|
||||
obj->section_contents(i, &len, false);
|
||||
uint64_t uncompressed_size;
|
||||
+ Compressed_section_info info;
|
||||
if (is_zcompressed)
|
||||
{
|
||||
// Skip over the ".zdebug" prefix.
|
||||
name += 7;
|
||||
uncompressed_size = get_uncompressed_size(contents, len);
|
||||
+ info.addralign = shdr.get_sh_addralign();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -763,8 +765,8 @@ build_compressed_section_map(
|
||||
name += 6;
|
||||
elfcpp::Chdr<size, big_endian> chdr(contents);
|
||||
uncompressed_size = chdr.get_ch_size();
|
||||
+ info.addralign = chdr.get_ch_addralign();
|
||||
}
|
||||
- Compressed_section_info info;
|
||||
info.size = convert_to_section_size_type(uncompressed_size);
|
||||
info.flag = shdr.get_sh_flags();
|
||||
info.contents = NULL;
|
||||
@@ -3060,7 +3062,8 @@ const unsigned char*
|
||||
Object::decompressed_section_contents(
|
||||
unsigned int shndx,
|
||||
section_size_type* plen,
|
||||
- bool* is_new)
|
||||
+ bool* is_new,
|
||||
+ uint64_t* palign)
|
||||
{
|
||||
section_size_type buffer_size;
|
||||
const unsigned char* buffer = this->do_section_contents(shndx, &buffer_size,
|
||||
@@ -3087,6 +3090,8 @@ Object::decompressed_section_contents(
|
||||
{
|
||||
*plen = uncompressed_size;
|
||||
*is_new = false;
|
||||
+ if (palign != NULL)
|
||||
+ *palign = p->second.addralign;
|
||||
return p->second.contents;
|
||||
}
|
||||
|
||||
@@ -3108,6 +3113,8 @@ Object::decompressed_section_contents(
|
||||
// once in this pass.
|
||||
*plen = uncompressed_size;
|
||||
*is_new = true;
|
||||
+ if (palign != NULL)
|
||||
+ *palign = p->second.addralign;
|
||||
return uncompressed_data;
|
||||
}
|
||||
|
||||
diff -rup binutils.orig/gold/object.h binutils-2.31.1/gold/object.h
|
||||
--- binutils.orig/gold/object.h 2019-02-18 11:53:32.210651723 +0000
|
||||
+++ binutils-2.31.1/gold/object.h 2019-02-18 12:17:50.625300926 +0000
|
||||
@@ -373,6 +373,7 @@ struct Compressed_section_info
|
||||
{
|
||||
section_size_type size;
|
||||
elfcpp::Elf_Xword flag;
|
||||
+ uint64_t addralign;
|
||||
const unsigned char* contents;
|
||||
};
|
||||
typedef std::map<unsigned int, Compressed_section_info> Compressed_section_map;
|
||||
@@ -808,7 +809,8 @@ class Object
|
||||
|
||||
bool
|
||||
section_is_compressed(unsigned int shndx,
|
||||
- section_size_type* uncompressed_size) const
|
||||
+ section_size_type* uncompressed_size,
|
||||
+ elfcpp::Elf_Xword* palign = NULL) const
|
||||
{
|
||||
if (this->compressed_sections_ == NULL)
|
||||
return false;
|
||||
@@ -818,6 +820,8 @@ class Object
|
||||
{
|
||||
if (uncompressed_size != NULL)
|
||||
*uncompressed_size = p->second.size;
|
||||
+ if (palign != NULL)
|
||||
+ *palign = p->second.addralign;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -828,7 +832,7 @@ class Object
|
||||
// by the caller.
|
||||
const unsigned char*
|
||||
decompressed_section_contents(unsigned int shndx, section_size_type* plen,
|
||||
- bool* is_cached);
|
||||
+ bool* is_cached, uint64_t* palign = NULL);
|
||||
|
||||
// Discard any buffers of decompressed sections. This is done
|
||||
// at the end of the Add_symbols task.
|
||||
diff -rup binutils.orig/gold/output.cc binutils-2.31.1/gold/output.cc
|
||||
--- binutils.orig/gold/output.cc 2019-02-18 11:53:32.209651729 +0000
|
||||
+++ binutils-2.31.1/gold/output.cc 2019-02-18 12:18:39.729953797 +0000
|
||||
@@ -2448,7 +2448,14 @@ Output_section::add_input_section(Layout
|
||||
unsigned int reloc_shndx,
|
||||
bool have_sections_script)
|
||||
{
|
||||
+ section_size_type input_section_size = shdr.get_sh_size();
|
||||
+ section_size_type uncompressed_size;
|
||||
elfcpp::Elf_Xword addralign = shdr.get_sh_addralign();
|
||||
+
|
||||
+ if (object->section_is_compressed(shndx, &uncompressed_size,
|
||||
+ &addralign))
|
||||
+ input_section_size = uncompressed_size;
|
||||
+
|
||||
if ((addralign & (addralign - 1)) != 0)
|
||||
{
|
||||
object->error(_("invalid alignment %lu for section \"%s\""),
|
||||
@@ -2498,11 +2505,6 @@ Output_section::add_input_section(Layout
|
||||
}
|
||||
}
|
||||
|
||||
- section_size_type input_section_size = shdr.get_sh_size();
|
||||
- section_size_type uncompressed_size;
|
||||
- if (object->section_is_compressed(shndx, &uncompressed_size))
|
||||
- input_section_size = uncompressed_size;
|
||||
-
|
||||
off_t offset_in_section;
|
||||
|
||||
if (this->has_fixed_layout())
|
|
@ -1,68 +0,0 @@
|
|||
diff -rup binutils.orig/gas/config/obj-elf.c binutils-2.30/gas/config/obj-elf.c
|
||||
--- binutils.orig/gas/config/obj-elf.c 2018-09-24 17:50:06.974172867 +0100
|
||||
+++ binutils-2.30/gas/config/obj-elf.c 2018-09-25 15:19:33.559830794 +0100
|
||||
@@ -82,9 +82,11 @@ static void obj_elf_gnu_attribute (int);
|
||||
static void obj_elf_tls_common (int);
|
||||
static void obj_elf_lcomm (int);
|
||||
static void obj_elf_struct (int);
|
||||
+static void obj_elf_attach_to_group (int);
|
||||
|
||||
static const pseudo_typeS elf_pseudo_table[] =
|
||||
{
|
||||
+ {"attach_to_group", obj_elf_attach_to_group, 0},
|
||||
{"comm", obj_elf_common, 0},
|
||||
{"common", obj_elf_common, 1},
|
||||
{"ident", obj_elf_ident, 0},
|
||||
@@ -1007,6 +1009,27 @@ obj_elf_section_name (void)
|
||||
return name;
|
||||
}
|
||||
|
||||
+static void
|
||||
+obj_elf_attach_to_group (int dummy ATTRIBUTE_UNUSED)
|
||||
+{
|
||||
+ const char * gname = obj_elf_section_name ();
|
||||
+
|
||||
+ if (gname == NULL)
|
||||
+ {
|
||||
+ as_warn ("group name not parseable");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (elf_group_name (now_seg))
|
||||
+ {
|
||||
+ as_warn ("already has a group");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ elf_group_name (now_seg) = xstrdup (gname);
|
||||
+ elf_section_flags (now_seg) |= SHF_GROUP;
|
||||
+}
|
||||
+
|
||||
void
|
||||
obj_elf_section (int push)
|
||||
{
|
||||
diff -rup binutils.orig/gas/doc/as.texinfo binutils-2.30/gas/doc/as.texinfo
|
||||
--- binutils.orig/gas/doc/as.texi 2018-09-24 17:50:06.984172788 +0100
|
||||
+++ binutils-2.30/gas/doc/as.texi 2018-09-25 15:19:43.557748972 +0100
|
||||
@@ -4407,6 +4407,7 @@ Some machine configurations provide addi
|
||||
* Altmacro:: @code{.altmacro}
|
||||
* Ascii:: @code{.ascii "@var{string}"}@dots{}
|
||||
* Asciz:: @code{.asciz "@var{string}"}@dots{}
|
||||
+* Attach_to_group:: @code{.attach_to_group @var{name}}
|
||||
* Balign:: @code{.balign @var{abs-expr} , @var{abs-expr}}
|
||||
* Bundle directives:: @code{.bundle_align_mode @var{abs-expr}}, etc
|
||||
* Byte:: @code{.byte @var{expressions}}
|
||||
@@ -4703,6 +4704,12 @@ trailing zero byte) into consecutive add
|
||||
@code{.asciz} is just like @code{.ascii}, but each string is followed by
|
||||
a zero byte. The ``z'' in @samp{.asciz} stands for ``zero''.
|
||||
|
||||
+@node Attach_to_group
|
||||
+@section @code{.attach_to_group @var{name}}
|
||||
+Attaches the current section to the named group. This is like declaring
|
||||
+the section with the @code{G} attribute, but can be done after the section
|
||||
+has been created.
|
||||
+
|
||||
@node Balign
|
||||
@section @code{.balign[wl] @var{abs-expr}, @var{abs-expr}, @var{abs-expr}}
|
||||
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
--- binutils.orig/config/override.m4 2021-08-31 14:20:17.275574804 +0100
|
||||
+++ binutils-2.37/config/override.m4 2021-08-31 14:36:37.793954247 +0100
|
||||
@@ -41,7 +41,7 @@ dnl Or for updating the whole tree at on
|
||||
AC_DEFUN([_GCC_AUTOCONF_VERSION_CHECK],
|
||||
[m4_if(m4_defn([_GCC_AUTOCONF_VERSION]),
|
||||
m4_defn([m4_PACKAGE_VERSION]), [],
|
||||
- [m4_fatal([Please use exactly Autoconf ]_GCC_AUTOCONF_VERSION[ instead of ]m4_defn([m4_PACKAGE_VERSION])[.])])
|
||||
+ [])
|
||||
])
|
||||
m4_define([AC_INIT], m4_defn([AC_INIT])[
|
||||
_GCC_AUTOCONF_VERSION_CHECK
|
|
@ -0,0 +1,232 @@
|
|||
From 1c611b40e6bfc8029bff7696814330b5bc0ee5c0 Mon Sep 17 00:00:00 2001
|
||||
From: "H.J. Lu" <hjl.tools@gmail.com>
|
||||
Date: Mon, 26 Jul 2021 05:59:55 -0700
|
||||
Subject: [PATCH] bfd: Close the file descriptor if there is no archive fd
|
||||
|
||||
Close the file descriptor if there is no archive plugin file descriptor
|
||||
to avoid running out of file descriptors on thin archives with many
|
||||
archive members.
|
||||
|
||||
bfd/
|
||||
|
||||
PR ld/28138
|
||||
* plugin.c (bfd_plugin_close_file_descriptor): Close the file
|
||||
descriptor there is no archive plugin file descriptor.
|
||||
|
||||
ld/
|
||||
|
||||
PR ld/28138
|
||||
* testsuite/ld-plugin/lto.exp: Run tmpdir/pr28138 only for
|
||||
native build.
|
||||
|
||||
PR ld/28138
|
||||
* testsuite/ld-plugin/lto.exp: Run ld/28138 tests.
|
||||
* testsuite/ld-plugin/pr28138.c: New file.
|
||||
* testsuite/ld-plugin/pr28138-1.c: Likewise.
|
||||
* testsuite/ld-plugin/pr28138-2.c: Likewise.
|
||||
* testsuite/ld-plugin/pr28138-3.c: Likewise.
|
||||
* testsuite/ld-plugin/pr28138-4.c: Likewise.
|
||||
* testsuite/ld-plugin/pr28138-5.c: Likewise.
|
||||
* testsuite/ld-plugin/pr28138-6.c: Likewise.
|
||||
* testsuite/ld-plugin/pr28138-7.c: Likewise.
|
||||
|
||||
(cherry picked from commit 5a98fb7513b559e20dfebdbaa2a471afda3b4742)
|
||||
(cherry picked from commit 7dc37e1e1209c80e0bab784df6b6bac335e836f2)
|
||||
---
|
||||
bfd/plugin.c | 8 +++++++
|
||||
ld/testsuite/ld-plugin/lto.exp | 34 ++++++++++++++++++++++++++++++
|
||||
ld/testsuite/ld-plugin/pr28138-1.c | 6 ++++++
|
||||
ld/testsuite/ld-plugin/pr28138-2.c | 6 ++++++
|
||||
ld/testsuite/ld-plugin/pr28138-3.c | 6 ++++++
|
||||
ld/testsuite/ld-plugin/pr28138-4.c | 6 ++++++
|
||||
ld/testsuite/ld-plugin/pr28138-5.c | 6 ++++++
|
||||
ld/testsuite/ld-plugin/pr28138-6.c | 6 ++++++
|
||||
ld/testsuite/ld-plugin/pr28138-7.c | 6 ++++++
|
||||
ld/testsuite/ld-plugin/pr28138.c | 20 ++++++++++++++++++
|
||||
10 files changed, 104 insertions(+)
|
||||
create mode 100644 ld/testsuite/ld-plugin/pr28138-1.c
|
||||
create mode 100644 ld/testsuite/ld-plugin/pr28138-2.c
|
||||
create mode 100644 ld/testsuite/ld-plugin/pr28138-3.c
|
||||
create mode 100644 ld/testsuite/ld-plugin/pr28138-4.c
|
||||
create mode 100644 ld/testsuite/ld-plugin/pr28138-5.c
|
||||
create mode 100644 ld/testsuite/ld-plugin/pr28138-6.c
|
||||
create mode 100644 ld/testsuite/ld-plugin/pr28138-7.c
|
||||
create mode 100644 ld/testsuite/ld-plugin/pr28138.c
|
||||
|
||||
diff --git a/bfd/plugin.c b/bfd/plugin.c
|
||||
index 6cfa2b66470..3bab8febe88 100644
|
||||
--- a/bfd/plugin.c
|
||||
+++ b/bfd/plugin.c
|
||||
@@ -291,6 +291,14 @@ bfd_plugin_close_file_descriptor (bfd *abfd, int fd)
|
||||
&& !bfd_is_thin_archive (abfd->my_archive))
|
||||
abfd = abfd->my_archive;
|
||||
|
||||
+ /* Close the file descriptor if there is no archive plugin file
|
||||
+ descriptor. */
|
||||
+ if (abfd->archive_plugin_fd == -1)
|
||||
+ {
|
||||
+ close (fd);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
abfd->archive_plugin_fd_open_count--;
|
||||
/* Dup the archive plugin file descriptor for later use, which
|
||||
will be closed by _bfd_archive_close_and_cleanup. */
|
||||
diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
|
||||
index def69e43ab3..999d911ce6a 100644
|
||||
--- a/ld/testsuite/ld-plugin/lto.exp
|
||||
+++ b/ld/testsuite/ld-plugin/lto.exp
|
||||
@@ -687,6 +687,40 @@ if { [is_elf_format] && [check_lto_shared_available] } {
|
||||
}
|
||||
}
|
||||
|
||||
+run_cc_link_tests [list \
|
||||
+ [list \
|
||||
+ "Build pr28138.a" \
|
||||
+ "-T" "" \
|
||||
+ {pr28138-1.c pr28138-2.c pr28138-3.c pr28138-4.c pr28138-5.c \
|
||||
+ pr28138-6.c pr28138-7.c} {} "pr28138.a" \
|
||||
+ ] \
|
||||
+ [list \
|
||||
+ "Build pr28138.o" \
|
||||
+ "" "" \
|
||||
+ {pr28138.c} {} \
|
||||
+ ] \
|
||||
+]
|
||||
+
|
||||
+set exec_output [run_host_cmd "sh" \
|
||||
+ "-c \"ulimit -n 20; \
|
||||
+ $CC -Btmpdir/ld -o tmpdir/pr28138 \
|
||||
+ tmpdir/pr28138.o tmpdir/pr28138.a\""]
|
||||
+set exec_output [prune_warnings $exec_output]
|
||||
+if [string match "" $exec_output] then {
|
||||
+ if { [isnative] } {
|
||||
+ set exec_output [run_host_cmd "tmpdir/pr28138" ""]
|
||||
+ if [string match "PASS" $exec_output] then {
|
||||
+ pass "PR ld/28138"
|
||||
+ } else {
|
||||
+ fail "PR ld/28138"
|
||||
+ }
|
||||
+ } else {
|
||||
+ pass "PR ld/28138"
|
||||
+ }
|
||||
+} else {
|
||||
+ fail "PR ld/28138"
|
||||
+}
|
||||
+
|
||||
set testname "Build liblto-11.a"
|
||||
remote_file host delete "tmpdir/liblto-11.a"
|
||||
set catch_output [run_host_cmd "$ar" "rc $plug_opt tmpdir/liblto-11.a tmpdir/lto-11a.o tmpdir/lto-11b.o tmpdir/lto-11c.o"]
|
||||
diff --git a/ld/testsuite/ld-plugin/pr28138-1.c b/ld/testsuite/ld-plugin/pr28138-1.c
|
||||
new file mode 100644
|
||||
index 00000000000..51d119e1642
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-plugin/pr28138-1.c
|
||||
@@ -0,0 +1,6 @@
|
||||
+extern int a0(void);
|
||||
+int
|
||||
+a1(void)
|
||||
+{
|
||||
+ return 1 + a0();
|
||||
+}
|
||||
diff --git a/ld/testsuite/ld-plugin/pr28138-2.c b/ld/testsuite/ld-plugin/pr28138-2.c
|
||||
new file mode 100644
|
||||
index 00000000000..1120cd797e9
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-plugin/pr28138-2.c
|
||||
@@ -0,0 +1,6 @@
|
||||
+extern int a1(void);
|
||||
+int
|
||||
+a2(void)
|
||||
+{
|
||||
+ return 1 + a1();
|
||||
+}
|
||||
diff --git a/ld/testsuite/ld-plugin/pr28138-3.c b/ld/testsuite/ld-plugin/pr28138-3.c
|
||||
new file mode 100644
|
||||
index 00000000000..ec464947ee6
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-plugin/pr28138-3.c
|
||||
@@ -0,0 +1,6 @@
|
||||
+extern int a2(void);
|
||||
+int
|
||||
+a3(void)
|
||||
+{
|
||||
+ return 1 + a2();
|
||||
+}
|
||||
diff --git a/ld/testsuite/ld-plugin/pr28138-4.c b/ld/testsuite/ld-plugin/pr28138-4.c
|
||||
new file mode 100644
|
||||
index 00000000000..475701b2c5c
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-plugin/pr28138-4.c
|
||||
@@ -0,0 +1,6 @@
|
||||
+extern int a3(void);
|
||||
+int
|
||||
+a4(void)
|
||||
+{
|
||||
+ return 1 + a3();
|
||||
+}
|
||||
diff --git a/ld/testsuite/ld-plugin/pr28138-5.c b/ld/testsuite/ld-plugin/pr28138-5.c
|
||||
new file mode 100644
|
||||
index 00000000000..e24f86c363e
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-plugin/pr28138-5.c
|
||||
@@ -0,0 +1,6 @@
|
||||
+extern int a4(void);
|
||||
+int
|
||||
+a5(void)
|
||||
+{
|
||||
+ return 1 + a4();
|
||||
+}
|
||||
diff --git a/ld/testsuite/ld-plugin/pr28138-6.c b/ld/testsuite/ld-plugin/pr28138-6.c
|
||||
new file mode 100644
|
||||
index 00000000000..b5b938bdb21
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-plugin/pr28138-6.c
|
||||
@@ -0,0 +1,6 @@
|
||||
+extern int a5(void);
|
||||
+int
|
||||
+a6(void)
|
||||
+{
|
||||
+ return 1 + a5();
|
||||
+}
|
||||
diff --git a/ld/testsuite/ld-plugin/pr28138-7.c b/ld/testsuite/ld-plugin/pr28138-7.c
|
||||
new file mode 100644
|
||||
index 00000000000..4ef75bf0f0c
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-plugin/pr28138-7.c
|
||||
@@ -0,0 +1,6 @@
|
||||
+extern int a6(void);
|
||||
+int
|
||||
+a7(void)
|
||||
+{
|
||||
+ return 1 + a6();
|
||||
+}
|
||||
diff --git a/ld/testsuite/ld-plugin/pr28138.c b/ld/testsuite/ld-plugin/pr28138.c
|
||||
new file mode 100644
|
||||
index 00000000000..68252c9f382
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-plugin/pr28138.c
|
||||
@@ -0,0 +1,20 @@
|
||||
+#include <stdio.h>
|
||||
+
|
||||
+extern int a7(void);
|
||||
+
|
||||
+int
|
||||
+a0(void)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main()
|
||||
+{
|
||||
+ if (a7() == 7)
|
||||
+ {
|
||||
+ printf ("PASS\n");
|
||||
+ return 0;
|
||||
+ }
|
||||
+ return 1;
|
||||
+}
|
||||
--
|
||||
2.27.0
|
||||
|
|
@ -0,0 +1,971 @@
|
|||
diff -rup binutils.orig/binutils/NEWS binutils-2.37/binutils/NEWS
|
||||
--- binutils.orig/binutils/NEWS 2022-03-10 10:52:01.090309329 +0000
|
||||
+++ binutils-2.37/binutils/NEWS 2022-03-10 10:52:35.149087511 +0000
|
||||
@@ -1,5 +1,8 @@
|
||||
-*- text -*-
|
||||
|
||||
++* Add an option to objdump and readelf to prevent attempts to access debuginfod
|
||||
++ servers when following links.
|
||||
++
|
||||
* Tools which display symbols or strings (readelf, strings, nm, objdump)
|
||||
have a new command line option which controls how unicode characters are
|
||||
handled. By default they are treated as normal for the tool. Using
|
||||
diff -rup binutils.orig/binutils/NEWS.orig binutils-2.37/binutils/NEWS.orig
|
||||
--- binutils.orig/binutils/NEWS.orig 2022-03-10 10:52:01.072309446 +0000
|
||||
+++ binutils-2.37/binutils/NEWS.orig 2022-03-10 10:52:09.778252743 +0000
|
||||
@@ -1,5 +1,17 @@
|
||||
-*- text -*-
|
||||
|
||||
+* Tools which display symbols or strings (readelf, strings, nm, objdump)
|
||||
+ have a new command line option which controls how unicode characters are
|
||||
+ handled. By default they are treated as normal for the tool. Using
|
||||
+ --unicode=locale will display them according to the current locale.
|
||||
+ Using --unicode=hex will display them as hex byte values, whilst
|
||||
+ --unicode=escape will display them as escape sequences. In addition
|
||||
+ using --unicode=highlight will display them as unicode escape sequences
|
||||
+ highlighted in red (if supported by the output device).
|
||||
+
|
||||
+* Support for efi-app-aarch64, efi-rtdrv-aarch64 and efi-bsdrv-aarch64 has been
|
||||
+ added to objcopy in order to enable UEFI development using binutils.
|
||||
+
|
||||
Changes in 2.37:
|
||||
|
||||
* The readelf tool has a new command line option which can be used to specify
|
||||
diff -rup binutils.orig/binutils/NEWS.rej binutils-2.37/binutils/NEWS.rej
|
||||
--- binutils.orig/binutils/NEWS.rej 2022-03-10 10:52:01.090309329 +0000
|
||||
+++ binutils-2.37/binutils/NEWS.rej 2022-03-10 10:52:09.778252743 +0000
|
||||
@@ -1,18 +1,11 @@
|
||||
--- binutils/NEWS
|
||||
+++ binutils/NEWS
|
||||
-@@ -2,6 +2,15 @@
|
||||
+@@ -1,5 +1,8 @@
|
||||
+ -*- text -*-
|
||||
|
||||
- * Add support for the LoongArch instruction set.
|
||||
-
|
||||
-+* Tools which display symbols or strings (readelf, strings, nm, objdump)
|
||||
-+ have a new command line option which controls how unicode characters are
|
||||
-+ handled. By default they are treated as normal for the tool. Using
|
||||
-+ --unicode=locale will display them according to the current locale.
|
||||
-+ Using --unicode=hex will display them as hex byte values, whilst
|
||||
-+ --unicode=escape will display them as escape sequences. In addition
|
||||
-+ using --unicode=highlight will display them as unicode escape sequences
|
||||
-+ highlighted in red (if supported by the output device).
|
||||
++* Add an option to objdump and readelf to prevent attempts to access debuginfod
|
||||
++ servers when following links.
|
||||
+
|
||||
- Changes in 2.37:
|
||||
+ Changes in 2.38:
|
||||
|
||||
- * The readelf tool has a new command line option which can be used to specify
|
||||
+ * elfedit: Add --output-abiversion option to update ABIVERSION.
|
||||
diff -rup binutils.orig/binutils/doc/binutils.texi binutils-2.37/binutils/doc/binutils.texi
|
||||
--- binutils.orig/binutils/doc/binutils.texi 2022-03-10 10:52:01.073309440 +0000
|
||||
+++ binutils-2.37/binutils/doc/binutils.texi 2022-03-10 10:52:09.779252737 +0000
|
||||
@@ -2241,6 +2241,8 @@ objdump [@option{-a}|@option{--archive-h
|
||||
@option{--dwarf}[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=str-offsets,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index,=addr,=cu_index,=links]]
|
||||
[@option{-WK}|@option{--dwarf=follow-links}]
|
||||
[@option{-WN}|@option{--dwarf=no-follow-links}]
|
||||
+ [@option{-wD}|@option{--dwarf=use-debuginfod}]
|
||||
+ [@option{-wE}|@option{--dwarf=do-not-use-debuginfod}]
|
||||
[@option{-L}|@option{--process-links}]
|
||||
[@option{--ctf=}@var{section}]
|
||||
[@option{-G}|@option{--stabs}]
|
||||
@@ -4869,6 +4871,8 @@ readelf [@option{-a}|@option{--all}]
|
||||
@option{--debug-dump}[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=str-offsets,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index,=addr,=cu_index,=links]]
|
||||
[@option{-wK}|@option{--debug-dump=follow-links}]
|
||||
[@option{-wN}|@option{--debug-dump=no-follow-links}]
|
||||
+ [@option{-wD}|@option{--debug-dump=use-debuginfod}]
|
||||
+ [@option{-wE}|@option{--debug-dump=do-not-use-debuginfod}]
|
||||
[@option{-P}|@option{--process-links}]
|
||||
[@option{--dwarf-depth=@var{n}}]
|
||||
[@option{--dwarf-start=@var{n}}]
|
||||
@@ -5482,7 +5486,8 @@ deduced from the input file
|
||||
@cindex separate debug files
|
||||
|
||||
debuginfod is a web service that indexes ELF/DWARF debugging resources
|
||||
-by build-id and serves them over HTTP.
|
||||
+by build-id and serves them over HTTP. For more information see:
|
||||
+@emph{https://sourceware.org/elfutils/Debuginfod.html}
|
||||
|
||||
Binutils can be built with the debuginfod client library
|
||||
@code{libdebuginfod} using the @option{--with-debuginfod} configure option.
|
||||
@@ -5494,6 +5499,10 @@ separate debug files when the files are
|
||||
debuginfod is packaged with elfutils, starting with version 0.178.
|
||||
You can get the latest version from `https://sourceware.org/elfutils/'.
|
||||
|
||||
+The DWARF info dumping tools (@command{readelf} and @command{objdump})
|
||||
+have options to control when they should access the debuginfod
|
||||
+servers. By default this access is enabled.
|
||||
+
|
||||
@node Reporting Bugs
|
||||
@chapter Reporting Bugs
|
||||
@cindex bugs
|
||||
Only in binutils-2.37/binutils/doc: binutils.texi.orig
|
||||
diff -rup binutils.orig/binutils/doc/debug.options.texi binutils-2.37/binutils/doc/debug.options.texi
|
||||
--- binutils.orig/binutils/doc/debug.options.texi 2022-03-10 10:52:01.073309440 +0000
|
||||
+++ binutils-2.37/binutils/doc/debug.options.texi 2022-03-10 10:52:09.779252737 +0000
|
||||
@@ -68,10 +68,27 @@ chosen when configuring the binutils via
|
||||
@option{--enable-follow-debug-links=no} options. If these are not
|
||||
used then the default is to enable the following of debug links.
|
||||
|
||||
+Note - if support for the debuginfod protocol was enabled when the
|
||||
+binutils were built then this option will also include an attempt to
|
||||
+contact any debuginfod servers mentioned in the @var{DEBUGINFOD_URLS}
|
||||
+environment variable. This could take some time to resolve. This
|
||||
+behaviour can be disabled via the @option{=do-not-use-debuginfod} debug
|
||||
+option.
|
||||
+
|
||||
@item N
|
||||
@itemx =no-follow-links
|
||||
Disables the following of links to separate debug info files.
|
||||
|
||||
+@item D
|
||||
+@itemx =use-debuginfod
|
||||
+Enables contacting debuginfod servers if there is a need to follow
|
||||
+debug links. This is the default behaviour.
|
||||
+
|
||||
+@item E
|
||||
+@itemx =do-not-use-debuginfod
|
||||
+Disables contacting debuginfod servers when there is a need to follow
|
||||
+debug links.
|
||||
+
|
||||
@item l
|
||||
@itemx =rawline
|
||||
Displays the contents of the @samp{.debug_line} section in a raw
|
||||
diff -rup binutils.orig/binutils/dwarf.c binutils-2.37/binutils/dwarf.c
|
||||
--- binutils.orig/binutils/dwarf.c 2022-03-10 10:52:01.066309485 +0000
|
||||
+++ binutils-2.37/binutils/dwarf.c 2022-03-10 10:52:09.779252737 +0000
|
||||
@@ -109,6 +109,9 @@ int do_debug_cu_index;
|
||||
int do_wide;
|
||||
int do_debug_links;
|
||||
int do_follow_links = DEFAULT_FOR_FOLLOW_LINKS;
|
||||
+#ifdef HAVE_LIBDEBUGINFOD
|
||||
+int use_debuginfod = 1;
|
||||
+#endif
|
||||
bool do_checks;
|
||||
|
||||
int dwarf_cutoff_level = -1;
|
||||
@@ -11003,7 +11006,7 @@ debuginfod_fetch_separate_debug_info (st
|
||||
|
||||
return false;
|
||||
}
|
||||
-#endif
|
||||
+#endif /* HAVE_LIBDEBUGINFOD */
|
||||
|
||||
static void *
|
||||
load_separate_debug_info (const char * main_filename,
|
||||
@@ -11117,9 +11120,10 @@ load_separate_debug_info (const char *
|
||||
{
|
||||
char * tmp_filename;
|
||||
|
||||
- if (debuginfod_fetch_separate_debug_info (xlink,
|
||||
- & tmp_filename,
|
||||
- file))
|
||||
+ if (use_debuginfod
|
||||
+ && debuginfod_fetch_separate_debug_info (xlink,
|
||||
+ & tmp_filename,
|
||||
+ file))
|
||||
{
|
||||
/* File successfully downloaded from server, replace
|
||||
debug_filename with the file's path. */
|
||||
@@ -11167,13 +11171,15 @@ load_separate_debug_info (const char *
|
||||
warn (_("tried: %s\n"), debug_filename);
|
||||
|
||||
#if HAVE_LIBDEBUGINFOD
|
||||
- {
|
||||
- char *urls = getenv (DEBUGINFOD_URLS_ENV_VAR);
|
||||
- if (urls == NULL)
|
||||
- urls = "";
|
||||
+ if (use_debuginfod)
|
||||
+ {
|
||||
+ char *urls = getenv (DEBUGINFOD_URLS_ENV_VAR);
|
||||
|
||||
- warn (_("tried: DEBUGINFOD_URLS=%s\n"), urls);
|
||||
- }
|
||||
+ if (urls == NULL)
|
||||
+ urls = "";
|
||||
+
|
||||
+ warn (_("tried: DEBUGINFOD_URLS=%s\n"), urls);
|
||||
+ }
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -11547,6 +11553,9 @@ dwarf_select_sections_by_names (const ch
|
||||
{ "aranges", & do_debug_aranges, 1 },
|
||||
{ "cu_index", & do_debug_cu_index, 1 },
|
||||
{ "decodedline", & do_debug_lines, FLAG_DEBUG_LINES_DECODED },
|
||||
+#ifdef HAVE_LIBDEBUGINFOD
|
||||
+ { "do-not-use-debuginfod", & use_debuginfod, 0 },
|
||||
+#endif
|
||||
{ "follow-links", & do_follow_links, 1 },
|
||||
{ "frames", & do_debug_frames, 1 },
|
||||
{ "frames-interp", & do_debug_frames_interp, 1 },
|
||||
@@ -11570,6 +11579,9 @@ dwarf_select_sections_by_names (const ch
|
||||
{ "trace_abbrev", & do_trace_abbrevs, 1 },
|
||||
{ "trace_aranges", & do_trace_aranges, 1 },
|
||||
{ "trace_info", & do_trace_info, 1 },
|
||||
+#ifdef HAVE_LIBDEBUGINFOD
|
||||
+ { "use-debuginfod", & use_debuginfod, 1 },
|
||||
+#endif
|
||||
{ NULL, NULL, 0 }
|
||||
};
|
||||
|
||||
@@ -11623,6 +11635,10 @@ dwarf_select_sections_by_letters (const
|
||||
case 'A': do_debug_addr = 1; break;
|
||||
case 'a': do_debug_abbrevs = 1; break;
|
||||
case 'c': do_debug_cu_index = 1; break;
|
||||
+#ifdef HAVE_LIBDEBUGINFOD
|
||||
+ case 'D': use_debuginfod = 1; break;
|
||||
+ case 'E': use_debuginfod = 0; break;
|
||||
+#endif
|
||||
case 'F': do_debug_frames_interp = 1; /* Fall through. */
|
||||
case 'f': do_debug_frames = 1; break;
|
||||
case 'g': do_gdb_index = 1; break;
|
||||
Only in binutils-2.37/binutils/: dwarf.c.orig
|
||||
diff -rup binutils.orig/binutils/dwarf.h binutils-2.37/binutils/dwarf.h
|
||||
--- binutils.orig/binutils/dwarf.h 2022-03-10 10:52:01.066309485 +0000
|
||||
+++ binutils-2.37/binutils/dwarf.h 2022-03-10 10:52:09.780252730 +0000
|
||||
@@ -221,6 +221,9 @@ extern int do_debug_cu_index;
|
||||
extern int do_wide;
|
||||
extern int do_debug_links;
|
||||
extern int do_follow_links;
|
||||
+#ifdef HAVE_LIBDEBUGINFOD
|
||||
+extern int use_debuginfod;
|
||||
+#endif
|
||||
extern bool do_checks;
|
||||
|
||||
extern int dwarf_cutoff_level;
|
||||
Only in binutils-2.37/binutils/: dwarf.h.orig
|
||||
diff -rup binutils.orig/binutils/objdump.c binutils-2.37/binutils/objdump.c
|
||||
--- binutils.orig/binutils/objdump.c 2022-03-10 10:52:01.090309329 +0000
|
||||
+++ binutils-2.37/binutils/objdump.c 2022-03-10 10:52:09.780252730 +0000
|
||||
@@ -280,6 +280,14 @@ usage (FILE *stream, int status)
|
||||
Do not follow links to separate debug info files\n\
|
||||
(default)\n"));
|
||||
#endif
|
||||
+#if HAVE_LIBDEBUGINFOD
|
||||
+ fprintf (stream, _("\
|
||||
+ -WD --dwarf=use-debuginfod\n\
|
||||
+ When following links, also query debuginfod servers (default)\n"));
|
||||
+ fprintf (stream, _("\
|
||||
+ -WE --dwarf=do-not-use-debuginfod\n\
|
||||
+ When following links, do not query debuginfod servers\n"));
|
||||
+#endif
|
||||
fprintf (stream, _("\
|
||||
-L, --process-links Display the contents of non-debug sections in\n\
|
||||
separate debuginfo files. (Implies -WK)\n"));
|
||||
diff -rup binutils.orig/binutils/objdump.c.orig binutils-2.37/binutils/objdump.c.orig
|
||||
--- binutils.orig/binutils/objdump.c.orig 2022-03-10 10:52:01.065309492 +0000
|
||||
+++ binutils-2.37/binutils/objdump.c.orig 2022-03-10 10:51:55.365346615 +0000
|
||||
@@ -204,6 +204,18 @@ static const struct objdump_private_desc
|
||||
|
||||
/* The list of detected jumps inside a function. */
|
||||
static struct jump_info *detected_jumps = NULL;
|
||||
+
|
||||
+typedef enum unicode_display_type
|
||||
+{
|
||||
+ unicode_default = 0,
|
||||
+ unicode_locale,
|
||||
+ unicode_escape,
|
||||
+ unicode_hex,
|
||||
+ unicode_highlight,
|
||||
+ unicode_invalid
|
||||
+} unicode_display_type;
|
||||
+
|
||||
+static unicode_display_type unicode_display = unicode_default;
|
||||
|
||||
static void usage (FILE *, int) ATTRIBUTE_NORETURN;
|
||||
static void
|
||||
@@ -330,6 +342,9 @@ usage (FILE *stream, int status)
|
||||
fprintf (stream, _("\
|
||||
-w, --wide Format output for more than 80 columns\n"));
|
||||
fprintf (stream, _("\
|
||||
+ -U[d|l|i|x|e|h] Controls the display of UTF-8 unicode characters\n\
|
||||
+ --unicode=[default|locale|invalid|hex|escape|highlight]\n"));
|
||||
+ fprintf (stream, _("\
|
||||
-z, --disassemble-zeroes Do not skip blocks of zeroes when disassembling\n"));
|
||||
fprintf (stream, _("\
|
||||
--start-address=ADDR Only process data whose address is >= ADDR\n"));
|
||||
@@ -420,17 +435,23 @@ static struct option long_options[]=
|
||||
{
|
||||
{"adjust-vma", required_argument, NULL, OPTION_ADJUST_VMA},
|
||||
{"all-headers", no_argument, NULL, 'x'},
|
||||
- {"private-headers", no_argument, NULL, 'p'},
|
||||
- {"private", required_argument, NULL, 'P'},
|
||||
{"architecture", required_argument, NULL, 'm'},
|
||||
{"archive-headers", no_argument, NULL, 'a'},
|
||||
+#ifdef ENABLE_LIBCTF
|
||||
+ {"ctf", required_argument, NULL, OPTION_CTF},
|
||||
+ {"ctf-parent", required_argument, NULL, OPTION_CTF_PARENT},
|
||||
+#endif
|
||||
{"debugging", no_argument, NULL, 'g'},
|
||||
{"debugging-tags", no_argument, NULL, 'e'},
|
||||
{"demangle", optional_argument, NULL, 'C'},
|
||||
{"disassemble", optional_argument, NULL, 'd'},
|
||||
{"disassemble-all", no_argument, NULL, 'D'},
|
||||
- {"disassembler-options", required_argument, NULL, 'M'},
|
||||
{"disassemble-zeroes", no_argument, NULL, 'z'},
|
||||
+ {"disassembler-options", required_argument, NULL, 'M'},
|
||||
+ {"dwarf", optional_argument, NULL, OPTION_DWARF},
|
||||
+ {"dwarf-check", no_argument, 0, OPTION_DWARF_CHECK},
|
||||
+ {"dwarf-depth", required_argument, 0, OPTION_DWARF_DEPTH},
|
||||
+ {"dwarf-start", required_argument, 0, OPTION_DWARF_START},
|
||||
{"dynamic-reloc", no_argument, NULL, 'R'},
|
||||
{"dynamic-syms", no_argument, NULL, 'T'},
|
||||
{"endian", required_argument, NULL, OPTION_ENDIAN},
|
||||
@@ -440,16 +461,23 @@ static struct option long_options[]=
|
||||
{"full-contents", no_argument, NULL, 's'},
|
||||
{"headers", no_argument, NULL, 'h'},
|
||||
{"help", no_argument, NULL, 'H'},
|
||||
+ {"include", required_argument, NULL, 'I'},
|
||||
{"info", no_argument, NULL, 'i'},
|
||||
+ {"inlines", no_argument, 0, OPTION_INLINES},
|
||||
+ {"insn-width", required_argument, NULL, OPTION_INSN_WIDTH},
|
||||
{"line-numbers", no_argument, NULL, 'l'},
|
||||
- {"no-show-raw-insn", no_argument, &show_raw_insn, -1},
|
||||
{"no-addresses", no_argument, &no_addresses, 1},
|
||||
- {"process-links", no_argument, &process_links, true},
|
||||
+ {"no-recurse-limit", no_argument, NULL, OPTION_NO_RECURSE_LIMIT},
|
||||
+ {"no-recursion-limit", no_argument, NULL, OPTION_NO_RECURSE_LIMIT},
|
||||
+ {"no-show-raw-insn", no_argument, &show_raw_insn, -1},
|
||||
+ {"prefix", required_argument, NULL, OPTION_PREFIX},
|
||||
{"prefix-addresses", no_argument, &prefix_addresses, 1},
|
||||
+ {"prefix-strip", required_argument, NULL, OPTION_PREFIX_STRIP},
|
||||
+ {"private", required_argument, NULL, 'P'},
|
||||
+ {"private-headers", no_argument, NULL, 'p'},
|
||||
+ {"process-links", no_argument, &process_links, true},
|
||||
{"recurse-limit", no_argument, NULL, OPTION_RECURSE_LIMIT},
|
||||
{"recursion-limit", no_argument, NULL, OPTION_RECURSE_LIMIT},
|
||||
- {"no-recurse-limit", no_argument, NULL, OPTION_NO_RECURSE_LIMIT},
|
||||
- {"no-recursion-limit", no_argument, NULL, OPTION_NO_RECURSE_LIMIT},
|
||||
{"reloc", no_argument, NULL, 'r'},
|
||||
{"section", required_argument, NULL, 'j'},
|
||||
{"section-headers", no_argument, NULL, 'h'},
|
||||
@@ -457,28 +485,16 @@ static struct option long_options[]=
|
||||
{"source", no_argument, NULL, 'S'},
|
||||
{"source-comment", optional_argument, NULL, OPTION_SOURCE_COMMENT},
|
||||
{"special-syms", no_argument, &dump_special_syms, 1},
|
||||
- {"include", required_argument, NULL, 'I'},
|
||||
- {"dwarf", optional_argument, NULL, OPTION_DWARF},
|
||||
-#ifdef ENABLE_LIBCTF
|
||||
- {"ctf", required_argument, NULL, OPTION_CTF},
|
||||
- {"ctf-parent", required_argument, NULL, OPTION_CTF_PARENT},
|
||||
-#endif
|
||||
{"stabs", no_argument, NULL, 'G'},
|
||||
{"start-address", required_argument, NULL, OPTION_START_ADDRESS},
|
||||
{"stop-address", required_argument, NULL, OPTION_STOP_ADDRESS},
|
||||
{"syms", no_argument, NULL, 't'},
|
||||
{"target", required_argument, NULL, 'b'},
|
||||
+ {"unicode", required_argument, NULL, 'U'},
|
||||
{"version", no_argument, NULL, 'V'},
|
||||
- {"wide", no_argument, NULL, 'w'},
|
||||
- {"prefix", required_argument, NULL, OPTION_PREFIX},
|
||||
- {"prefix-strip", required_argument, NULL, OPTION_PREFIX_STRIP},
|
||||
- {"insn-width", required_argument, NULL, OPTION_INSN_WIDTH},
|
||||
- {"dwarf-depth", required_argument, 0, OPTION_DWARF_DEPTH},
|
||||
- {"dwarf-start", required_argument, 0, OPTION_DWARF_START},
|
||||
- {"dwarf-check", no_argument, 0, OPTION_DWARF_CHECK},
|
||||
- {"inlines", no_argument, 0, OPTION_INLINES},
|
||||
{"visualize-jumps", optional_argument, 0, OPTION_VISUALIZE_JUMPS},
|
||||
- {0, no_argument, 0, 0}
|
||||
+ {"wide", no_argument, NULL, 'w'},
|
||||
+ {NULL, no_argument, NULL, 0}
|
||||
};
|
||||
|
||||
static void
|
||||
@@ -488,9 +504,121 @@ nonfatal (const char *msg)
|
||||
exit_status = 1;
|
||||
}
|
||||
|
||||
+/* Convert a potential UTF-8 encoded sequence in IN into characters in OUT.
|
||||
+ The conversion format is controlled by the unicode_display variable.
|
||||
+ Returns the number of characters added to OUT.
|
||||
+ Returns the number of bytes consumed from IN in CONSUMED.
|
||||
+ Always consumes at least one byte and displays at least one character. */
|
||||
+
|
||||
+static unsigned int
|
||||
+display_utf8 (const unsigned char * in, char * out, unsigned int * consumed)
|
||||
+{
|
||||
+ char * orig_out = out;
|
||||
+ unsigned int nchars = 0;
|
||||
+ unsigned int j;
|
||||
+
|
||||
+ if (unicode_display == unicode_default)
|
||||
+ goto invalid;
|
||||
+
|
||||
+ if (in[0] < 0xc0)
|
||||
+ goto invalid;
|
||||
+
|
||||
+ if ((in[1] & 0xc0) != 0x80)
|
||||
+ goto invalid;
|
||||
+
|
||||
+ if ((in[0] & 0x20) == 0)
|
||||
+ {
|
||||
+ nchars = 2;
|
||||
+ goto valid;
|
||||
+ }
|
||||
+
|
||||
+ if ((in[2] & 0xc0) != 0x80)
|
||||
+ goto invalid;
|
||||
+
|
||||
+ if ((in[0] & 0x10) == 0)
|
||||
+ {
|
||||
+ nchars = 3;
|
||||
+ goto valid;
|
||||
+ }
|
||||
+
|
||||
+ if ((in[3] & 0xc0) != 0x80)
|
||||
+ goto invalid;
|
||||
+
|
||||
+ nchars = 4;
|
||||
+
|
||||
+ valid:
|
||||
+ switch (unicode_display)
|
||||
+ {
|
||||
+ case unicode_locale:
|
||||
+ /* Copy the bytes into the output buffer as is. */
|
||||
+ memcpy (out, in, nchars);
|
||||
+ out += nchars;
|
||||
+ break;
|
||||
+
|
||||
+ case unicode_invalid:
|
||||
+ case unicode_hex:
|
||||
+ out += sprintf (out, "%c", unicode_display == unicode_hex ? '<' : '{');
|
||||
+ out += sprintf (out, "0x");
|
||||
+ for (j = 0; j < nchars; j++)
|
||||
+ out += sprintf (out, "%02x", in [j]);
|
||||
+ out += sprintf (out, "%c", unicode_display == unicode_hex ? '>' : '}');
|
||||
+ break;
|
||||
+
|
||||
+ case unicode_highlight:
|
||||
+ if (isatty (1))
|
||||
+ out += sprintf (out, "\x1B[31;47m"); /* Red. */
|
||||
+ /* Fall through. */
|
||||
+ case unicode_escape:
|
||||
+ switch (nchars)
|
||||
+ {
|
||||
+ case 2:
|
||||
+ out += sprintf (out, "\\u%02x%02x",
|
||||
+ ((in[0] & 0x1c) >> 2),
|
||||
+ ((in[0] & 0x03) << 6) | (in[1] & 0x3f));
|
||||
+ break;
|
||||
+
|
||||
+ case 3:
|
||||
+ out += sprintf (out, "\\u%02x%02x",
|
||||
+ ((in[0] & 0x0f) << 4) | ((in[1] & 0x3c) >> 2),
|
||||
+ ((in[1] & 0x03) << 6) | ((in[2] & 0x3f)));
|
||||
+ break;
|
||||
+
|
||||
+ case 4:
|
||||
+ out += sprintf (out, "\\u%02x%02x%02x",
|
||||
+ ((in[0] & 0x07) << 6) | ((in[1] & 0x3c) >> 2),
|
||||
+ ((in[1] & 0x03) << 6) | ((in[2] & 0x3c) >> 2),
|
||||
+ ((in[2] & 0x03) << 6) | ((in[3] & 0x3f)));
|
||||
+ break;
|
||||
+ default:
|
||||
+ /* URG. */
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (unicode_display == unicode_highlight && isatty (1))
|
||||
+ out += sprintf (out, "\033[0m"); /* Default colour. */
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ /* URG */
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ * consumed = nchars;
|
||||
+ return out - orig_out;
|
||||
+
|
||||
+ invalid:
|
||||
+ /* Not a valid UTF-8 sequence. */
|
||||
+ *out = *in;
|
||||
+ * consumed = 1;
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
/* Returns a version of IN with any control characters
|
||||
replaced by escape sequences. Uses a static buffer
|
||||
- if necessary. */
|
||||
+ if necessary.
|
||||
+
|
||||
+ If unicode display is enabled, then also handles the
|
||||
+ conversion of unicode characters. */
|
||||
|
||||
static const char *
|
||||
sanitize_string (const char * in)
|
||||
@@ -508,40 +636,50 @@ sanitize_string (const char * in)
|
||||
of cases it will not be needed. */
|
||||
do
|
||||
{
|
||||
- char c = *in++;
|
||||
+ unsigned char c = *in++;
|
||||
|
||||
if (c == 0)
|
||||
return original;
|
||||
|
||||
if (ISCNTRL (c))
|
||||
break;
|
||||
+
|
||||
+ if (unicode_display != unicode_default && c >= 0xc0)
|
||||
+ break;
|
||||
}
|
||||
while (1);
|
||||
|
||||
/* Copy the input, translating as needed. */
|
||||
in = original;
|
||||
- if (buffer_len < (strlen (in) * 2))
|
||||
+ if (buffer_len < (strlen (in) * 9))
|
||||
{
|
||||
free ((void *) buffer);
|
||||
- buffer_len = strlen (in) * 2;
|
||||
+ buffer_len = strlen (in) * 9;
|
||||
buffer = xmalloc (buffer_len + 1);
|
||||
}
|
||||
|
||||
out = buffer;
|
||||
do
|
||||
{
|
||||
- char c = *in++;
|
||||
+ unsigned char c = *in++;
|
||||
|
||||
if (c == 0)
|
||||
break;
|
||||
|
||||
- if (!ISCNTRL (c))
|
||||
- *out++ = c;
|
||||
- else
|
||||
+ if (ISCNTRL (c))
|
||||
{
|
||||
*out++ = '^';
|
||||
*out++ = c + 0x40;
|
||||
}
|
||||
+ else if (unicode_display != unicode_default && c >= 0xc0)
|
||||
+ {
|
||||
+ unsigned int num_consumed;
|
||||
+
|
||||
+ out += display_utf8 ((const unsigned char *)(in - 1), out, & num_consumed);
|
||||
+ in += num_consumed - 1;
|
||||
+ }
|
||||
+ else
|
||||
+ *out++ = c;
|
||||
}
|
||||
while (1);
|
||||
|
||||
@@ -4529,6 +4667,24 @@ dump_symbols (bfd *abfd ATTRIBUTE_UNUSED
|
||||
free (alloc);
|
||||
}
|
||||
}
|
||||
+ else if (unicode_display != unicode_default
|
||||
+ && name != NULL && *name != '\0')
|
||||
+ {
|
||||
+ const char * sanitized_name;
|
||||
+
|
||||
+ /* If we want to sanitize the name, we do it here, and
|
||||
+ temporarily clobber it while calling bfd_print_symbol.
|
||||
+ FIXME: This is a gross hack. */
|
||||
+ sanitized_name = sanitize_string (name);
|
||||
+ if (sanitized_name != name)
|
||||
+ (*current)->name = sanitized_name;
|
||||
+ else
|
||||
+ sanitized_name = NULL;
|
||||
+ bfd_print_symbol (cur_bfd, stdout, *current,
|
||||
+ bfd_print_symbol_all);
|
||||
+ if (sanitized_name != NULL)
|
||||
+ (*current)->name = name;
|
||||
+ }
|
||||
else
|
||||
bfd_print_symbol (cur_bfd, stdout, *current,
|
||||
bfd_print_symbol_all);
|
||||
@@ -5212,7 +5368,7 @@ main (int argc, char **argv)
|
||||
set_default_bfd_target ();
|
||||
|
||||
while ((c = getopt_long (argc, argv,
|
||||
- "pP:ib:m:M:VvCdDlfFaHhrRtTxsSI:j:wE:zgeGW::",
|
||||
+ "pP:ib:m:M:VvCdDlfFaHhrRtTU:xsSI:j:wE:zgeGW::",
|
||||
long_options, (int *) 0))
|
||||
!= EOF)
|
||||
{
|
||||
@@ -5495,6 +5651,23 @@ main (int argc, char **argv)
|
||||
seenflag = true;
|
||||
break;
|
||||
|
||||
+ case 'U':
|
||||
+ if (streq (optarg, "default") || streq (optarg, "d"))
|
||||
+ unicode_display = unicode_default;
|
||||
+ else if (streq (optarg, "locale") || streq (optarg, "l"))
|
||||
+ unicode_display = unicode_locale;
|
||||
+ else if (streq (optarg, "escape") || streq (optarg, "e"))
|
||||
+ unicode_display = unicode_escape;
|
||||
+ else if (streq (optarg, "invalid") || streq (optarg, "i"))
|
||||
+ unicode_display = unicode_invalid;
|
||||
+ else if (streq (optarg, "hex") || streq (optarg, "x"))
|
||||
+ unicode_display = unicode_hex;
|
||||
+ else if (streq (optarg, "highlight") || streq (optarg, "h"))
|
||||
+ unicode_display = unicode_highlight;
|
||||
+ else
|
||||
+ fatal (_("invalid argument to -U/--unicode: %s"), optarg);
|
||||
+ break;
|
||||
+
|
||||
case 'H':
|
||||
usage (stdout, 0);
|
||||
/* No need to set seenflag or to break - usage() does not return. */
|
||||
diff -rup binutils.orig/binutils/readelf.c binutils-2.37/binutils/readelf.c
|
||||
--- binutils.orig/binutils/readelf.c 2022-03-10 10:52:01.063309505 +0000
|
||||
+++ binutils-2.37/binutils/readelf.c 2022-03-10 10:52:09.781252724 +0000
|
||||
@@ -4955,6 +4955,14 @@ usage (FILE * stream)
|
||||
Do not follow links to separate debug info files\n\
|
||||
(default)\n"));
|
||||
#endif
|
||||
+#if HAVE_LIBDEBUGINFOD
|
||||
+ fprintf (stream, _("\
|
||||
+ -wD --debug-dump=use-debuginfod\n\
|
||||
+ When following links, also query debuginfod servers (default)\n"));
|
||||
+ fprintf (stream, _("\
|
||||
+ -wE --debug-dump=do-not-use-debuginfod\n\
|
||||
+ When following links, do not query debuginfod servers\n"));
|
||||
+#endif
|
||||
fprintf (stream, _("\
|
||||
--dwarf-depth=N Do not display DIEs at depth N or greater\n"));
|
||||
fprintf (stream, _("\
|
||||
diff -rup binutils.orig/binutils/readelf.c.orig binutils-2.37/binutils/readelf.c.orig
|
||||
--- binutils.orig/binutils/readelf.c.orig 2022-03-10 10:52:01.089309336 +0000
|
||||
+++ binutils-2.37/binutils/readelf.c.orig 2022-03-10 10:51:55.396346413 +0000
|
||||
@@ -328,6 +328,19 @@ typedef enum print_mode
|
||||
}
|
||||
print_mode;
|
||||
|
||||
+typedef enum unicode_display_type
|
||||
+{
|
||||
+ unicode_default = 0,
|
||||
+ unicode_locale,
|
||||
+ unicode_escape,
|
||||
+ unicode_hex,
|
||||
+ unicode_highlight,
|
||||
+ unicode_invalid
|
||||
+} unicode_display_type;
|
||||
+
|
||||
+static unicode_display_type unicode_display = unicode_default;
|
||||
+
|
||||
+
|
||||
/* Versioned symbol info. */
|
||||
enum versioned_symbol_info
|
||||
{
|
||||
@@ -632,11 +645,18 @@ print_symbol (signed int width, const ch
|
||||
if (c == 0)
|
||||
break;
|
||||
|
||||
- /* Do not print control characters directly as they can affect terminal
|
||||
- settings. Such characters usually appear in the names generated
|
||||
- by the assembler for local labels. */
|
||||
- if (ISCNTRL (c))
|
||||
+ if (ISPRINT (c))
|
||||
{
|
||||
+ putchar (c);
|
||||
+ width_remaining --;
|
||||
+ num_printed ++;
|
||||
+ }
|
||||
+ else if (ISCNTRL (c))
|
||||
+ {
|
||||
+ /* Do not print control characters directly as they can affect terminal
|
||||
+ settings. Such characters usually appear in the names generated
|
||||
+ by the assembler for local labels. */
|
||||
+
|
||||
if (width_remaining < 2)
|
||||
break;
|
||||
|
||||
@@ -644,11 +664,137 @@ print_symbol (signed int width, const ch
|
||||
width_remaining -= 2;
|
||||
num_printed += 2;
|
||||
}
|
||||
- else if (ISPRINT (c))
|
||||
+ else if (c == 0x7f)
|
||||
{
|
||||
- putchar (c);
|
||||
- width_remaining --;
|
||||
- num_printed ++;
|
||||
+ if (width_remaining < 5)
|
||||
+ break;
|
||||
+ printf ("<DEL>");
|
||||
+ width_remaining -= 5;
|
||||
+ num_printed += 5;
|
||||
+ }
|
||||
+ else if (unicode_display != unicode_locale
|
||||
+ && unicode_display != unicode_default)
|
||||
+ {
|
||||
+ /* Display unicode characters as something else. */
|
||||
+ unsigned char bytes[4];
|
||||
+ bool is_utf8;
|
||||
+ uint nbytes;
|
||||
+
|
||||
+ bytes[0] = c;
|
||||
+
|
||||
+ if (bytes[0] < 0xc0)
|
||||
+ {
|
||||
+ nbytes = 1;
|
||||
+ is_utf8 = false;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ bytes[1] = *symbol++;
|
||||
+
|
||||
+ if ((bytes[1] & 0xc0) != 0x80)
|
||||
+ {
|
||||
+ is_utf8 = false;
|
||||
+ /* Do not consume this character. It may only
|
||||
+ be the first byte in the sequence that was
|
||||
+ corrupt. */
|
||||
+ --symbol;
|
||||
+ nbytes = 1;
|
||||
+ }
|
||||
+ else if ((bytes[0] & 0x20) == 0)
|
||||
+ {
|
||||
+ is_utf8 = true;
|
||||
+ nbytes = 2;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ bytes[2] = *symbol++;
|
||||
+
|
||||
+ if ((bytes[2] & 0xc0) != 0x80)
|
||||
+ {
|
||||
+ is_utf8 = false;
|
||||
+ symbol -= 2;
|
||||
+ nbytes = 1;
|
||||
+ }
|
||||
+ else if ((bytes[0] & 0x10) == 0)
|
||||
+ {
|
||||
+ is_utf8 = true;
|
||||
+ nbytes = 3;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ bytes[3] = *symbol++;
|
||||
+
|
||||
+ nbytes = 4;
|
||||
+
|
||||
+ if ((bytes[3] & 0xc0) != 0x80)
|
||||
+ {
|
||||
+ is_utf8 = false;
|
||||
+ symbol -= 3;
|
||||
+ nbytes = 1;
|
||||
+ }
|
||||
+ else
|
||||
+ is_utf8 = true;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (unicode_display == unicode_invalid)
|
||||
+ is_utf8 = false;
|
||||
+
|
||||
+ if (unicode_display == unicode_hex || ! is_utf8)
|
||||
+ {
|
||||
+ uint i;
|
||||
+
|
||||
+ if (width_remaining < (nbytes * 2) + 2)
|
||||
+ break;
|
||||
+
|
||||
+ putchar (is_utf8 ? '<' : '{');
|
||||
+ printf ("0x");
|
||||
+ for (i = 0; i < nbytes; i++)
|
||||
+ printf ("%02x", bytes[i]);
|
||||
+ putchar (is_utf8 ? '>' : '}');
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if (unicode_display == unicode_highlight && isatty (1))
|
||||
+ printf ("\x1B[31;47m"); /* Red. */
|
||||
+
|
||||
+ switch (nbytes)
|
||||
+ {
|
||||
+ case 2:
|
||||
+ if (width_remaining < 6)
|
||||
+ break;
|
||||
+ printf ("\\u%02x%02x",
|
||||
+ (bytes[0] & 0x1c) >> 2,
|
||||
+ ((bytes[0] & 0x03) << 6) | (bytes[1] & 0x3f));
|
||||
+ break;
|
||||
+ case 3:
|
||||
+ if (width_remaining < 6)
|
||||
+ break;
|
||||
+ printf ("\\u%02x%02x",
|
||||
+ ((bytes[0] & 0x0f) << 4) | ((bytes[1] & 0x3c) >> 2),
|
||||
+ ((bytes[1] & 0x03) << 6) | (bytes[2] & 0x3f));
|
||||
+ break;
|
||||
+ case 4:
|
||||
+ if (width_remaining < 8)
|
||||
+ break;
|
||||
+ printf ("\\u%02x%02x%02x",
|
||||
+ ((bytes[0] & 0x07) << 6) | ((bytes[1] & 0x3c) >> 2),
|
||||
+ ((bytes[1] & 0x03) << 6) | ((bytes[2] & 0x3c) >> 2),
|
||||
+ ((bytes[2] & 0x03) << 6) | (bytes[3] & 0x3f));
|
||||
+
|
||||
+ break;
|
||||
+ default:
|
||||
+ /* URG. */
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (unicode_display == unicode_highlight && isatty (1))
|
||||
+ printf ("\033[0m"); /* Default colour. */
|
||||
+ }
|
||||
+
|
||||
+ if (bytes[nbytes - 1] == 0)
|
||||
+ break;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4668,6 +4814,7 @@ static struct option options[] =
|
||||
{"syms", no_argument, 0, 's'},
|
||||
{"silent-truncation",no_argument, 0, 'T'},
|
||||
{"section-details", no_argument, 0, 't'},
|
||||
+ {"unicode", required_argument, NULL, 'U'},
|
||||
{"unwind", no_argument, 0, 'u'},
|
||||
{"version-info", no_argument, 0, 'V'},
|
||||
{"version", no_argument, 0, 'v'},
|
||||
@@ -4744,6 +4891,12 @@ usage (FILE * stream)
|
||||
fprintf (stream, _("\
|
||||
--no-recurse-limit Disable a demangling recursion limit\n"));
|
||||
fprintf (stream, _("\
|
||||
+ -U[dlexhi] --unicode=[default|locale|escape|hex|highlight|invalid]\n\
|
||||
+ Display unicode characters as determined by the current locale\n\
|
||||
+ (default), escape sequences, \"<hex sequences>\", highlighted\n\
|
||||
+ escape sequences, or treat them as invalid and display as\n\
|
||||
+ \"{hex sequences}\"\n"));
|
||||
+ fprintf (stream, _("\
|
||||
-n --notes Display the core notes (if present)\n"));
|
||||
fprintf (stream, _("\
|
||||
-r --relocs Display the relocations (if present)\n"));
|
||||
@@ -4928,7 +5081,7 @@ parse_args (struct dump_data *dumpdata,
|
||||
usage (stderr);
|
||||
|
||||
while ((c = getopt_long
|
||||
- (argc, argv, "ACDHILNPR:STVWacdeghi:lnp:rstuvw::x:z", options, NULL)) != EOF)
|
||||
+ (argc, argv, "ACDHILNPR:STU:VWacdeghi:lnp:rstuvw::x:z", options, NULL)) != EOF)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
@@ -5130,6 +5283,25 @@ parse_args (struct dump_data *dumpdata,
|
||||
/* Ignored for backward compatibility. */
|
||||
break;
|
||||
|
||||
+ case 'U':
|
||||
+ if (optarg == NULL)
|
||||
+ error (_("Missing arg to -U/--unicode")); /* Can this happen ? */
|
||||
+ else if (streq (optarg, "default") || streq (optarg, "d"))
|
||||
+ unicode_display = unicode_default;
|
||||
+ else if (streq (optarg, "locale") || streq (optarg, "l"))
|
||||
+ unicode_display = unicode_locale;
|
||||
+ else if (streq (optarg, "escape") || streq (optarg, "e"))
|
||||
+ unicode_display = unicode_escape;
|
||||
+ else if (streq (optarg, "invalid") || streq (optarg, "i"))
|
||||
+ unicode_display = unicode_invalid;
|
||||
+ else if (streq (optarg, "hex") || streq (optarg, "x"))
|
||||
+ unicode_display = unicode_hex;
|
||||
+ else if (streq (optarg, "highlight") || streq (optarg, "h"))
|
||||
+ unicode_display = unicode_highlight;
|
||||
+ else
|
||||
+ error (_("invalid argument to -U/--unicode: %s"), optarg);
|
||||
+ break;
|
||||
+
|
||||
case OPTION_SYM_BASE:
|
||||
sym_base = 0;
|
||||
if (optarg != NULL)
|
||||
@@ -5285,10 +5457,7 @@ process_file_header (Filedata * filedata
|
||||
if (filedata->section_headers != NULL
|
||||
&& header->e_phnum == PN_XNUM
|
||||
&& filedata->section_headers[0].sh_info != 0)
|
||||
- {
|
||||
- header->e_phnum = filedata->section_headers[0].sh_info;
|
||||
- printf (" (%u)", header->e_phnum);
|
||||
- }
|
||||
+ printf (" (%u)", filedata->section_headers[0].sh_info);
|
||||
putc ('\n', stdout);
|
||||
printf (_(" Size of section headers: %u (bytes)\n"),
|
||||
header->e_shentsize);
|
||||
@@ -5321,7 +5490,12 @@ process_file_header (Filedata * filedata
|
||||
{
|
||||
if (header->e_phnum == PN_XNUM
|
||||
&& filedata->section_headers[0].sh_info != 0)
|
||||
- header->e_phnum = filedata->section_headers[0].sh_info;
|
||||
+ {
|
||||
+ /* Throw away any cached read of PN_XNUM headers. */
|
||||
+ free (filedata->program_headers);
|
||||
+ filedata->program_headers = NULL;
|
||||
+ header->e_phnum = filedata->section_headers[0].sh_info;
|
||||
+ }
|
||||
if (header->e_shnum == SHN_UNDEF)
|
||||
header->e_shnum = filedata->section_headers[0].sh_size;
|
||||
if (header->e_shstrndx == (SHN_XINDEX & 0xffff))
|
||||
@@ -18873,6 +19047,8 @@ get_note_type (Filedata * filedata, unsi
|
||||
return _("func");
|
||||
case NT_GO_BUILDID:
|
||||
return _("GO BUILDID");
|
||||
+ case FDO_PACKAGING_METADATA:
|
||||
+ return _("FDO_PACKAGING_METADATA");
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -20024,6 +20200,17 @@ print_stapsdt_note (Elf_Internal_Note *p
|
||||
return false;
|
||||
}
|
||||
|
||||
+static bool
|
||||
+print_fdo_note (Elf_Internal_Note * pnote)
|
||||
+{
|
||||
+ if (pnote->descsz > 0 && pnote->type == FDO_PACKAGING_METADATA)
|
||||
+ {
|
||||
+ printf (_(" Packaging Metadata: %.*s\n"), (int) pnote->descsz, pnote->descdata);
|
||||
+ return true;
|
||||
+ }
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
static const char *
|
||||
get_ia64_vms_note_type (unsigned e_type)
|
||||
{
|
||||
@@ -20753,6 +20940,8 @@ process_note (Elf_Internal_Note * pnote
|
||||
return print_stapsdt_note (pnote);
|
||||
else if (startswith (pnote->namedata, "CORE"))
|
||||
return print_core_note (pnote);
|
||||
+ else if (startswith (pnote->namedata, "FDO"))
|
||||
+ return print_fdo_note (pnote);
|
||||
else if (((startswith (pnote->namedata, "GA")
|
||||
&& strchr ("*$!+", pnote->namedata[2]) != NULL)
|
||||
|| strchr ("*$!+", pnote->namedata[0]) != NULL)
|
||||
diff -rup binutils.orig/binutils/testsuite/binutils-all/debuginfod.exp binutils-2.37/binutils/testsuite/binutils-all/debuginfod.exp
|
||||
--- binutils.orig/binutils/testsuite/binutils-all/debuginfod.exp 2022-03-10 10:52:01.079309401 +0000
|
||||
+++ binutils-2.37/binutils/testsuite/binutils-all/debuginfod.exp 2022-03-10 10:52:09.782252717 +0000
|
||||
@@ -184,8 +184,14 @@ proc test_fetch_debugaltlink { prog prog
|
||||
}
|
||||
|
||||
if { [regexp ".*DEBUGINFOD.*" $conf_objdump] } {
|
||||
- test_fetch_debuglink $OBJDUMP "-W"
|
||||
+ test_fetch_debuglink $OBJDUMP "-W -WD"
|
||||
test_fetch_debugaltlink $OBJDUMP "-Wk"
|
||||
+
|
||||
+ set test "disabling debuginfod access"
|
||||
+ setup_xfail *-*-*
|
||||
+ test_fetch_debuglink $OBJDUMP "-W -WE"
|
||||
+ set test "debuginfod"
|
||||
+
|
||||
} else {
|
||||
untested "$test (objdump not configured with debuginfod)"
|
||||
}
|
||||
@@ -193,6 +199,12 @@ if { [regexp ".*DEBUGINFOD.*" $conf_objd
|
||||
if { [regexp ".*DEBUGINFOD.*" $conf_readelf] } {
|
||||
test_fetch_debuglink $READELF "-w"
|
||||
test_fetch_debugaltlink $READELF "-wk"
|
||||
+
|
||||
+ set test "disabling debuginfod access"
|
||||
+ setup_xfail *-*-*
|
||||
+ test_fetch_debuglink $READELF "-w -wE"
|
||||
+ set test "debuginfod"
|
||||
+
|
||||
} else {
|
||||
untested "$test (readelf not configured with debuginfod)"
|
||||
}
|
|
@ -0,0 +1,201 @@
|
|||
diff -rup binutils.orig/gas/dwarf2dbg.c binutils-2.37/gas/dwarf2dbg.c
|
||||
--- binutils.orig/gas/dwarf2dbg.c 2021-08-09 17:28:17.743318315 +0100
|
||||
+++ binutils-2.37/gas/dwarf2dbg.c 2021-08-09 17:28:27.043264112 +0100
|
||||
@@ -620,7 +620,22 @@ get_directory_table_entry (const char *d
|
||||
if (can_use_zero)
|
||||
{
|
||||
if (dirs == NULL || dirs[0] == NULL)
|
||||
- d = 0;
|
||||
+ {
|
||||
+ const char * pwd = getpwd ();
|
||||
+
|
||||
+ if (dwarf_level >= 5 && strcmp (dirname, pwd) != 0)
|
||||
+ {
|
||||
+ /* In DWARF-5 the 0 entry in the directory table is expected to be
|
||||
+ the same as the DW_AT_comp_dir (which is set to the current build
|
||||
+ directory). Since we are about to create a directory entry that
|
||||
+ is not the same, allocate the current directory first.
|
||||
+ FIXME: Alternatively we could generate an error message here. */
|
||||
+ (void) get_directory_table_entry (pwd, strlen (pwd), true);
|
||||
+ d = 1;
|
||||
+ }
|
||||
+ else
|
||||
+ d = 0;
|
||||
+ }
|
||||
}
|
||||
else if (d == 0)
|
||||
d = 1;
|
||||
@@ -628,8 +643,8 @@ get_directory_table_entry (const char *d
|
||||
if (d >= dirs_allocated)
|
||||
{
|
||||
unsigned int old = dirs_allocated;
|
||||
-
|
||||
- dirs_allocated = d + 32;
|
||||
+#define DIR_TABLE_INCREMENT 32
|
||||
+ dirs_allocated = d + DIR_TABLE_INCREMENT;
|
||||
dirs = XRESIZEVEC (char *, dirs, dirs_allocated);
|
||||
memset (dirs + old, 0, (dirs_allocated - old) * sizeof (char *));
|
||||
}
|
||||
@@ -779,7 +794,7 @@ allocate_filename_to_slot (const char *d
|
||||
{
|
||||
if (dirs == NULL)
|
||||
{
|
||||
- dirs_allocated = files[num].dir + 32;
|
||||
+ dirs_allocated = files[num].dir + DIR_TABLE_INCREMENT;
|
||||
dirs = XCNEWVEC (char *, dirs_allocated);
|
||||
}
|
||||
|
||||
@@ -807,7 +822,7 @@ allocate_filename_to_slot (const char *d
|
||||
{
|
||||
if (dirs == NULL)
|
||||
{
|
||||
- dirs_allocated = files[num].dir + 32;
|
||||
+ dirs_allocated = files[num].dir + DIR_TABLE_INCREMENT;
|
||||
dirs = XCNEWVEC (char *, dirs_allocated);
|
||||
}
|
||||
|
||||
@@ -840,7 +855,7 @@ allocate_filename_to_slot (const char *d
|
||||
dirlen = strlen (dirname);
|
||||
file = filename;
|
||||
}
|
||||
-
|
||||
+
|
||||
d = get_directory_table_entry (dirname, dirlen, num == 0);
|
||||
i = num;
|
||||
|
||||
@@ -2082,7 +2097,12 @@ out_dir_and_file_list (segT line_seg, in
|
||||
Otherwise use pwd as main file directory. */
|
||||
if (dirs_in_use > 0 && dirs != NULL && dirs[0] != NULL)
|
||||
dir = remap_debug_filename (dirs[0]);
|
||||
- else if (dirs_in_use > 1 && dirs != NULL && dirs[1] != NULL)
|
||||
+ else if (dirs_in_use > 1
|
||||
+ && dirs != NULL
|
||||
+ && dirs[1] != NULL
|
||||
+ /* DWARF-5 directory tables expect dir[0] to be the same as
|
||||
+ DW_AT_comp_dir, which is the same as pwd. */
|
||||
+ && dwarf_level < 5)
|
||||
dir = remap_debug_filename (dirs[1]);
|
||||
else
|
||||
dir = remap_debug_filename (getpwd ());
|
||||
@@ -2185,8 +2205,8 @@ out_dir_and_file_list (segT line_seg, in
|
||||
uses slot zero, but that is only set explicitly using a
|
||||
.file 0 directive. If that isn't used, but file 1 is,
|
||||
then use that as main file name. */
|
||||
- if (DWARF2_LINE_VERSION >= 5 && i == 0 && files_in_use >= 1)
|
||||
- files[0].filename = files[1].filename;
|
||||
+ if (DWARF2_LINE_VERSION >= 5 && i == 0 && files_in_use >= 1 && files[0].filename == NULL)
|
||||
+ files[0].filename = files[1].filename;
|
||||
else
|
||||
files[i].filename = "";
|
||||
if (DWARF2_LINE_VERSION < 5 || i != 0)
|
||||
Only in binutils-2.37/gas/testsuite/gas/elf: dwarf-5-dir0.d
|
||||
Only in binutils-2.37/gas/testsuite/gas/elf: dwarf-5-dir0.s
|
||||
diff -rup binutils.orig/gas/testsuite/gas/elf/dwarf-5-file0.d binutils-2.37/gas/testsuite/gas/elf/dwarf-5-file0.d
|
||||
--- binutils.orig/gas/testsuite/gas/elf/dwarf-5-file0.d 2021-08-09 17:28:17.817317884 +0100
|
||||
+++ binutils-2.37/gas/testsuite/gas/elf/dwarf-5-file0.d 2021-08-09 17:28:27.043264112 +0100
|
||||
@@ -3,17 +3,18 @@
|
||||
#readelf: -wl
|
||||
|
||||
#...
|
||||
- The Directory Table \(offset 0x.*, lines 3, columns 1\):
|
||||
+ The Directory Table \(offset 0x.*, lines 4, columns 1\):
|
||||
Entry Name
|
||||
- 0 \(indirect line string, offset: 0x.*\): master directory
|
||||
- 1 \(indirect line string, offset: 0x.*\): secondary directory
|
||||
- 2 \(indirect line string, offset: 0x.*\): /tmp
|
||||
+#...
|
||||
+ 1 \(indirect line string, offset: 0x.*\): master directory
|
||||
+ 2 \(indirect line string, offset: 0x.*\): secondary directory
|
||||
+ 3 \(indirect line string, offset: 0x.*\): /tmp
|
||||
|
||||
The File Name Table \(offset 0x.*, lines 3, columns 3\):
|
||||
Entry Dir MD5 Name
|
||||
- 0 0 0x0 \(indirect line string, offset: 0x.*\): master source file
|
||||
- 1 1 0x0 \(indirect line string, offset: 0x.*\): secondary source file
|
||||
- 2 2 0x95828e8bc4f7404dbf7526fb7bd0f192 \(indirect line string, offset: 0x.*\): foo.c
|
||||
+ 0 1 0x0 \(indirect line string, offset: 0x.*\): master source file
|
||||
+ 1 2 0x0 \(indirect line string, offset: 0x.*\): secondary source file
|
||||
+ 2 3 0x95828e8bc4f7404dbf7526fb7bd0f192 \(indirect line string, offset: 0x.*\): foo.c
|
||||
#pass
|
||||
|
||||
|
||||
diff -rup binutils.orig/gas/testsuite/gas/elf/elf.exp binutils-2.37/gas/testsuite/gas/elf/elf.exp
|
||||
--- binutils.orig/gas/testsuite/gas/elf/elf.exp 2021-08-09 17:28:17.817317884 +0100
|
||||
+++ binutils-2.37/gas/testsuite/gas/elf/elf.exp 2021-08-09 17:28:27.044264106 +0100
|
||||
@@ -297,6 +297,7 @@ if { [is_elf_format] } then {
|
||||
run_dump_test "dwarf2-19" $dump_opts
|
||||
run_dump_test "dwarf2-20" $dump_opts
|
||||
run_dump_test "dwarf-5-file0" $dump_opts
|
||||
+ run_dump_test "dwarf-5-dir0" $dump_opts
|
||||
run_dump_test "dwarf-4-cu" $dump_opts
|
||||
run_dump_test "dwarf-5-cu" $dump_opts
|
||||
run_dump_test "dwarf-5-nop-for-line-table" $dump_opts
|
||||
diff -rup binutils.orig/gas/testsuite/gas/i386/dwarf5-line-1.d binutils-2.37/gas/testsuite/gas/i386/dwarf5-line-1.d
|
||||
--- binutils.orig/gas/testsuite/gas/i386/dwarf5-line-1.d 2021-08-09 17:28:17.782318088 +0100
|
||||
+++ binutils-2.37/gas/testsuite/gas/i386/dwarf5-line-1.d 2021-08-09 17:28:27.044264106 +0100
|
||||
@@ -33,7 +33,7 @@ Raw dump of debug contents of section \.
|
||||
|
||||
The Directory Table \(offset 0x.*, lines 2, columns 1\):
|
||||
Entry Name
|
||||
- 0 \(indirect line string, offset: 0x.*\): .*/gas/testsuite/gas/i386
|
||||
+ 0 \(indirect line string, offset: 0x.*\): .*/gas/testsuite
|
||||
1 \(indirect line string, offset: 0x.*\): .*/gas/testsuite/gas/i386
|
||||
|
||||
The File Name Table \(offset 0x.*, lines 2, columns 3\):
|
||||
diff -rup binutils.orig/gas/testsuite/gas/i386/dwarf5-line-2.d binutils-2.37/gas/testsuite/gas/i386/dwarf5-line-2.d
|
||||
--- binutils.orig/gas/testsuite/gas/i386/dwarf5-line-2.d 2021-08-09 17:28:17.785318070 +0100
|
||||
+++ binutils-2.37/gas/testsuite/gas/i386/dwarf5-line-2.d 2021-08-09 17:28:27.044264106 +0100
|
||||
@@ -33,7 +33,7 @@ Raw dump of debug contents of section \.
|
||||
|
||||
The Directory Table \(offset 0x.*, lines 2, columns 1\):
|
||||
Entry Name
|
||||
- 0 \(indirect line string, offset: 0x.*\): .*/gas/testsuite/gas/i386
|
||||
+ 0 \(indirect line string, offset: 0x.*\): .*/gas/testsuite
|
||||
1 \(indirect line string, offset: 0x.*\): .*/gas/testsuite/gas/i386
|
||||
|
||||
The File Name Table \(offset 0x.*, lines 1, columns 3\):
|
||||
--- /dev/null 2021-08-09 07:51:33.817495606 +0100
|
||||
+++ binutils-2.37/gas/testsuite/gas/elf/dwarf-5-dir0.s 2021-08-09 17:28:54.787102415 +0100
|
||||
@@ -0,0 +1,19 @@
|
||||
+ .section .debug_info,"",%progbits
|
||||
+ .4byte 0x8a
|
||||
+ .2byte 0x2
|
||||
+ .4byte .Ldebug_abbrev0
|
||||
+ .byte 0x4
|
||||
+ .uleb128 0x1
|
||||
+
|
||||
+ .file 0 "../not-the-build-directory/master-source-file.c"
|
||||
+ .line 1
|
||||
+ .text
|
||||
+ .octa 0x12345678901234567890123456789012
|
||||
+
|
||||
+ .file 1 "secondary directory/secondary source file"
|
||||
+ .line 2
|
||||
+ .word 2
|
||||
+
|
||||
+ .file 2 "/tmp" "foo.c" md5 0x95828e8bc4f7404dbf7526fb7bd0f192
|
||||
+ .line 5
|
||||
+ .word 6
|
||||
--- /dev/null 2021-08-09 07:51:33.817495606 +0100
|
||||
+++ binutils-2.37/gas/testsuite/gas/elf/dwarf-5-dir0.d 2021-08-09 17:28:54.787102415 +0100
|
||||
@@ -0,0 +1,20 @@
|
||||
+#as: --gdwarf-5
|
||||
+#name: DWARF5 dir[0]
|
||||
+#readelf: -wl
|
||||
+
|
||||
+#...
|
||||
+ The Directory Table \(offset 0x.*, lines 4, columns 1\):
|
||||
+ Entry Name
|
||||
+ 0 \(indirect line string, offset: 0x0\): .*/gas/testsuite
|
||||
+ 1 \(indirect line string, offset: 0x.*\): ../not-the-build-directory
|
||||
+ 2 \(indirect line string, offset: 0x.*\): secondary directory
|
||||
+ 3 \(indirect line string, offset: 0x.*\): /tmp
|
||||
+
|
||||
+ The File Name Table \(offset 0x.*, lines 3, columns 3\):
|
||||
+ Entry Dir MD5 Name
|
||||
+ 0 1 0x0 \(indirect line string, offset: 0x.*\): master-source-file.c
|
||||
+ 1 2 0x0 \(indirect line string, offset: 0x.*\): secondary source file
|
||||
+ 2 3 0x95828e8bc4f7404dbf7526fb7bd0f192 \(indirect line string, offset: 0x.*\): foo.c
|
||||
+#pass
|
||||
+
|
||||
+
|
|
@ -0,0 +1,19 @@
|
|||
--- binutils.orig/bfd/linker.c 2021-10-13 13:21:03.125429867 +0100
|
||||
+++ binutils-2.37/bfd/linker.c 2021-10-13 13:33:31.328554905 +0100
|
||||
@@ -1420,6 +1420,7 @@ _bfd_generic_link_add_one_symbol (struct
|
||||
{
|
||||
row = COMMON_ROW;
|
||||
if (!bfd_link_relocatable (info)
|
||||
+ && name != NULL
|
||||
&& name[0] == '_'
|
||||
&& name[1] == '_'
|
||||
&& strcmp (name + (name[2] == '_'), "__gnu_lto_slim") == 0)
|
||||
@@ -1682,7 +1683,7 @@ _bfd_generic_link_add_one_symbol (struct
|
||||
cycle = true;
|
||||
break;
|
||||
}
|
||||
- if (strcmp (h->u.i.link->root.string, string) == 0)
|
||||
+ if (string != NULL && strcmp (h->u.i.link->root.string, string) == 0)
|
||||
break;
|
||||
/* Fall through. */
|
||||
case MDEF:
|
|
@ -5,8 +5,8 @@ diff -rup binutils.orig/bfd/Makefile.am binutils-2.32/bfd/Makefile.am
|
|||
bfdincludedir = @bfdincludedir@
|
||||
bfdlib_LTLIBRARIES = libbfd.la
|
||||
bfdinclude_HEADERS = $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
|
||||
- bfd_stdint.h $(INCDIR)/diagnostics.h $(INCDIR)/bfdlink.h
|
||||
+ bfd_stdint.h $(INCDIR)/diagnostics.h $(INCDIR)/bfdlink.h $(INCDIR)/demangle.h
|
||||
- $(INCDIR)/diagnostics.h $(INCDIR)/bfdlink.h
|
||||
+ $(INCDIR)/diagnostics.h $(INCDIR)/bfdlink.h $(INCDIR)/demangle.h
|
||||
else !INSTALL_LIBBFD
|
||||
# Empty these so that the respective installation directories will not be created.
|
||||
bfdlibdir =
|
||||
|
@ -16,7 +16,7 @@ diff -rup binutils.orig/bfd/Makefile.in binutils-2.32/bfd/Makefile.in
|
|||
@@ -249,7 +249,7 @@ am__can_run_installinfo = \
|
||||
esac
|
||||
am__bfdinclude_HEADERS_DIST = $(INCDIR)/plugin-api.h bfd.h \
|
||||
$(INCDIR)/ansidecl.h $(INCDIR)/symcat.h bfd_stdint.h \
|
||||
$(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
|
||||
- $(INCDIR)/diagnostics.h $(INCDIR)/bfdlink.h
|
||||
+ $(INCDIR)/diagnostics.h $(INCDIR)/bfdlink.h $(INCDIR)/demangle.h
|
||||
HEADERS = $(bfdinclude_HEADERS)
|
||||
|
@ -26,8 +26,8 @@ diff -rup binutils.orig/bfd/Makefile.in binutils-2.32/bfd/Makefile.in
|
|||
@INSTALL_LIBBFD_FALSE@bfdinclude_HEADERS = $(am__append_2)
|
||||
@INSTALL_LIBBFD_TRUE@bfdinclude_HEADERS = $(BFD_H) \
|
||||
@INSTALL_LIBBFD_TRUE@ $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
|
||||
-@INSTALL_LIBBFD_TRUE@ bfd_stdint.h $(INCDIR)/diagnostics.h \
|
||||
+@INSTALL_LIBBFD_TRUE@ bfd_stdint.h $(INCDIR)/diagnostics.h $(INCDIR)/demangle.h \
|
||||
-@INSTALL_LIBBFD_TRUE@ $(INCDIR)/diagnostics.h \
|
||||
+@INSTALL_LIBBFD_TRUE@ $(INCDIR)/diagnostics.h $(INCDIR)/demangle.h \
|
||||
@INSTALL_LIBBFD_TRUE@ $(INCDIR)/bfdlink.h $(am__append_2)
|
||||
@INSTALL_LIBBFD_FALSE@rpath_bfdlibdir = @bfdlibdir@
|
||||
@INSTALL_LIBBFD_FALSE@noinst_LTLIBRARIES = libbfd.la
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
--- binutils.orig/binutils/readelf.c 2018-01-22 15:48:10.450701702 +0000
|
||||
+++ binutils-2.30.0/binutils/readelf.c 2018-01-22 15:55:26.739588657 +0000
|
||||
@@ -19019,75 +19019,85 @@ process_file (char * file_name)
|
||||
Filedata * filedata = NULL;
|
||||
--- binutils.orig/binutils/readelf.c 2021-07-19 12:39:14.206556025 +0100
|
||||
+++ binutils-2.37/binutils/readelf.c 2021-07-19 12:44:37.712728732 +0100
|
||||
@@ -21873,45 +21873,52 @@ process_file (char * file_name)
|
||||
struct stat statbuf;
|
||||
char armag[SARMAG];
|
||||
- bfd_boolean ret = TRUE;
|
||||
+ bfd_boolean ret = FALSE;
|
||||
bool ret = true;
|
||||
+ char * name;
|
||||
+ char * saved_program_name;
|
||||
+
|
||||
|
@ -25,7 +23,7 @@
|
|||
else
|
||||
- error (_("Could not locate '%s'. System error message: %s\n"),
|
||||
- file_name, strerror (errno));
|
||||
- return FALSE;
|
||||
- return false;
|
||||
+ error (_("Could not locate file. System error message: %s\n"),
|
||||
+ strerror (errno));
|
||||
+ goto done;
|
||||
|
@ -34,7 +32,7 @@
|
|||
if (! S_ISREG (statbuf.st_mode))
|
||||
{
|
||||
- error (_("'%s' is not an ordinary file\n"), file_name);
|
||||
- return FALSE;
|
||||
- return false;
|
||||
+ error (_("Not an ordinary file\n"));
|
||||
+ goto done;
|
||||
}
|
||||
|
@ -43,7 +41,7 @@
|
|||
if (filedata == NULL)
|
||||
{
|
||||
error (_("Out of memory allocating file data structure\n"));
|
||||
- return FALSE;
|
||||
- return false;
|
||||
+ goto done;
|
||||
}
|
||||
|
||||
|
@ -53,7 +51,7 @@
|
|||
{
|
||||
- error (_("Input file '%s' is not readable.\n"), file_name);
|
||||
- free (filedata);
|
||||
- return FALSE;
|
||||
- return false;
|
||||
+ error (_("Not readable\n"));
|
||||
+ goto done;
|
||||
}
|
||||
|
@ -63,62 +61,74 @@
|
|||
- error (_("%s: Failed to read file's magic number\n"), file_name);
|
||||
- fclose (filedata->handle);
|
||||
- free (filedata);
|
||||
- return FALSE;
|
||||
- }
|
||||
-
|
||||
- filedata->file_size = (bfd_size_type) statbuf.st_size;
|
||||
-
|
||||
- if (memcmp (armag, ARMAG, SARMAG) == 0)
|
||||
- {
|
||||
- if (! process_archive (filedata, FALSE))
|
||||
- ret = FALSE;
|
||||
- }
|
||||
- else if (memcmp (armag, ARMAGT, SARMAG) == 0)
|
||||
- {
|
||||
- if ( ! process_archive (filedata, TRUE))
|
||||
- ret = FALSE;
|
||||
- return false;
|
||||
+ error (_("Failed to read file's magic number\n"));
|
||||
+ goto done;
|
||||
}
|
||||
|
||||
filedata->file_size = (bfd_size_type) statbuf.st_size;
|
||||
@@ -21919,33 +21926,39 @@ process_file (char * file_name)
|
||||
|
||||
if (memcmp (armag, ARMAG, SARMAG) == 0)
|
||||
{
|
||||
- if (! process_archive (filedata, false))
|
||||
- ret = false;
|
||||
+ if (process_archive (filedata, false))
|
||||
+ ret = true;
|
||||
}
|
||||
else if (memcmp (armag, ARMAGT, SARMAG) == 0)
|
||||
{
|
||||
- if ( ! process_archive (filedata, true))
|
||||
- ret = false;
|
||||
+ if (process_archive (filedata, true))
|
||||
+ ret = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
- if (do_archive_index)
|
||||
if (do_archive_index && !check_all)
|
||||
- error (_("File %s is not an archive so its index cannot be displayed.\n"),
|
||||
- file_name);
|
||||
+ filedata->file_size = (bfd_size_type) statbuf.st_size;
|
||||
+ error (_("Not an archive so its index cannot be displayed.\n"));
|
||||
|
||||
rewind (filedata->handle);
|
||||
filedata->archive_file_size = filedata->archive_file_offset = 0;
|
||||
|
||||
- rewind (filedata->handle);
|
||||
- archive_file_size = archive_file_offset = 0;
|
||||
-
|
||||
- if (! process_object (filedata))
|
||||
- ret = FALSE;
|
||||
+ if (memcmp (armag, ARMAG, SARMAG) == 0)
|
||||
+ {
|
||||
+ if (process_archive (filedata, FALSE))
|
||||
+ ret = TRUE;
|
||||
+ }
|
||||
+ else if (memcmp (armag, ARMAGT, SARMAG) == 0)
|
||||
+ {
|
||||
+ if (process_archive (filedata, TRUE))
|
||||
+ ret = TRUE;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if (do_archive_index)
|
||||
+ error (_("Not an archive so its index cannot be displayed.\n"));
|
||||
+
|
||||
+ rewind (filedata->handle);
|
||||
+ archive_file_size = archive_file_offset = 0;
|
||||
+
|
||||
+ if (process_object (filedata))
|
||||
+ ret = TRUE;
|
||||
+ }
|
||||
- ret = false;
|
||||
+ if (process_object (filedata))
|
||||
+ ret = true;
|
||||
}
|
||||
|
||||
fclose (filedata->handle);
|
||||
- fclose (filedata->handle);
|
||||
- free (filedata->section_headers);
|
||||
- free (filedata->program_headers);
|
||||
- free (filedata->string_table);
|
||||
- free (filedata->dump.dump_sects);
|
||||
- free (filedata);
|
||||
+ done:
|
||||
free (filedata);
|
||||
+ if (filedata)
|
||||
+ {
|
||||
+ if (filedata->handle != NULL)
|
||||
+ fclose (filedata->handle);
|
||||
+ free (filedata->section_headers);
|
||||
+ free (filedata->program_headers);
|
||||
+ free (filedata->string_table);
|
||||
+ free (filedata->dump.dump_sects);
|
||||
+ free (filedata);
|
||||
+ }
|
||||
+ free (program_name);
|
||||
+ program_name = saved_program_name;
|
||||
|
||||
return ret;
|
||||
}
|
||||
free (ba_cache.strtab);
|
||||
ba_cache.strtab = NULL;
|
||||
--- binutils.orig/binutils/readelf.c 2021-08-10 10:15:22.088016072 +0100
|
||||
+++ binutils-2.37/binutils/readelf.c 2021-08-10 10:15:55.567907891 +0100
|
||||
@@ -21884,7 +21884,7 @@ process_file (char * file_name)
|
||||
Filedata * filedata = NULL;
|
||||
struct stat statbuf;
|
||||
char armag[SARMAG];
|
||||
- bool ret = true;
|
||||
+ bool ret = false;
|
||||
char * name;
|
||||
char * saved_program_name;
|
||||
|
|
@ -223,35 +223,6 @@ diff -rup binutils-2.32.orig/ld/testsuite/ld-srec/srec.exp binutils-2.32/ld/test
|
|||
proc srec_off { l } {
|
||||
if [string match "S1*" $l] {
|
||||
return 8
|
||||
diff -rup binutils-2.32.orig/ld/testsuite/ld-x86-64/x86-64.exp binutils-2.32/ld/testsuite/ld-x86-64/x86-64.exp
|
||||
--- binutils-2.32.orig/ld/testsuite/ld-x86-64/x86-64.exp 2019-02-15 13:33:22.030626874 +0000
|
||||
+++ binutils-2.32/ld/testsuite/ld-x86-64/x86-64.exp 2019-02-15 13:57:34.295106041 +0000
|
||||
@@ -1275,25 +1275,6 @@ if { [isnative] && [which $CC] != 0 } {
|
||||
"$NOPIE_CFLAGS" \
|
||||
] \
|
||||
]
|
||||
- } else {
|
||||
- run_cc_link_tests [list \
|
||||
- [list \
|
||||
- "Build pr22001-1b" \
|
||||
- "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \
|
||||
- "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
|
||||
- { pr22001-1c.c } \
|
||||
- {{error_output "pr22001-1b.err"}} \
|
||||
- "pr22001-1b" \
|
||||
- ] \
|
||||
- [list \
|
||||
- "Build pr21997-1b" \
|
||||
- "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr21997-1.so" \
|
||||
- "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
|
||||
- { pr21997-1c.c } \
|
||||
- {{error_output "pr21997-1b.err"}} \
|
||||
- "pr21997-1b" \
|
||||
- ] \
|
||||
- ]
|
||||
}
|
||||
|
||||
run_ld_link_exec_tests [list \
|
||||
diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-10.d binutils-2.32/ld/testsuite/ld-plugin/plugin-10.d
|
||||
--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-10.d 2019-02-15 14:10:59.038709514 +0000
|
||||
+++ binutils-2.32/ld/testsuite/ld-plugin/plugin-10.d 2019-02-15 14:13:53.532300721 +0000
|
||||
|
@ -326,3 +297,34 @@ diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-8.d binutils-2.32/ld/
|
|||
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
|
||||
#...
|
||||
hook called: cleanup.
|
||||
diff -rup binutils.orig/ld/testsuite/ld-elfvers/vers24.rd binutils-2.30/ld/testsuite/ld-elfvers/vers24.rd
|
||||
--- binutils.orig/ld/testsuite/ld-elfvers/vers24.rd 2018-09-05 09:45:44.013108697 +0100
|
||||
+++ binutils-2.30/ld/testsuite/ld-elfvers/vers24.rd 2018-09-05 12:06:17.287425232 +0100
|
||||
@@ -7,9 +7,9 @@ Symbol table '.dynsym' contains [0-9]+ e
|
||||
# And ensure the dynamic symbol table contains at least x@VERS.0
|
||||
# and foo@@VERS.0 symbols
|
||||
#...
|
||||
- +[0-9]+: [0-9a-f]+ +(4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ _?x|[0-9]+ +FUNC +GLOBAL +DEFAULT .* [0-9]+ _?foo@)@VERS\.0
|
||||
+ +[0-9]+: [0-9a-f]+ +(4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ _?x|[0-9]+ +FUNC +GLOBAL +DEFAULT .* [0-9]+ _?foo@)@VERS\.0.*
|
||||
#...
|
||||
- +[0-9]+: [0-9a-f]+ +(4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ _?x|[0-9]+ +FUNC +GLOBAL +DEFAULT .* [0-9]+ _?foo@)@VERS\.0
|
||||
+ +[0-9]+: [0-9a-f]+ +(4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ _?x|[0-9]+ +FUNC +GLOBAL +DEFAULT .* [0-9]+ _?foo@)@VERS\.0.*
|
||||
#...
|
||||
Symbol table '.symtab' contains [0-9]+ entries:
|
||||
#pass
|
||||
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin.exp binutils-2.30/ld/testsuite/ld-plugin/plugin.exp
|
||||
--- binutils.orig/ld/testsuite/ld-plugin/plugin.exp 2018-09-05 09:45:44.023108605 +0100
|
||||
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin.exp 2018-09-05 11:18:53.997202105 +0100
|
||||
@@ -118,6 +118,12 @@ if { $can_compile && !$failed_compile }
|
||||
}
|
||||
}
|
||||
|
||||
+# I do not know why, but the underscore prefix test is going
|
||||
+# wrong on ppc64le targets. So override it here.
|
||||
+if { [istarget powerpc*-*-linux*] || [istarget x86_64*-*-linux*] } {
|
||||
+ set _ ""
|
||||
+}
|
||||
+
|
||||
set testobjfiles "tmpdir/main.o tmpdir/func.o tmpdir/text.o"
|
||||
set testobjfiles_notext "tmpdir/main.o tmpdir/func.o"
|
||||
set testsrcfiles "tmpdir/main.o $srcdir/$subdir/func.c tmpdir/text.o"
|
||||
|
|
|
@ -0,0 +1,323 @@
|
|||
commit 58f3b6a3495074da39ba6e19935e4401dcbacf88
|
||||
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||
Date: Thu Sep 9 09:14:42 2021 -0700
|
||||
|
||||
gas: Use the directory name in .file 0
|
||||
|
||||
DWARF5 allows .file 0 to take an optional directory name. Set the entry
|
||||
0 of the directory table to the directory name in .file 0.
|
||||
|
||||
PR gas/28266
|
||||
* dwarf2dbg.c (get_directory_table_entry): Add an argument for
|
||||
the directory name in .file 0 and use it, instead of PWD.
|
||||
(allocate_filenum): Pass NULL to get_directory_table_entry.
|
||||
(allocate_filename_to_slot): Pass the incoming dirname to
|
||||
get_directory_table_entry.
|
||||
* testsuite/gas/elf/dwarf-5-file0-2.d: New file.
|
||||
* testsuite/gas/elf/dwarf-5-file0-2.s: Likewise.
|
||||
* testsuite/gas/elf/elf.exp: Run dwarf-5-file0-2.
|
||||
|
||||
diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c
|
||||
index 8f5248534ad..9e3437b8948 100644
|
||||
--- a/gas/dwarf2dbg.c
|
||||
+++ b/gas/dwarf2dbg.c
|
||||
@@ -592,6 +592,7 @@ get_basename (const char * pathname)
|
||||
|
||||
static unsigned int
|
||||
get_directory_table_entry (const char *dirname,
|
||||
+ const char *file0_dirname,
|
||||
size_t dirlen,
|
||||
bool can_use_zero)
|
||||
{
|
||||
@@ -621,7 +622,7 @@ get_directory_table_entry (const char *dirname,
|
||||
{
|
||||
if (dirs == NULL || dirs[0] == NULL)
|
||||
{
|
||||
- const char * pwd = getpwd ();
|
||||
+ const char * pwd = file0_dirname ? file0_dirname : getpwd ();
|
||||
|
||||
if (dwarf_level >= 5 && strcmp (dirname, pwd) != 0)
|
||||
{
|
||||
@@ -630,7 +631,8 @@ get_directory_table_entry (const char *dirname,
|
||||
directory). Since we are about to create a directory entry that
|
||||
is not the same, allocate the current directory first.
|
||||
FIXME: Alternatively we could generate an error message here. */
|
||||
- (void) get_directory_table_entry (pwd, strlen (pwd), true);
|
||||
+ (void) get_directory_table_entry (pwd, NULL, strlen (pwd),
|
||||
+ true);
|
||||
d = 1;
|
||||
}
|
||||
else
|
||||
@@ -726,7 +728,7 @@ allocate_filenum (const char * pathname)
|
||||
file = get_basename (pathname);
|
||||
dir_len = file - pathname;
|
||||
|
||||
- dir = get_directory_table_entry (pathname, dir_len, false);
|
||||
+ dir = get_directory_table_entry (pathname, NULL, dir_len, false);
|
||||
|
||||
/* Do not use slot-0. That is specifically reserved for use by
|
||||
the '.file 0 "name"' directive. */
|
||||
@@ -766,6 +768,7 @@ allocate_filename_to_slot (const char *dirname,
|
||||
const char *file;
|
||||
size_t dirlen;
|
||||
unsigned int i, d;
|
||||
+ const char *file0_dirname = dirname;
|
||||
|
||||
/* Short circuit the common case of adding the same pathname
|
||||
as last time. */
|
||||
@@ -856,7 +859,8 @@ allocate_filename_to_slot (const char *dirname,
|
||||
file = filename;
|
||||
}
|
||||
|
||||
- d = get_directory_table_entry (dirname, dirlen, num == 0);
|
||||
+ d = get_directory_table_entry (dirname, file0_dirname, dirlen,
|
||||
+ num == 0);
|
||||
i = num;
|
||||
|
||||
if (! assign_file_to_slot (i, file, d))
|
||||
diff --git a/gas/testsuite/gas/elf/dwarf-5-file0-2.d b/gas/testsuite/gas/elf/dwarf-5-file0-2.d
|
||||
new file mode 100644
|
||||
index 00000000000..4b3ed29f4c9
|
||||
--- /dev/null
|
||||
+++ b/gas/testsuite/gas/elf/dwarf-5-file0-2.d
|
||||
@@ -0,0 +1,15 @@
|
||||
+#as: --gdwarf-5
|
||||
+#name: DWARF5 .file 0 dir file
|
||||
+#readelf: -wl
|
||||
+
|
||||
+#...
|
||||
+ The Directory Table \(offset 0x.*, lines 1, columns 1\):
|
||||
+ Entry Name
|
||||
+#...
|
||||
+ 0 \(indirect line string, offset: 0x.*\): /example
|
||||
+
|
||||
+ The File Name Table \(offset 0x.*, lines 2, columns 2\):
|
||||
+ Entry Dir Name
|
||||
+ 0 0 \(indirect line string, offset: 0x.*\): test.c
|
||||
+ 1 0 \(indirect line string, offset: 0x.*\): test.c
|
||||
+#pass
|
||||
diff --git a/gas/testsuite/gas/elf/dwarf-5-file0-2.s b/gas/testsuite/gas/elf/dwarf-5-file0-2.s
|
||||
new file mode 100644
|
||||
index 00000000000..135a03bf493
|
||||
--- /dev/null
|
||||
+++ b/gas/testsuite/gas/elf/dwarf-5-file0-2.s
|
||||
@@ -0,0 +1,111 @@
|
||||
+ .file "test.c"
|
||||
+ .text
|
||||
+.Ltext0:
|
||||
+ .file 0 "/example" "test.c"
|
||||
+ .globl x
|
||||
+ .section .bss
|
||||
+ .balign 4
|
||||
+ .type x, @object
|
||||
+ .size x, 4
|
||||
+x:
|
||||
+ .zero 4
|
||||
+ .text
|
||||
+.Letext0:
|
||||
+ .file 1 "test.c"
|
||||
+ .section .debug_info,"",%progbits
|
||||
+.Ldebug_info0:
|
||||
+ .long 0x32
|
||||
+ .2byte 0x5
|
||||
+ .byte 0x1
|
||||
+ .byte 0x4
|
||||
+ .long .Ldebug_abbrev0
|
||||
+ .uleb128 0x1
|
||||
+ .long .LASF2
|
||||
+ .byte 0x1d
|
||||
+ .long .LASF0
|
||||
+ .long .LASF1
|
||||
+ .long .Ldebug_line0
|
||||
+ .uleb128 0x2
|
||||
+ .string "x"
|
||||
+ .byte 0x1
|
||||
+ .byte 0x1
|
||||
+ .byte 0x5
|
||||
+ .long 0x2e
|
||||
+ .uleb128 0x5
|
||||
+ .byte 0x3
|
||||
+ .long x
|
||||
+ .uleb128 0x3
|
||||
+ .byte 0x4
|
||||
+ .byte 0x5
|
||||
+ .string "int"
|
||||
+ .byte 0
|
||||
+ .section .debug_abbrev,"",%progbits
|
||||
+.Ldebug_abbrev0:
|
||||
+ .uleb128 0x1
|
||||
+ .uleb128 0x11
|
||||
+ .byte 0x1
|
||||
+ .uleb128 0x25
|
||||
+ .uleb128 0xe
|
||||
+ .uleb128 0x13
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0x3
|
||||
+ .uleb128 0x1f
|
||||
+ .uleb128 0x1b
|
||||
+ .uleb128 0x1f
|
||||
+ .uleb128 0x10
|
||||
+ .uleb128 0x17
|
||||
+ .byte 0
|
||||
+ .byte 0
|
||||
+ .uleb128 0x2
|
||||
+ .uleb128 0x34
|
||||
+ .byte 0
|
||||
+ .uleb128 0x3
|
||||
+ .uleb128 0x8
|
||||
+ .uleb128 0x3a
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0x3b
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0x39
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0x49
|
||||
+ .uleb128 0x13
|
||||
+ .uleb128 0x3f
|
||||
+ .uleb128 0x19
|
||||
+ .uleb128 0x2
|
||||
+ .uleb128 0x18
|
||||
+ .byte 0
|
||||
+ .byte 0
|
||||
+ .uleb128 0x3
|
||||
+ .uleb128 0x24
|
||||
+ .byte 0
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0x3e
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0x3
|
||||
+ .uleb128 0x8
|
||||
+ .byte 0
|
||||
+ .byte 0
|
||||
+ .byte 0
|
||||
+ .section .debug_aranges,"",%progbits
|
||||
+ .long 0x14
|
||||
+ .2byte 0x2
|
||||
+ .long .Ldebug_info0
|
||||
+ .byte 0x4
|
||||
+ .byte 0
|
||||
+ .2byte 0
|
||||
+ .2byte 0
|
||||
+ .long 0
|
||||
+ .long 0
|
||||
+ .section .debug_line,"",%progbits
|
||||
+.Ldebug_line0:
|
||||
+ .section .debug_str,"MS",%progbits,1
|
||||
+.LASF2:
|
||||
+ .string "GNU C17 11.2.1 -g"
|
||||
+ .section .debug_line_str,"MS",%progbits,1
|
||||
+.LASF1:
|
||||
+ .string "/example"
|
||||
+.LASF0:
|
||||
+ .string "test.c"
|
||||
+ .ident "GCC: (GNU) 11.2.1"
|
||||
+ .section .note.GNU-stack,"",%progbits
|
||||
diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp
|
||||
index 18bc1db8c70..2485008d569 100644
|
||||
--- a/gas/testsuite/gas/elf/elf.exp
|
||||
+++ b/gas/testsuite/gas/elf/elf.exp
|
||||
@@ -297,6 +297,7 @@ if { [is_elf_format] } then {
|
||||
run_dump_test "dwarf2-19" $dump_opts
|
||||
run_dump_test "dwarf2-20" $dump_opts
|
||||
run_dump_test "dwarf-5-file0" $dump_opts
|
||||
+ run_dump_test "dwarf-5-file0-2" $dump_opts
|
||||
run_dump_test "dwarf-5-dir0" $dump_opts
|
||||
run_dump_test "dwarf-4-cu" $dump_opts
|
||||
run_dump_test "dwarf-5-cu" $dump_opts
|
||||
commit 9f81b99e2426d19760c20c07f8cd3ae5cd85e8df
|
||||
Author: Alan Modra <amodra@gmail.com>
|
||||
Date: Fri Sep 10 18:01:43 2021 +0930
|
||||
|
||||
Re: gas: Use the directory name in .file 0
|
||||
|
||||
PR gas/28266
|
||||
* testsuite/gas/elf/dwarf-5-file0-2.s: Use %object rather than
|
||||
@object, .4byte instead of .long, and .asciz instead of .string.
|
||||
|
||||
diff --git a/gas/testsuite/gas/elf/dwarf-5-file0-2.s b/gas/testsuite/gas/elf/dwarf-5-file0-2.s
|
||||
index 135a03bf493..bab4a16b56b 100644
|
||||
--- a/gas/testsuite/gas/elf/dwarf-5-file0-2.s
|
||||
+++ b/gas/testsuite/gas/elf/dwarf-5-file0-2.s
|
||||
@@ -5,7 +5,7 @@
|
||||
.globl x
|
||||
.section .bss
|
||||
.balign 4
|
||||
- .type x, @object
|
||||
+ .type x, %object
|
||||
.size x, 4
|
||||
x:
|
||||
.zero 4
|
||||
@@ -14,30 +14,30 @@ x:
|
||||
.file 1 "test.c"
|
||||
.section .debug_info,"",%progbits
|
||||
.Ldebug_info0:
|
||||
- .long 0x32
|
||||
+ .4byte 0x32
|
||||
.2byte 0x5
|
||||
.byte 0x1
|
||||
.byte 0x4
|
||||
- .long .Ldebug_abbrev0
|
||||
+ .4byte .Ldebug_abbrev0
|
||||
.uleb128 0x1
|
||||
- .long .LASF2
|
||||
+ .4byte .LASF2
|
||||
.byte 0x1d
|
||||
- .long .LASF0
|
||||
- .long .LASF1
|
||||
- .long .Ldebug_line0
|
||||
+ .4byte .LASF0
|
||||
+ .4byte .LASF1
|
||||
+ .4byte .Ldebug_line0
|
||||
.uleb128 0x2
|
||||
- .string "x"
|
||||
+ .asciz "x"
|
||||
.byte 0x1
|
||||
.byte 0x1
|
||||
.byte 0x5
|
||||
- .long 0x2e
|
||||
+ .4byte 0x2e
|
||||
.uleb128 0x5
|
||||
.byte 0x3
|
||||
- .long x
|
||||
+ .4byte x
|
||||
.uleb128 0x3
|
||||
.byte 0x4
|
||||
.byte 0x5
|
||||
- .string "int"
|
||||
+ .asciz "int"
|
||||
.byte 0
|
||||
.section .debug_abbrev,"",%progbits
|
||||
.Ldebug_abbrev0:
|
||||
@@ -88,24 +88,24 @@ x:
|
||||
.byte 0
|
||||
.byte 0
|
||||
.section .debug_aranges,"",%progbits
|
||||
- .long 0x14
|
||||
+ .4byte 0x14
|
||||
.2byte 0x2
|
||||
- .long .Ldebug_info0
|
||||
+ .4byte .Ldebug_info0
|
||||
.byte 0x4
|
||||
.byte 0
|
||||
.2byte 0
|
||||
.2byte 0
|
||||
- .long 0
|
||||
- .long 0
|
||||
+ .4byte 0
|
||||
+ .4byte 0
|
||||
.section .debug_line,"",%progbits
|
||||
.Ldebug_line0:
|
||||
.section .debug_str,"MS",%progbits,1
|
||||
.LASF2:
|
||||
- .string "GNU C17 11.2.1 -g"
|
||||
+ .asciz "GNU C17 11.2.1 -g"
|
||||
.section .debug_line_str,"MS",%progbits,1
|
||||
.LASF1:
|
||||
- .string "/example"
|
||||
+ .asciz "/example"
|
||||
.LASF0:
|
||||
- .string "test.c"
|
||||
+ .asciz "test.c"
|
||||
.ident "GCC: (GNU) 11.2.1"
|
||||
.section .note.GNU-stack,"",%progbits
|
|
@ -0,0 +1,384 @@
|
|||
diff -rupN binutils.orig/gas/NEWS binutils-2.37/gas/NEWS
|
||||
--- binutils.orig/gas/NEWS 2021-11-18 16:50:39.104088534 +0000
|
||||
+++ binutils-2.37/gas/NEWS 2021-11-18 16:51:16.340948280 +0000
|
||||
@@ -1,5 +1,13 @@
|
||||
-*- text -*-
|
||||
|
||||
+* The --multibyte-handling=[allow|warn|warn-sym-only] option tells the
|
||||
+ assembler what to when it encoutners multibyte characters in the input. The
|
||||
+ default is to allow them. Setting the option to "warn" will generate a
|
||||
+ warning message whenever any multibyte character is encountered. Using the
|
||||
+ option to "warn-sym-only" will make the assembler generate a warning whenever a
|
||||
+ symbol is defined containing multibyte characters. (References to undefined
|
||||
+ symbols will not generate warnings).
|
||||
+
|
||||
Changes in 2.37:
|
||||
|
||||
* arm-symbianelf support removed.
|
||||
diff -rupN binutils.orig/gas/app.c binutils-2.37/gas/app.c
|
||||
--- binutils.orig/gas/app.c 2021-11-18 16:50:39.104088534 +0000
|
||||
+++ binutils-2.37/gas/app.c 2021-11-18 16:50:42.530075630 +0000
|
||||
@@ -345,6 +345,55 @@ process_escape (int ch)
|
||||
}
|
||||
}
|
||||
|
||||
+#define MULTIBYTE_WARN_COUNT_LIMIT 10
|
||||
+static unsigned int multibyte_warn_count = 0;
|
||||
+
|
||||
+bool
|
||||
+scan_for_multibyte_characters (const unsigned char * start,
|
||||
+ const unsigned char * end,
|
||||
+ bool warn)
|
||||
+{
|
||||
+ if (end <= start)
|
||||
+ return false;
|
||||
+
|
||||
+ if (warn && multibyte_warn_count > MULTIBYTE_WARN_COUNT_LIMIT)
|
||||
+ return false;
|
||||
+
|
||||
+ bool found = false;
|
||||
+
|
||||
+ while (start < end)
|
||||
+ {
|
||||
+ unsigned char c;
|
||||
+
|
||||
+ if ((c = * start++) <= 0x7f)
|
||||
+ continue;
|
||||
+
|
||||
+ if (!warn)
|
||||
+ return true;
|
||||
+
|
||||
+ found = true;
|
||||
+
|
||||
+ const char * filename;
|
||||
+ unsigned int lineno;
|
||||
+
|
||||
+ filename = as_where (& lineno);
|
||||
+ if (filename == NULL)
|
||||
+ as_warn (_("multibyte character (%#x) encountered in input"), c);
|
||||
+ else if (lineno == 0)
|
||||
+ as_warn (_("multibyte character (%#x) encountered in %s"), c, filename);
|
||||
+ else
|
||||
+ as_warn (_("multibyte character (%#x) encountered in %s at or near line %u"), c, filename, lineno);
|
||||
+
|
||||
+ if (++ multibyte_warn_count == MULTIBYTE_WARN_COUNT_LIMIT)
|
||||
+ {
|
||||
+ as_warn (_("further multibyte character warnings suppressed"));
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return found;
|
||||
+}
|
||||
+
|
||||
/* This function is called to process input characters. The GET
|
||||
parameter is used to retrieve more input characters. GET should
|
||||
set its parameter to point to a buffer, and return the length of
|
||||
@@ -463,6 +512,11 @@ do_scrub_chars (size_t (*get) (char *, s
|
||||
return 0;
|
||||
from = input_buffer;
|
||||
fromend = from + fromlen;
|
||||
+
|
||||
+ if (multibyte_handling == multibyte_warn)
|
||||
+ (void) scan_for_multibyte_characters ((const unsigned char *) from,
|
||||
+ (const unsigned char* ) fromend,
|
||||
+ true /* Generate warnings. */);
|
||||
}
|
||||
|
||||
while (1)
|
||||
diff -rupN binutils.orig/gas/as.c binutils-2.37/gas/as.c
|
||||
--- binutils.orig/gas/as.c 2021-11-18 16:50:39.104088534 +0000
|
||||
+++ binutils-2.37/gas/as.c 2021-11-18 16:50:42.531075627 +0000
|
||||
@@ -474,7 +474,7 @@ parse_args (int * pargc, char *** pargv)
|
||||
OPTION_DEBUG_PREFIX_MAP,
|
||||
OPTION_DEFSYM,
|
||||
OPTION_LISTING_LHS_WIDTH,
|
||||
- OPTION_LISTING_LHS_WIDTH2,
|
||||
+ OPTION_LISTING_LHS_WIDTH2, /* = STD_BASE + 10 */
|
||||
OPTION_LISTING_RHS_WIDTH,
|
||||
OPTION_LISTING_CONT_LINES,
|
||||
OPTION_DEPFILE,
|
||||
@@ -484,7 +484,7 @@ parse_args (int * pargc, char *** pargv)
|
||||
OPTION_GDWARF_3,
|
||||
OPTION_GDWARF_4,
|
||||
OPTION_GDWARF_5,
|
||||
- OPTION_GDWARF_SECTIONS,
|
||||
+ OPTION_GDWARF_SECTIONS, /* = STD_BASE + 20 */
|
||||
OPTION_GDWARF_CIE_VERSION,
|
||||
OPTION_STRIP_LOCAL_ABSOLUTE,
|
||||
OPTION_TRADITIONAL_FORMAT,
|
||||
@@ -494,7 +494,7 @@ parse_args (int * pargc, char *** pargv)
|
||||
OPTION_NOEXECSTACK,
|
||||
OPTION_SIZE_CHECK,
|
||||
OPTION_ELF_STT_COMMON,
|
||||
- OPTION_ELF_BUILD_NOTES,
|
||||
+ OPTION_ELF_BUILD_NOTES, /* = STD_BASE + 30 */
|
||||
OPTION_SECTNAME_SUBST,
|
||||
OPTION_ALTERNATE,
|
||||
OPTION_AL,
|
||||
@@ -503,7 +503,8 @@ parse_args (int * pargc, char *** pargv)
|
||||
OPTION_WARN_FATAL,
|
||||
OPTION_COMPRESS_DEBUG,
|
||||
OPTION_NOCOMPRESS_DEBUG,
|
||||
- OPTION_NO_PAD_SECTIONS /* = STD_BASE + 40 */
|
||||
+ OPTION_NO_PAD_SECTIONS,
|
||||
+ OPTION_MULTIBYTE_HANDLING /* = STD_BASE + 40 */
|
||||
/* When you add options here, check that they do
|
||||
not collide with OPTION_MD_BASE. See as.h. */
|
||||
};
|
||||
@@ -581,6 +582,7 @@ parse_args (int * pargc, char *** pargv)
|
||||
,{"target-help", no_argument, NULL, OPTION_TARGET_HELP}
|
||||
,{"traditional-format", no_argument, NULL, OPTION_TRADITIONAL_FORMAT}
|
||||
,{"warn", no_argument, NULL, OPTION_WARN}
|
||||
+ ,{"multibyte-handling", required_argument, NULL, OPTION_MULTIBYTE_HANDLING}
|
||||
};
|
||||
|
||||
/* Construct the option lists from the standard list and the target
|
||||
@@ -683,6 +685,19 @@ parse_args (int * pargc, char *** pargv)
|
||||
flag_traditional_format = 1;
|
||||
break;
|
||||
|
||||
+ case OPTION_MULTIBYTE_HANDLING:
|
||||
+ if (strcmp (optarg, "allow") == 0)
|
||||
+ multibyte_handling = multibyte_allow;
|
||||
+ else if (strcmp (optarg, "warn") == 0)
|
||||
+ multibyte_handling = multibyte_warn;
|
||||
+ else if (strcmp (optarg, "warn-sym-only") == 0)
|
||||
+ multibyte_handling = multibyte_warn_syms;
|
||||
+ else if (strcmp (optarg, "warn_sym_only") == 0)
|
||||
+ multibyte_handling = multibyte_warn_syms;
|
||||
+ else
|
||||
+ as_fatal (_("unexpected argument to --multibyte-input-option: '%s'"), optarg);
|
||||
+ break;
|
||||
+
|
||||
case OPTION_VERSION:
|
||||
/* This output is intended to follow the GNU standards document. */
|
||||
printf (_("GNU assembler %s\n"), BFD_VERSION_STRING);
|
||||
diff -rupN binutils.orig/gas/as.h binutils-2.37/gas/as.h
|
||||
--- binutils.orig/gas/as.h 2021-11-18 16:50:38.834089551 +0000
|
||||
+++ binutils-2.37/gas/as.h 2021-11-18 16:50:42.531075627 +0000
|
||||
@@ -344,6 +344,14 @@ COMMON int linkrelax;
|
||||
|
||||
COMMON int do_not_pad_sections_to_alignment;
|
||||
|
||||
+enum multibyte_input_handling
|
||||
+{
|
||||
+ multibyte_allow = 0,
|
||||
+ multibyte_warn,
|
||||
+ multibyte_warn_syms
|
||||
+};
|
||||
+COMMON enum multibyte_input_handling multibyte_handling;
|
||||
+
|
||||
/* TRUE if we should produce a listing. */
|
||||
extern int listing;
|
||||
|
||||
@@ -450,6 +458,7 @@ void input_scrub_insert_file (char *);
|
||||
char * input_scrub_new_file (const char *);
|
||||
char * input_scrub_next_buffer (char **bufp);
|
||||
size_t do_scrub_chars (size_t (*get) (char *, size_t), char *, size_t);
|
||||
+bool scan_for_multibyte_characters (const unsigned char *, const unsigned char *, bool);
|
||||
int gen_to_words (LITTLENUM_TYPE *, int, long);
|
||||
int had_err (void);
|
||||
int ignore_input (void);
|
||||
diff -rupN binutils.orig/gas/doc/as.texi binutils-2.37/gas/doc/as.texi
|
||||
--- binutils.orig/gas/doc/as.texi 2021-11-18 16:50:38.838089536 +0000
|
||||
+++ binutils-2.37/gas/doc/as.texi 2021-11-18 16:50:42.535075612 +0000
|
||||
@@ -245,6 +245,7 @@ gcc(1), ld(1), and the Info entries for
|
||||
[@b{--sectname-subst}] [@b{--size-check=[error|warning]}]
|
||||
[@b{--elf-stt-common=[no|yes]}]
|
||||
[@b{--generate-missing-build-notes=[no|yes]}]
|
||||
+ [@b{--multibyte-handling=[allow|warn|warn-sym-only]}]
|
||||
[@b{--target-help}] [@var{target-options}]
|
||||
[@b{--}|@var{files} @dots{}]
|
||||
@c
|
||||
@@ -866,6 +867,18 @@ Set the maximum width of an input source
|
||||
Set the maximum number of lines printed in a listing for a single line of input
|
||||
to @var{number} + 1.
|
||||
|
||||
+@item --multibyte-handling=allow
|
||||
+@itemx --multibyte-handling=warn
|
||||
+@itemx --multibyte-handling=warn-sym-only
|
||||
+Controls how the assembler handles multibyte characters in the input. The
|
||||
+default (which can be restored by using the @option{allow} argument) is to
|
||||
+allow such characters without complaint. Using the @option{warn} argument will
|
||||
+make the assembler generate a warning message whenever any multibyte character
|
||||
+is encountered. Using the @option{warn-sym-only} argument will only cause a
|
||||
+warning to be generated when a symbol is defined with a name that contains
|
||||
+multibyte characters. (References to undefined symbols will not generate a
|
||||
+warning).
|
||||
+
|
||||
@item --no-pad-sections
|
||||
Stop the assembler for padding the ends of output sections to the alignment
|
||||
of that section. The default is to pad the sections, but this can waste space
|
||||
@@ -2942,9 +2955,11 @@ are noted in @ref{Machine Dependencies}.
|
||||
@end ifset
|
||||
No symbol may begin with a digit. Case is significant.
|
||||
There is no length limit; all characters are significant. Multibyte characters
|
||||
-are supported. Symbols are delimited by characters not in that set, or by the
|
||||
-beginning of a file (since the source program must end with a newline, the end
|
||||
-of a file is not a possible symbol delimiter). @xref{Symbols}.
|
||||
+are supported, but note that the setting of the
|
||||
+@option{--multibyte-handling} option might prevent their use. Symbols
|
||||
+are delimited by characters not in that set, or by the beginning of a file
|
||||
+(since the source program must end with a newline, the end of a file is not a
|
||||
+possible symbol delimiter). @xref{Symbols}.
|
||||
|
||||
Symbol names may also be enclosed in double quote @code{"} characters. In such
|
||||
cases any characters are allowed, except for the NUL character. If a double
|
||||
@@ -3834,11 +3849,18 @@ than @code{Foo}.
|
||||
Symbol names do not start with a digit. An exception to this rule is made for
|
||||
Local Labels. See below.
|
||||
|
||||
-Multibyte characters are supported. To generate a symbol name containing
|
||||
+Multibyte characters are supported, but note that the setting of the
|
||||
+@option{multibyte-handling} option might prevent their use.
|
||||
+To generate a symbol name containing
|
||||
multibyte characters enclose it within double quotes and use escape codes. cf
|
||||
@xref{Strings}. Generating a multibyte symbol name from a label is not
|
||||
currently supported.
|
||||
|
||||
+Since multibyte symbol names are unusual, and could possibly be used
|
||||
+maliciously, @command{@value{AS}} provides a command line option
|
||||
+(@option{--multibyte-handling=warn-sym-only}) which can be used to generate a
|
||||
+warning message whenever a symbol name containing multibyte characters is defined.
|
||||
+
|
||||
Each symbol has exactly one name. Each name in an assembly language program
|
||||
refers to exactly one symbol. You may use that symbol name any number of times
|
||||
in a program.
|
||||
diff -rupN binutils.orig/gas/input-scrub.c binutils-2.37/gas/input-scrub.c
|
||||
--- binutils.orig/gas/input-scrub.c 2021-11-18 16:50:38.835089547 +0000
|
||||
+++ binutils-2.37/gas/input-scrub.c 2021-11-18 16:50:42.535075612 +0000
|
||||
@@ -377,6 +377,11 @@ input_scrub_next_buffer (char **bufp)
|
||||
++p;
|
||||
}
|
||||
|
||||
+ if (multibyte_handling == multibyte_warn)
|
||||
+ (void) scan_for_multibyte_characters ((const unsigned char *) p,
|
||||
+ (const unsigned char *) limit,
|
||||
+ true /* Generate warnings */);
|
||||
+
|
||||
/* We found a newline in the newly read chars. */
|
||||
partial_where = p;
|
||||
partial_size = limit - p;
|
||||
diff -rupN binutils.orig/gas/symbols.c binutils-2.37/gas/symbols.c
|
||||
--- binutils.orig/gas/symbols.c 2021-11-18 16:50:39.105088530 +0000
|
||||
+++ binutils-2.37/gas/symbols.c 2021-11-18 16:52:17.980716107 +0000
|
||||
@@ -78,6 +78,10 @@ struct symbol_flags
|
||||
before. It is cleared as soon as any direct reference to the
|
||||
symbol is present. */
|
||||
unsigned int weakrefd : 1;
|
||||
+
|
||||
+ /* Set when a warning about the symbol containing multibyte characters
|
||||
+ is generated. */
|
||||
+ unsigned int multibyte_warned : 1;
|
||||
};
|
||||
|
||||
/* A pointer in the symbol may point to either a complete symbol
|
||||
@@ -194,7 +198,7 @@ static void *
|
||||
symbol_entry_find (htab_t table, const char *name)
|
||||
{
|
||||
hashval_t hash = htab_hash_string (name);
|
||||
- symbol_entry_t needle = { { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
+ symbol_entry_t needle = { { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
hash, name, 0, 0, 0 } };
|
||||
return htab_find_with_hash (table, &needle, hash);
|
||||
}
|
||||
@@ -305,6 +309,18 @@ symbol_init (symbolS *symbolP, const cha
|
||||
symbolP->bsym->name = name;
|
||||
symbolP->bsym->section = sec;
|
||||
|
||||
+ if (multibyte_handling == multibyte_warn_syms
|
||||
+ && ! symbolP->flags.local_symbol
|
||||
+ && sec != undefined_section
|
||||
+ && ! symbolP->flags.multibyte_warned
|
||||
+ && scan_for_multibyte_characters ((const unsigned char *) name,
|
||||
+ (const unsigned char *) name + strlen (name),
|
||||
+ false /* Do not warn. */))
|
||||
+ {
|
||||
+ as_warn (_("symbol '%s' contains multibyte characters"), name);
|
||||
+ symbolP->flags.multibyte_warned = 1;
|
||||
+ }
|
||||
+
|
||||
S_SET_VALUE (symbolP, valu);
|
||||
|
||||
symbol_clear_list_pointers (symbolP);
|
||||
@@ -2413,7 +2429,21 @@ S_SET_SEGMENT (symbolS *s, segT seg)
|
||||
abort ();
|
||||
}
|
||||
else
|
||||
- s->bsym->section = seg;
|
||||
+ {
|
||||
+ if (multibyte_handling == multibyte_warn_syms
|
||||
+ && ! s->flags.local_symbol
|
||||
+ && seg != undefined_section
|
||||
+ && ! s->flags.multibyte_warned
|
||||
+ && scan_for_multibyte_characters ((const unsigned char *) s->name,
|
||||
+ (const unsigned char *) s->name + strlen (s->name),
|
||||
+ false))
|
||||
+ {
|
||||
+ as_warn (_("symbol '%s' contains multibyte characters"), s->name);
|
||||
+ s->flags.multibyte_warned = 1;
|
||||
+ }
|
||||
+
|
||||
+ s->bsym->section = seg;
|
||||
+ }
|
||||
}
|
||||
|
||||
void
|
||||
diff -rupN binutils.orig/gas/testsuite/gas/all/gas.exp binutils-2.37/gas/testsuite/gas/all/gas.exp
|
||||
--- binutils.orig/gas/testsuite/gas/all/gas.exp 2021-11-18 16:50:39.101088545 +0000
|
||||
+++ binutils-2.37/gas/testsuite/gas/all/gas.exp 2021-11-18 16:50:42.538075600 +0000
|
||||
@@ -494,3 +494,5 @@ run_dump_test "nop"
|
||||
run_dump_test "asciz"
|
||||
run_dump_test "pr27384"
|
||||
run_dump_test "pr27381"
|
||||
+run_dump_test "multibyte1"
|
||||
+run_dump_test "multibyte2"
|
||||
diff -rupN binutils.orig/testsuite/gas/all/multibyte.s binutils-2.37/testsuite/gas/all/multibyte.s
|
||||
--- binutils.orig/testsuite/gas/all/multibyte.s 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ binutils-2.37/testsuite/gas/all/multibyte.s 2021-11-18 16:50:42.541075589 +0000
|
||||
@@ -0,0 +1,8 @@
|
||||
+ .text
|
||||
+ .globl heoll
|
||||
+heoll:
|
||||
+ .nop
|
||||
+
|
||||
+ .globl hello
|
||||
+hello:
|
||||
+ .nop
|
||||
diff -rupN binutils.orig/testsuite/gas/all/multibyte1.d binutils-2.37/testsuite/gas/all/multibyte1.d
|
||||
--- binutils.orig/testsuite/gas/all/multibyte1.d 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ binutils-2.37/testsuite/gas/all/multibyte1.d 2021-11-18 16:50:42.541075589 +0000
|
||||
@@ -0,0 +1,3 @@
|
||||
+#source: multibyte.s
|
||||
+#as: --multibyte-handling=warn
|
||||
+#warning_output: multibyte1.l
|
||||
diff -rupN binutils.orig/testsuite/gas/all/multibyte1.l binutils-2.37/testsuite/gas/all/multibyte1.l
|
||||
--- binutils.orig/testsuite/gas/all/multibyte1.l 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ binutils-2.37/testsuite/gas/all/multibyte1.l 2021-11-18 16:50:42.541075589 +0000
|
||||
@@ -0,0 +1,12 @@
|
||||
+[^:]*: Assembler messages:
|
||||
+[^:]*: Warning: multibyte character \(0xe2\) encountered in .*multibyte.s
|
||||
+[^:]*: Warning: multibyte character \(0x80\) encountered in .*multibyte.s
|
||||
+[^:]*: Warning: multibyte character \(0xae\) encountered in .*multibyte.s
|
||||
+[^:]*: Warning: multibyte character \(0xe2\) encountered in .*multibyte.s
|
||||
+[^:]*: Warning: multibyte character \(0x80\) encountered in .*multibyte.s
|
||||
+[^:]*: Warning: multibyte character \(0xac\) encountered in .*multibyte.s
|
||||
+[^:]*: Warning: multibyte character \(0xe2\) encountered in .*multibyte.s
|
||||
+[^:]*: Warning: multibyte character \(0x80\) encountered in .*multibyte.s
|
||||
+[^:]*: Warning: multibyte character \(0xae\) encountered in .*multibyte.s
|
||||
+[^:]*: Warning: multibyte character \(0xe2\) encountered in .*multibyte.s
|
||||
+[^:]*: Warning: further multibyte character warnings suppressed
|
||||
diff -rupN binutils.orig/testsuite/gas/all/multibyte2.d binutils-2.37/testsuite/gas/all/multibyte2.d
|
||||
--- binutils.orig/testsuite/gas/all/multibyte2.d 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ binutils-2.37/testsuite/gas/all/multibyte2.d 2021-11-18 16:50:42.542075585 +0000
|
||||
@@ -0,0 +1,3 @@
|
||||
+#source: multibyte.s
|
||||
+#as: --multibyte-handling=warn-sym-only
|
||||
+#warning_output: multibyte2.l
|
||||
diff -rupN binutils.orig/testsuite/gas/all/multibyte2.l binutils-2.37/testsuite/gas/all/multibyte2.l
|
||||
--- binutils.orig/testsuite/gas/all/multibyte2.l 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ binutils-2.37/testsuite/gas/all/multibyte2.l 2021-11-18 16:50:42.541075589 +0000
|
||||
@@ -0,0 +1,2 @@
|
||||
+[^:]*: Assembler messages:
|
||||
+[^:]*:3: Warning: symbol '.*' contains multibyte characters
|
|
@ -0,0 +1,180 @@
|
|||
diff -rup binutils.orig/gold/gdb-index.cc binutils-2.34.0/gold/gdb-index.cc
|
||||
--- binutils.orig/gold/gdb-index.cc 2020-07-24 09:12:29.241306445 +0100
|
||||
+++ binutils-2.34.0/gold/gdb-index.cc 2020-07-24 09:15:48.332095898 +0100
|
||||
@@ -817,7 +817,7 @@ Gdb_index_info_reader::get_qualified_nam
|
||||
void
|
||||
Gdb_index_info_reader::record_cu_ranges(Dwarf_die* die)
|
||||
{
|
||||
- unsigned int shndx;
|
||||
+ unsigned int shndx = 0;
|
||||
unsigned int shndx2;
|
||||
|
||||
off_t ranges_offset = die->ref_attribute(elfcpp::DW_AT_ranges, &shndx);
|
||||
diff -rup binutils.orig/gold/layout.cc binutils-2.34.0/gold/layout.cc
|
||||
--- binutils.orig/gold/layout.cc 2020-07-24 09:12:29.243306433 +0100
|
||||
+++ binutils-2.34.0/gold/layout.cc 2020-07-24 09:15:11.464320064 +0100
|
||||
@@ -1986,7 +1986,7 @@ Layout::attach_allocated_section_to_segm
|
||||
seg_flags |= os->extra_segment_flags();
|
||||
|
||||
// Check for --section-start.
|
||||
- uint64_t addr;
|
||||
+ uint64_t addr = 0;
|
||||
bool is_address_set = parameters->options().section_start(os->name(), &addr);
|
||||
|
||||
// In general the only thing we really care about for PT_LOAD
|
||||
diff -rup binutils.orig/binutils/dlltool.c binutils-2.34.0/binutils/dlltool.c
|
||||
--- binutils.orig/binutils/dlltool.c 2020-07-24 09:12:28.974308069 +0100
|
||||
+++ binutils-2.34.0/binutils/dlltool.c 2020-07-24 12:09:37.527121295 +0100
|
||||
@@ -1305,7 +1305,7 @@ run (const char *what, char *args)
|
||||
int pid, wait_status;
|
||||
int i;
|
||||
const char **argv;
|
||||
- char *errmsg_fmt, *errmsg_arg;
|
||||
+ char *errmsg_fmt = "", *errmsg_arg = "";
|
||||
char *temp_base = choose_temp_base ();
|
||||
|
||||
inform (_("run: %s %s"), what, args);
|
||||
diff -rup binutils.orig/gas/config/tc-arm.c binutils-2.34.0/gas/config/tc-arm.c
|
||||
--- binutils.orig/gas/config/tc-arm.c 2020-07-24 09:12:32.368287432 +0100
|
||||
+++ binutils-2.34.0/gas/config/tc-arm.c 2020-07-24 12:14:19.842360634 +0100
|
||||
@@ -28416,9 +28416,12 @@ md_apply_fix (fixS * fixP,
|
||||
perform relaxation. */
|
||||
if (value == -2)
|
||||
{
|
||||
- newval = md_chars_to_number (buf, THUMB_SIZE);
|
||||
- newval = 0xbf00; /* NOP encoding T1 */
|
||||
- md_number_to_chars (buf, newval, THUMB_SIZE);
|
||||
+ if (fixP->fx_done || !seg->use_rela_p)
|
||||
+ {
|
||||
+ newval = md_chars_to_number (buf, THUMB_SIZE);
|
||||
+ newval = 0xbf00; /* NOP encoding T1 */
|
||||
+ md_number_to_chars (buf, newval, THUMB_SIZE);
|
||||
+ }
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -28631,17 +28634,14 @@ md_apply_fix (fixS * fixP,
|
||||
case BFD_RELOC_ARM_GOTFUNCDESC:
|
||||
case BFD_RELOC_ARM_GOTOFFFUNCDESC:
|
||||
case BFD_RELOC_ARM_FUNCDESC:
|
||||
- if (arm_fdpic)
|
||||
- {
|
||||
- if (fixP->fx_done || !seg->use_rela_p)
|
||||
- md_number_to_chars (buf, 0, 4);
|
||||
- }
|
||||
- else
|
||||
+ if (!arm_fdpic)
|
||||
{
|
||||
as_bad_where (fixP->fx_file, fixP->fx_line,
|
||||
_("Relocation supported only in FDPIC mode"));
|
||||
- }
|
||||
- break;
|
||||
+ break;
|
||||
+ }
|
||||
+ value = 0;
|
||||
+ /* Fall through. */
|
||||
#endif
|
||||
|
||||
case BFD_RELOC_RVA:
|
||||
diff -rup binutils.orig/gas/config/tc-arm.c binutils-2.34.0/gas/config/tc-arm.c
|
||||
--- binutils.orig/gas/config/tc-arm.c 2020-07-24 12:16:02.099719884 +0100
|
||||
+++ binutils-2.34.0/gas/config/tc-arm.c 2020-07-24 12:34:17.690858328 +0100
|
||||
@@ -28641,7 +28641,7 @@ md_apply_fix (fixS * fixP,
|
||||
break;
|
||||
}
|
||||
value = 0;
|
||||
- /* Fall through. */
|
||||
+ goto fred;
|
||||
#endif
|
||||
|
||||
case BFD_RELOC_RVA:
|
||||
@@ -28653,6 +28653,7 @@ md_apply_fix (fixS * fixP,
|
||||
#ifdef TE_PE
|
||||
case BFD_RELOC_32_SECREL:
|
||||
#endif
|
||||
+ fred:
|
||||
if (fixP->fx_done || !seg->use_rela_p)
|
||||
#ifdef TE_WINCE
|
||||
/* For WinCE we only do this for pcrel fixups. */
|
||||
diff -rup binutils.orig/gas/config/tc-arm.c binutils-2.34.0/gas/config/tc-arm.c
|
||||
--- binutils.orig/gas/config/tc-arm.c 2020-07-24 13:28:26.926553452 +0100
|
||||
+++ binutils-2.34.0/gas/config/tc-arm.c 2020-07-24 13:31:57.835215763 +0100
|
||||
@@ -28416,12 +28416,8 @@ md_apply_fix (fixS * fixP,
|
||||
perform relaxation. */
|
||||
if (value == -2)
|
||||
{
|
||||
- if (fixP->fx_done || !seg->use_rela_p)
|
||||
- {
|
||||
- newval = md_chars_to_number (buf, THUMB_SIZE);
|
||||
- newval = 0xbf00; /* NOP encoding T1 */
|
||||
- md_number_to_chars (buf, newval, THUMB_SIZE);
|
||||
- }
|
||||
+ newval = 0xbf00; /* NOP encoding T1 */
|
||||
+ goto jim;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -28432,6 +28428,7 @@ md_apply_fix (fixS * fixP,
|
||||
{
|
||||
newval = md_chars_to_number (buf, THUMB_SIZE);
|
||||
newval |= ((value & 0x3e) << 2) | ((value & 0x40) << 3);
|
||||
+ jim:
|
||||
md_number_to_chars (buf, newval, THUMB_SIZE);
|
||||
}
|
||||
}
|
||||
diff -rup binutils.orig/binutils/mclex.c binutils-2.34.0/binutils/mclex.c
|
||||
--- binutils.orig/binutils/mclex.c 2020-07-24 13:28:26.297557441 +0100
|
||||
+++ binutils-2.34.0/binutils/mclex.c 2020-07-24 14:46:53.587940149 +0100
|
||||
@@ -207,7 +207,7 @@ enum_severity (int e)
|
||||
static void
|
||||
mc_add_keyword_ascii (const char *sz, int rid, const char *grp, rc_uint_type nv, const char *sv)
|
||||
{
|
||||
- unichar *usz, *usv = NULL;
|
||||
+ unichar *usz = NULL, *usv = NULL;
|
||||
rc_uint_type usz_len;
|
||||
|
||||
unicode_from_codepage (&usz_len, &usz, sz, CP_ACP);
|
||||
diff -rup binutils.orig/binutils/windmc.c binutils-2.34.0/binutils/windmc.c
|
||||
--- binutils.orig/binutils/windmc.c 2020-07-24 13:28:26.279557556 +0100
|
||||
+++ binutils-2.34.0/binutils/windmc.c 2020-07-24 14:48:05.460477478 +0100
|
||||
@@ -338,7 +338,7 @@ mc_add_node_lang (mc_node *root, const m
|
||||
static char *
|
||||
convert_unicode_to_ACP (const unichar *usz)
|
||||
{
|
||||
- char *s;
|
||||
+ char *s = NULL;
|
||||
rc_uint_type l;
|
||||
|
||||
if (! usz)
|
||||
@@ -607,10 +607,10 @@ mc_generate_bin_item (mc_node_lang *n, r
|
||||
else
|
||||
{
|
||||
rc_uint_type txt_len, l;
|
||||
- char *cvt_txt;
|
||||
+ char *cvt_txt = NULL;
|
||||
|
||||
codepage_from_unicode( &l, n->message, &cvt_txt, n->lang->lang_info.wincp);
|
||||
- if (! cvt_txt)
|
||||
+ if (cvt_txt == NULL)
|
||||
fatal ("Failed to convert message to language codepage.\n");
|
||||
txt_len = strlen (cvt_txt);
|
||||
if (mcset_automatic_null_termination && txt_len > 0)
|
||||
@@ -1107,7 +1107,7 @@ main (int argc, char **argv)
|
||||
|
||||
/* Load the input file and do code page transformations to UTF16. */
|
||||
{
|
||||
- unichar *u;
|
||||
+ unichar *u = NULL;
|
||||
rc_uint_type ul;
|
||||
char *buff;
|
||||
bfd_size_type flen;
|
||||
--- binutils.orig/binutils/srconv.c 2020-07-24 15:37:25.847459208 +0100
|
||||
+++ binutils-2.34.0/binutils/srconv.c 2020-07-24 15:39:12.853773423 +0100
|
||||
@@ -316,6 +316,7 @@ wr_hd (struct coff_ofile *p)
|
||||
struct IT_hd hd;
|
||||
|
||||
hd.spare1 = 0;
|
||||
+ hd.spare2 = 0;
|
||||
if (bfd_get_file_flags (abfd) & EXEC_P)
|
||||
hd.mt = MTYPE_ABS_LM;
|
||||
else
|
|
@ -0,0 +1,193 @@
|
|||
diff --git a/gold/i386.cc b/gold/i386.cc
|
||||
index bf209fe9a86..31161ff091c 100644
|
||||
--- a/gold/i386.cc
|
||||
+++ b/gold/i386.cc
|
||||
@@ -360,7 +360,11 @@ class Target_i386 : public Sized_target<32, false>
|
||||
got_(NULL), plt_(NULL), got_plt_(NULL), got_irelative_(NULL),
|
||||
got_tlsdesc_(NULL), global_offset_table_(NULL), rel_dyn_(NULL),
|
||||
rel_irelative_(NULL), copy_relocs_(elfcpp::R_386_COPY),
|
||||
- got_mod_index_offset_(-1U), tls_base_symbol_defined_(false)
|
||||
+ got_mod_index_offset_(-1U), tls_base_symbol_defined_(false),
|
||||
+ isa_1_used_(0), isa_1_needed_(0),
|
||||
+ feature_1_(0), feature_2_used_(0), feature_2_needed_(0),
|
||||
+ object_isa_1_used_(0), object_feature_1_(0),
|
||||
+ object_feature_2_used_(0), seen_first_object_(false)
|
||||
{ }
|
||||
|
||||
// Process the relocations to determine unreferenced sections for
|
||||
@@ -859,6 +863,21 @@ class Target_i386 : public Sized_target<32, false>
|
||||
this->rel_dyn_section(layout));
|
||||
}
|
||||
|
||||
+ // Record a target-specific program property in the .note.gnu.property
|
||||
+ // section.
|
||||
+ void
|
||||
+ record_gnu_property(unsigned int, unsigned int, size_t,
|
||||
+ const unsigned char*, const Object*);
|
||||
+
|
||||
+ // Merge the target-specific program properties from the current object.
|
||||
+ void
|
||||
+ merge_gnu_properties(const Object*);
|
||||
+
|
||||
+ // Finalize the target-specific program properties and add them back to
|
||||
+ // the layout.
|
||||
+ void
|
||||
+ do_finalize_gnu_properties(Layout*) const;
|
||||
+
|
||||
// Information about this specific target which we pass to the
|
||||
// general Target structure.
|
||||
static const Target::Target_info i386_info;
|
||||
@@ -898,6 +917,26 @@ class Target_i386 : public Sized_target<32, false>
|
||||
unsigned int got_mod_index_offset_;
|
||||
// True if the _TLS_MODULE_BASE_ symbol has been defined.
|
||||
bool tls_base_symbol_defined_;
|
||||
+
|
||||
+ // Target-specific program properties, from .note.gnu.property section.
|
||||
+ // Each bit represents a specific feature.
|
||||
+ uint32_t isa_1_used_;
|
||||
+ uint32_t isa_1_needed_;
|
||||
+ uint32_t feature_1_;
|
||||
+ uint32_t feature_2_used_;
|
||||
+ uint32_t feature_2_needed_;
|
||||
+ // Target-specific properties from the current object.
|
||||
+ // These bits get ORed into ISA_1_USED_ after all properties for the object
|
||||
+ // have been processed. But if either is all zeroes (as when the property
|
||||
+ // is absent from an object), the result should be all zeroes.
|
||||
+ // (See PR ld/23486.)
|
||||
+ uint32_t object_isa_1_used_;
|
||||
+ // These bits get ANDed into FEATURE_1_ after all properties for the object
|
||||
+ // have been processed.
|
||||
+ uint32_t object_feature_1_;
|
||||
+ uint32_t object_feature_2_used_;
|
||||
+ // Whether we have seen our first object, for use in initializing FEATURE_1_.
|
||||
+ bool seen_first_object_;
|
||||
};
|
||||
|
||||
const Target::Target_info Target_i386::i386_info =
|
||||
@@ -1042,6 +1081,126 @@ Target_i386::rel_irelative_section(Layout* layout)
|
||||
return this->rel_irelative_;
|
||||
}
|
||||
|
||||
+// Record a target-specific program property from the .note.gnu.property
|
||||
+// section.
|
||||
+void
|
||||
+Target_i386::record_gnu_property(
|
||||
+ unsigned int, unsigned int pr_type,
|
||||
+ size_t pr_datasz, const unsigned char* pr_data,
|
||||
+ const Object* object)
|
||||
+{
|
||||
+ uint32_t val = 0;
|
||||
+
|
||||
+ switch (pr_type)
|
||||
+ {
|
||||
+ case elfcpp::GNU_PROPERTY_X86_COMPAT_ISA_1_USED:
|
||||
+ case elfcpp::GNU_PROPERTY_X86_COMPAT_ISA_1_NEEDED:
|
||||
+ case elfcpp::GNU_PROPERTY_X86_COMPAT_2_ISA_1_USED:
|
||||
+ case elfcpp::GNU_PROPERTY_X86_COMPAT_2_ISA_1_NEEDED:
|
||||
+ case elfcpp::GNU_PROPERTY_X86_ISA_1_USED:
|
||||
+ case elfcpp::GNU_PROPERTY_X86_ISA_1_NEEDED:
|
||||
+ case elfcpp::GNU_PROPERTY_X86_FEATURE_1_AND:
|
||||
+ case elfcpp::GNU_PROPERTY_X86_FEATURE_2_USED:
|
||||
+ case elfcpp::GNU_PROPERTY_X86_FEATURE_2_NEEDED:
|
||||
+ if (pr_datasz != 4)
|
||||
+ {
|
||||
+ gold_warning(_("%s: corrupt .note.gnu.property section "
|
||||
+ "(pr_datasz for property %d is not 4)"),
|
||||
+ object->name().c_str(), pr_type);
|
||||
+ return;
|
||||
+ }
|
||||
+ val = elfcpp::Swap<32, false>::readval(pr_data);
|
||||
+ break;
|
||||
+ default:
|
||||
+ gold_warning(_("%s: unknown program property type 0x%x "
|
||||
+ "in .note.gnu.property section"),
|
||||
+ object->name().c_str(), pr_type);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ switch (pr_type)
|
||||
+ {
|
||||
+ case elfcpp::GNU_PROPERTY_X86_ISA_1_USED:
|
||||
+ this->object_isa_1_used_ |= val;
|
||||
+ break;
|
||||
+ case elfcpp::GNU_PROPERTY_X86_ISA_1_NEEDED:
|
||||
+ this->isa_1_needed_ |= val;
|
||||
+ break;
|
||||
+ case elfcpp::GNU_PROPERTY_X86_FEATURE_1_AND:
|
||||
+ // If we see multiple feature props in one object, OR them together.
|
||||
+ this->object_feature_1_ |= val;
|
||||
+ break;
|
||||
+ case elfcpp::GNU_PROPERTY_X86_FEATURE_2_USED:
|
||||
+ this->object_feature_2_used_ |= val;
|
||||
+ break;
|
||||
+ case elfcpp::GNU_PROPERTY_X86_FEATURE_2_NEEDED:
|
||||
+ this->feature_2_needed_ |= val;
|
||||
+ break;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+// Merge the target-specific program properties from the current object.
|
||||
+void
|
||||
+Target_i386::merge_gnu_properties(const Object*)
|
||||
+{
|
||||
+ if (this->seen_first_object_)
|
||||
+ {
|
||||
+ // If any object is missing the ISA_1_USED property, we must omit
|
||||
+ // it from the output file.
|
||||
+ if (this->object_isa_1_used_ == 0)
|
||||
+ this->isa_1_used_ = 0;
|
||||
+ else if (this->isa_1_used_ != 0)
|
||||
+ this->isa_1_used_ |= this->object_isa_1_used_;
|
||||
+ this->feature_1_ &= this->object_feature_1_;
|
||||
+ // If any object is missing the FEATURE_2_USED property, we must
|
||||
+ // omit it from the output file.
|
||||
+ if (this->object_feature_2_used_ == 0)
|
||||
+ this->feature_2_used_ = 0;
|
||||
+ else if (this->feature_2_used_ != 0)
|
||||
+ this->feature_2_used_ |= this->object_feature_2_used_;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ this->isa_1_used_ = this->object_isa_1_used_;
|
||||
+ this->feature_1_ = this->object_feature_1_;
|
||||
+ this->feature_2_used_ = this->object_feature_2_used_;
|
||||
+ this->seen_first_object_ = true;
|
||||
+ }
|
||||
+ this->object_isa_1_used_ = 0;
|
||||
+ this->object_feature_1_ = 0;
|
||||
+ this->object_feature_2_used_ = 0;
|
||||
+}
|
||||
+
|
||||
+static inline void
|
||||
+add_property(Layout* layout, unsigned int pr_type, uint32_t val)
|
||||
+{
|
||||
+ unsigned char buf[4];
|
||||
+ elfcpp::Swap<32, false>::writeval(buf, val);
|
||||
+ layout->add_gnu_property(elfcpp::NT_GNU_PROPERTY_TYPE_0, pr_type, 4, buf);
|
||||
+}
|
||||
+
|
||||
+// Finalize the target-specific program properties and add them back to
|
||||
+// the layout.
|
||||
+void
|
||||
+Target_i386::do_finalize_gnu_properties(Layout* layout) const
|
||||
+{
|
||||
+ if (this->isa_1_used_ != 0)
|
||||
+ add_property(layout, elfcpp::GNU_PROPERTY_X86_ISA_1_USED,
|
||||
+ this->isa_1_used_);
|
||||
+ if (this->isa_1_needed_ != 0)
|
||||
+ add_property(layout, elfcpp::GNU_PROPERTY_X86_ISA_1_NEEDED,
|
||||
+ this->isa_1_needed_);
|
||||
+ if (this->feature_1_ != 0)
|
||||
+ add_property(layout, elfcpp::GNU_PROPERTY_X86_FEATURE_1_AND,
|
||||
+ this->feature_1_);
|
||||
+ if (this->feature_2_used_ != 0)
|
||||
+ add_property(layout, elfcpp::GNU_PROPERTY_X86_FEATURE_2_USED,
|
||||
+ this->feature_2_used_);
|
||||
+ if (this->feature_2_needed_ != 0)
|
||||
+ add_property(layout, elfcpp::GNU_PROPERTY_X86_FEATURE_2_NEEDED,
|
||||
+ this->feature_2_needed_);
|
||||
+}
|
||||
+
|
||||
// Write the first three reserved words of the .got.plt section.
|
||||
// The remainder of the section is written while writing the PLT
|
||||
// in Output_data_plt_i386::do_write.
|
|
@ -1,10 +0,0 @@
|
|||
--- binutils.orig/gold/target-reloc.h 2018-07-12 11:37:24.894494658 +0100
|
||||
+++ binutils-2.30.90/gold/target-reloc.h 2018-07-12 15:38:50.049083904 +0100
|
||||
@@ -136,6 +136,7 @@ class Default_comdat_behavior
|
||||
if (Layout::is_debug_info_section(name))
|
||||
return CB_PRETEND;
|
||||
if (strcmp(name, ".eh_frame") == 0
|
||||
+ || strncmp(name, ".gnu.build.attributes", 21) == 0 // FIXME: We should really be checking the section type for ST_NOTE...
|
||||
|| strcmp(name, ".gcc_except_table") == 0)
|
||||
return CB_IGNORE;
|
||||
return CB_ERROR;
|
|
@ -0,0 +1,66 @@
|
|||
Only in binutils-2.34/gold: autom4te.cache
|
||||
diff -rup binutils.orig/gold/configure binutils-2.34/gold/configure
|
||||
--- binutils.orig/gold/configure 2020-04-20 12:35:13.048297305 +0100
|
||||
+++ binutils-2.34/gold/configure 2020-04-20 14:02:06.743725696 +0100
|
||||
@@ -5180,7 +5180,8 @@ for targ in $target $canon_targets; do
|
||||
. ${srcdir}/configure.tgt
|
||||
|
||||
if test "$targ_obj" = "UNKNOWN"; then
|
||||
- as_fn_error $? "\"unsupported target $targ\"" "$LINENO" 5
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"unsupported target $targ\"" >&5
|
||||
+$as_echo "$as_me: WARNING: \"unsupported target $targ\"" >&2;}
|
||||
else
|
||||
targetobjs="$targetobjs ${targ_obj}.\$(OBJEXT)"
|
||||
if test "$targ_extra_obj" != ""; then
|
||||
diff -rup binutils.orig/gold/configure.ac binutils-2.34/gold/configure.ac
|
||||
--- binutils.orig/gold/configure.ac 2020-04-20 12:35:13.050297291 +0100
|
||||
+++ binutils-2.34/gold/configure.ac 2020-04-20 14:01:46.435868770 +0100
|
||||
@@ -181,7 +181,7 @@ for targ in $target $canon_targets; do
|
||||
. ${srcdir}/configure.tgt
|
||||
|
||||
if test "$targ_obj" = "UNKNOWN"; then
|
||||
- AC_MSG_ERROR("unsupported target $targ")
|
||||
+ AC_MSG_WARN("unsupported target $targ")
|
||||
else
|
||||
targetobjs="$targetobjs ${targ_obj}.\$(OBJEXT)"
|
||||
if test "$targ_extra_obj" != ""; then
|
||||
--- binutils.orig/ld/configure.tgt 2020-04-20 12:35:12.465301359 +0100
|
||||
+++ binutils-2.34/ld/configure.tgt 2020-04-20 14:17:52.123066333 +0100
|
||||
@@ -220,7 +220,7 @@ bfin-*-linux-uclibc*) targ_emul=elf32bfi
|
||||
targ_extra_emuls="elf32bfin"
|
||||
targ_extra_libpath=$targ_extra_emuls
|
||||
;;
|
||||
-bpf-*-*) targ_emul=elf64bpf
|
||||
+bpf-* | bpf-*-*) targ_emul=elf64bpf
|
||||
;;
|
||||
cr16-*-elf*) targ_emul=elf32cr16
|
||||
;;
|
||||
@@ -1026,7 +1026,7 @@ z8k-*-coff) targ_emul=z8002
|
||||
targ_extra_ofiles=
|
||||
;;
|
||||
*)
|
||||
- echo 2>&1 "*** ld does not support target ${targ}"
|
||||
+ echo 2>&1 "*** ld does not support target '${targ}' NO REALLY"
|
||||
echo 2>&1 "*** see ld/configure.tgt for supported targets"
|
||||
exit 1
|
||||
|
||||
--- binutils.orig/bfd/config.bfd 2020-04-20 12:35:13.038297375 +0100
|
||||
+++ binutils-2.34/bfd/config.bfd 2020-04-20 14:25:26.452869193 +0100
|
||||
@@ -473,7 +473,7 @@ case "${targ}" in
|
||||
;;
|
||||
|
||||
#ifdef BFD64
|
||||
- bpf-*-none)
|
||||
+ bpf-*-none | bpf-*)
|
||||
targ_defvec=bpf_elf64_le_vec
|
||||
targ_selvecs=bpf_elf64_be_vec
|
||||
targ_underscore=yes
|
||||
@@ -1427,7 +1427,7 @@ case "${targ}" in
|
||||
;;
|
||||
|
||||
*)
|
||||
- echo 1>&2 "*** BFD does not support target ${targ}."
|
||||
+ echo 1>&2 "*** BFD does not support target '${targ}'. Honest."
|
||||
echo 1>&2 "*** Look in bfd/config.bfd for supported targets."
|
||||
exit 1
|
||||
;;
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,98 @@
|
|||
--- binutils.orig/ld/ldlang.c 2021-09-17 10:38:18.073366643 +0100
|
||||
+++ binutils-2.37/ld/ldlang.c 2021-09-17 10:50:50.155450530 +0100
|
||||
@@ -6978,7 +6978,8 @@ lang_end (void)
|
||||
if (!bfd_set_start_address (link_info.output_bfd, val))
|
||||
einfo (_("%F%P: can't set start address\n"));
|
||||
}
|
||||
- else
|
||||
+ /* BZ 2004952: Only use the start of the .text section for executables. */
|
||||
+ else if bfd_link_executable (&link_info)
|
||||
{
|
||||
asection *ts;
|
||||
|
||||
@@ -7004,6 +7005,13 @@ lang_end (void)
|
||||
entry_symbol.name);
|
||||
}
|
||||
}
|
||||
+ else
|
||||
+ {
|
||||
+ if (warn)
|
||||
+ einfo (_("%P: warning: cannot find entry symbol %s;"
|
||||
+ " not setting start address\n"),
|
||||
+ entry_symbol.name);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
diff -rup binutils.orig/ld/testsuite/ld-arm/tls-gdesc-got.d binutils-2.37/ld/testsuite/ld-arm/tls-gdesc-got.d
|
||||
--- binutils.orig/ld/testsuite/ld-arm/tls-gdesc-got.d 2021-09-29 13:17:21.501277341 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-arm/tls-gdesc-got.d 2021-09-29 13:20:04.481132127 +0100
|
||||
@@ -2,7 +2,7 @@
|
||||
.*/tls-lib2-got.so: file format elf32-.*arm.*
|
||||
architecture: arm.*, flags 0x00000150:
|
||||
HAS_SYMS, DYNAMIC, D_PAGED
|
||||
-start address 0x0+8(1e8|220)
|
||||
+start address 0x[0-9a-f]+
|
||||
|
||||
|
||||
Disassembly of section .got:
|
||||
diff -rup binutils.orig/ld/testsuite/ld-i386/tlsnopic.rd binutils-2.37/ld/testsuite/ld-i386/tlsnopic.rd
|
||||
--- binutils.orig/ld/testsuite/ld-i386/tlsnopic.rd 2021-09-29 13:17:21.588276729 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-i386/tlsnopic.rd 2021-09-29 13:20:59.456745814 +0100
|
||||
@@ -26,7 +26,7 @@ Key to Flags:
|
||||
#...
|
||||
|
||||
Elf file type is DYN \(Shared object file\)
|
||||
-Entry point 0x1000
|
||||
+Entry point 0x[0-9a-f]+
|
||||
There are [0-9]+ program headers, starting at offset [0-9]+
|
||||
|
||||
Program Headers:
|
||||
diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr14207.d binutils-2.37/ld/testsuite/ld-x86-64/pr14207.d
|
||||
--- binutils.orig/ld/testsuite/ld-x86-64/pr14207.d 2021-09-29 13:17:21.551276989 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-x86-64/pr14207.d 2021-09-29 13:21:27.632547838 +0100
|
||||
@@ -5,7 +5,7 @@
|
||||
#target: x86_64-*-linux*
|
||||
|
||||
Elf file type is DYN \(Shared object file\)
|
||||
-Entry point 0x149
|
||||
+Entry point 0x[0-9a-f]+
|
||||
There are 4 program headers, starting at offset 64
|
||||
|
||||
Program Headers:
|
||||
diff -rup binutils.orig/ld/testsuite/ld-x86-64/tlsdesc.rd binutils-2.37/ld/testsuite/ld-x86-64/tlsdesc.rd
|
||||
--- binutils.orig/ld/testsuite/ld-x86-64/tlsdesc.rd 2021-09-29 13:17:21.554276968 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-x86-64/tlsdesc.rd 2021-09-29 13:21:47.920405285 +0100
|
||||
@@ -29,7 +29,7 @@ Key to Flags:
|
||||
#...
|
||||
|
||||
Elf file type is DYN \(Shared object file\)
|
||||
-Entry point 0x1000
|
||||
+Entry point 0x[0-9a-f]+
|
||||
There are [0-9]+ program headers, starting at offset [0-9]+
|
||||
|
||||
Program Headers:
|
||||
diff -rup binutils.orig/ld/testsuite/ld-x86-64/tlspic.rd binutils-2.37/ld/testsuite/ld-x86-64/tlspic.rd
|
||||
--- binutils.orig/ld/testsuite/ld-x86-64/tlspic.rd 2021-09-29 13:17:21.546277025 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-x86-64/tlspic.rd 2021-09-29 13:22:04.224290720 +0100
|
||||
@@ -29,7 +29,7 @@ Key to Flags:
|
||||
#...
|
||||
|
||||
Elf file type is DYN \(Shared object file\)
|
||||
-Entry point 0x1000
|
||||
+Entry point 0x[0-9a-f]+
|
||||
There are [0-9]+ program headers, starting at offset [0-9]+
|
||||
|
||||
Program Headers:
|
||||
diff -rup binutils.orig/ld/testsuite/ld-x86-64/tlspic2.rd binutils-2.37/ld/testsuite/ld-x86-64/tlspic2.rd
|
||||
--- binutils.orig/ld/testsuite/ld-x86-64/tlspic2.rd 2021-09-29 13:17:21.552276982 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-x86-64/tlspic2.rd 2021-09-29 13:22:18.432190887 +0100
|
||||
@@ -30,7 +30,7 @@ Key to Flags:
|
||||
#...
|
||||
|
||||
Elf file type is DYN \(Shared object file\)
|
||||
-Entry point 0x1000
|
||||
+Entry point 0x[0-9a-f]+
|
||||
There are [0-9]+ program headers, starting at offset [0-9]+
|
||||
|
||||
Program Headers:
|
|
@ -0,0 +1,158 @@
|
|||
From a0b911576eb49e06a457ebf757b42543d2c7e548 Mon Sep 17 00:00:00 2001
|
||||
From: Luca Boccassi <luca.boccassi@microsoft.com>
|
||||
Date: Wed, 21 Jul 2021 14:32:03 +0100
|
||||
Subject: [PATCH] Allows linker scripts to set the SEC_READONLY flag.
|
||||
|
||||
* ld.texi: Document new output section type.
|
||||
* ldgram.y: Add new token.
|
||||
* ldlang.c: Handle the new flag.
|
||||
* ldlang.h: Add readonly_section to list of section types.
|
||||
* ldlex.l: Add a new identifier.
|
||||
* testsuite/ld-scripts/output-section-types.t: New example linker script.
|
||||
* testsuite/ld-scripts/output-section-types.d: Test driver.
|
||||
* testsyute/ld-scripts/script.exp: Run the new test.
|
||||
|
||||
(cherry picked from commit 6b86da53d5ee2022b9065f445d23356190380746)
|
||||
---
|
||||
ld/ld.texi | 2 ++
|
||||
ld/ldgram.y | 2 ++
|
||||
ld/ldlang.c | 6 ++++++
|
||||
ld/ldlang.h | 3 ++-
|
||||
ld/ldlex.l | 1 +
|
||||
ld/testsuite/ld-scripts/output-section-types.d | 13 +++++++++++++
|
||||
ld/testsuite/ld-scripts/output-section-types.t | 7 +++++++
|
||||
ld/testsuite/ld-scripts/script.exp | 1 +
|
||||
8 files changed, 34 insertions(+), 1 deletion(-)
|
||||
create mode 100644 ld/testsuite/ld-scripts/output-section-types.d
|
||||
create mode 100644 ld/testsuite/ld-scripts/output-section-types.t
|
||||
|
||||
diff --git a/ld/ld.texi b/ld/ld.texi
|
||||
index dd8f571d4e4..cf1e637adbf 100644
|
||||
--- a/ld/ld.texi
|
||||
+++ b/ld/ld.texi
|
||||
@@ -5456,6 +5456,8 @@ parentheses. The following types are defined:
|
||||
@item NOLOAD
|
||||
The section should be marked as not loadable, so that it will not be
|
||||
loaded into memory when the program is run.
|
||||
+@item READONLY
|
||||
+The section should be marked as read-only.
|
||||
@item DSECT
|
||||
@itemx COPY
|
||||
@itemx INFO
|
||||
diff --git a/ld/ldgram.y b/ld/ldgram.y
|
||||
index dd911f46169..31e0071c6fc 100644
|
||||
--- a/ld/ldgram.y
|
||||
+++ b/ld/ldgram.y
|
||||
@@ -139,6 +139,7 @@ static int error_index;
|
||||
%token REGION_ALIAS
|
||||
%token LD_FEATURE
|
||||
%token NOLOAD DSECT COPY INFO OVERLAY
|
||||
+%token READONLY
|
||||
%token DEFINED TARGET_K SEARCH_DIR MAP ENTRY
|
||||
%token <integer> NEXT
|
||||
%token SIZEOF ALIGNOF ADDR LOADADDR MAX_K MIN_K
|
||||
@@ -1123,6 +1124,7 @@ type:
|
||||
| COPY { sectype = noalloc_section; }
|
||||
| INFO { sectype = noalloc_section; }
|
||||
| OVERLAY { sectype = noalloc_section; }
|
||||
+ | READONLY { sectype = readonly_section; }
|
||||
;
|
||||
|
||||
atype:
|
||||
diff --git a/ld/ldlang.c b/ld/ldlang.c
|
||||
index 37b64c89ee1..2610be995ca 100644
|
||||
--- a/ld/ldlang.c
|
||||
+++ b/ld/ldlang.c
|
||||
@@ -2639,6 +2639,9 @@ lang_add_section (lang_statement_list_type *ptr,
|
||||
case noalloc_section:
|
||||
flags &= ~SEC_ALLOC;
|
||||
break;
|
||||
+ case readonly_section:
|
||||
+ flags |= SEC_READONLY;
|
||||
+ break;
|
||||
case noload_section:
|
||||
flags &= ~SEC_LOAD;
|
||||
flags |= SEC_NEVER_LOAD;
|
||||
@@ -4232,6 +4235,9 @@ map_input_to_output_sections
|
||||
case noalloc_section:
|
||||
flags = SEC_HAS_CONTENTS;
|
||||
break;
|
||||
+ case readonly_section:
|
||||
+ flags |= SEC_READONLY;
|
||||
+ break;
|
||||
case noload_section:
|
||||
if (bfd_get_flavour (link_info.output_bfd)
|
||||
== bfd_target_elf_flavour)
|
||||
diff --git a/ld/ldlang.h b/ld/ldlang.h
|
||||
index 6fbe16d97d9..f68ae27b409 100644
|
||||
--- a/ld/ldlang.h
|
||||
+++ b/ld/ldlang.h
|
||||
@@ -121,7 +121,8 @@ enum section_type
|
||||
first_overlay_section,
|
||||
overlay_section,
|
||||
noload_section,
|
||||
- noalloc_section
|
||||
+ noalloc_section,
|
||||
+ readonly_section
|
||||
};
|
||||
|
||||
/* This structure holds a list of program headers describing
|
||||
diff --git a/ld/ldlex.l b/ld/ldlex.l
|
||||
index c1b15263587..25b4bcaae01 100644
|
||||
--- a/ld/ldlex.l
|
||||
+++ b/ld/ldlex.l
|
||||
@@ -294,6 +294,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)*
|
||||
<BOTH,SCRIPT>"SORT_BY_INIT_PRIORITY" { RTOKEN(SORT_BY_INIT_PRIORITY); }
|
||||
<BOTH,SCRIPT>"SORT_NONE" { RTOKEN(SORT_NONE); }
|
||||
<EXPRESSION,BOTH,SCRIPT>"NOLOAD" { RTOKEN(NOLOAD);}
|
||||
+<EXPRESSION,BOTH,SCRIPT>"READONLY" { RTOKEN(READONLY);}
|
||||
<EXPRESSION,BOTH,SCRIPT>"DSECT" { RTOKEN(DSECT);}
|
||||
<EXPRESSION,BOTH,SCRIPT>"COPY" { RTOKEN(COPY);}
|
||||
<EXPRESSION,BOTH,SCRIPT>"INFO" { RTOKEN(INFO);}
|
||||
diff --git a/ld/testsuite/ld-scripts/output-section-types.d b/ld/testsuite/ld-scripts/output-section-types.d
|
||||
new file mode 100644
|
||||
index 00000000000..ab124fa4dd7
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-scripts/output-section-types.d
|
||||
@@ -0,0 +1,13 @@
|
||||
+#ld: -Toutput-section-types.t
|
||||
+#source: align2a.s
|
||||
+#objdump: -h
|
||||
+#target: [is_elf_format]
|
||||
+
|
||||
+#...
|
||||
+ . \.rom.*
|
||||
+[ ]+ALLOC, READONLY
|
||||
+ . \.ro.*
|
||||
+[ ]+CONTENTS, ALLOC, LOAD, READONLY, DATA
|
||||
+ . \.over.*
|
||||
+[ ]+CONTENTS, READONLY
|
||||
+#pass
|
||||
diff --git a/ld/testsuite/ld-scripts/output-section-types.t b/ld/testsuite/ld-scripts/output-section-types.t
|
||||
new file mode 100644
|
||||
index 00000000000..d8fdfda1a03
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-scripts/output-section-types.t
|
||||
@@ -0,0 +1,7 @@
|
||||
+SECTIONS {
|
||||
+ .rom (NOLOAD) : { LONG(1234); }
|
||||
+ .ro (READONLY) : { LONG(5678); }
|
||||
+ .over (OVERLAY) : { LONG(0123); }
|
||||
+ /DISCARD/ : { *(*) }
|
||||
+
|
||||
+}
|
||||
diff --git a/ld/testsuite/ld-scripts/script.exp b/ld/testsuite/ld-scripts/script.exp
|
||||
index 961cd08c4b1..ff50199b3ae 100644
|
||||
--- a/ld/testsuite/ld-scripts/script.exp
|
||||
+++ b/ld/testsuite/ld-scripts/script.exp
|
||||
@@ -229,6 +229,7 @@ foreach test_script $test_script_list {
|
||||
|
||||
run_dump_test "align-with-input"
|
||||
run_dump_test "pr20302"
|
||||
+run_dump_test "output-section-types"
|
||||
|
||||
run_dump_test "segment-start" {{name (default)}}
|
||||
run_dump_test "segment-start" {{name (overridden)} \
|
||||
--
|
||||
2.30.2
|
||||
|
|
@ -0,0 +1,459 @@
|
|||
diff -rup binutils.orig/binutils/dwarf.c binutils-2.37/binutils/dwarf.c
|
||||
--- binutils.orig/binutils/dwarf.c 2022-05-21 13:12:31.851174169 +0100
|
||||
+++ binutils-2.37/binutils/dwarf.c 2022-05-21 13:12:58.798988551 +0100
|
||||
@@ -11533,7 +11533,11 @@ free_debug_memory (void)
|
||||
free_dwo_info ();
|
||||
}
|
||||
|
||||
-void
|
||||
+/* Enable display of specific DWARF sections as determined by the comma
|
||||
+ separated strings in NAMES. Returns non-zero if any displaying was
|
||||
+ enabled. */
|
||||
+
|
||||
+int
|
||||
dwarf_select_sections_by_names (const char *names)
|
||||
{
|
||||
typedef struct
|
||||
@@ -11586,6 +11590,7 @@ dwarf_select_sections_by_names (const ch
|
||||
};
|
||||
|
||||
const char *p;
|
||||
+ int result = 0;
|
||||
|
||||
p = names;
|
||||
while (*p)
|
||||
@@ -11600,6 +11605,7 @@ dwarf_select_sections_by_names (const ch
|
||||
&& (p[len] == ',' || p[len] == '\0'))
|
||||
{
|
||||
* entry->variable = entry->val;
|
||||
+ result |= entry->val;
|
||||
|
||||
/* The --debug-dump=frames-interp option also
|
||||
enables the --debug-dump=frames option. */
|
||||
@@ -11622,48 +11628,82 @@ dwarf_select_sections_by_names (const ch
|
||||
if (*p == ',')
|
||||
p++;
|
||||
}
|
||||
+
|
||||
+ return result;
|
||||
}
|
||||
|
||||
-void
|
||||
+/* Enable display of specific DWARF sections as determined by the characters
|
||||
+ in LETTERS. Returns non-zero if any displaying was enabled. */
|
||||
+
|
||||
+int
|
||||
dwarf_select_sections_by_letters (const char *letters)
|
||||
{
|
||||
- unsigned int lindex = 0;
|
||||
+ typedef struct
|
||||
+ {
|
||||
+ const char letter;
|
||||
+ int * variable;
|
||||
+ int val;
|
||||
+ bool cont;
|
||||
+ }
|
||||
+ debug_dump_letter_opts;
|
||||
|
||||
- while (letters[lindex])
|
||||
- switch (letters[lindex++])
|
||||
- {
|
||||
- case 'A': do_debug_addr = 1; break;
|
||||
- case 'a': do_debug_abbrevs = 1; break;
|
||||
- case 'c': do_debug_cu_index = 1; break;
|
||||
+ static const debug_dump_letter_opts letter_table [] =
|
||||
+ {
|
||||
+ { 'A', & do_debug_addr, 1, false},
|
||||
+ { 'a', & do_debug_abbrevs, 1, false },
|
||||
+ { 'c', & do_debug_cu_index, 1, false },
|
||||
#ifdef HAVE_LIBDEBUGINFOD
|
||||
- case 'D': use_debuginfod = 1; break;
|
||||
- case 'E': use_debuginfod = 0; break;
|
||||
+ { 'D', & use_debuginfod, 1, false },
|
||||
+ { 'E', & use_debuginfod, 0, false },
|
||||
#endif
|
||||
- case 'F': do_debug_frames_interp = 1; /* Fall through. */
|
||||
- case 'f': do_debug_frames = 1; break;
|
||||
- case 'g': do_gdb_index = 1; break;
|
||||
- case 'i': do_debug_info = 1; break;
|
||||
- case 'K': do_follow_links = 1; break;
|
||||
- case 'N': do_follow_links = 0; break;
|
||||
- case 'k': do_debug_links = 1; break;
|
||||
- case 'l': do_debug_lines |= FLAG_DEBUG_LINES_RAW; break;
|
||||
- case 'L': do_debug_lines |= FLAG_DEBUG_LINES_DECODED; break;
|
||||
- case 'm': do_debug_macinfo = 1; break;
|
||||
- case 'O': do_debug_str_offsets = 1; break;
|
||||
- case 'o': do_debug_loc = 1; break;
|
||||
- case 'p': do_debug_pubnames = 1; break;
|
||||
- case 'R': do_debug_ranges = 1; break;
|
||||
- case 'r': do_debug_aranges = 1; break;
|
||||
- case 's': do_debug_str = 1; break;
|
||||
- case 'T': do_trace_aranges = 1; break;
|
||||
- case 't': do_debug_pubtypes = 1; break;
|
||||
- case 'U': do_trace_info = 1; break;
|
||||
- case 'u': do_trace_abbrevs = 1; break;
|
||||
-
|
||||
- default:
|
||||
- warn (_("Unrecognized debug option '%s'\n"), letters);
|
||||
- break;
|
||||
- }
|
||||
+ { 'F', & do_debug_frames_interp, 1, true }, /* Note the fall through. */
|
||||
+ { 'f', & do_debug_frames, 1, false },
|
||||
+ { 'g', & do_gdb_index, 1, false },
|
||||
+ { 'i', & do_debug_info, 1, false },
|
||||
+ { 'K', & do_follow_links, 1, false },
|
||||
+ { 'k', & do_debug_links, 1, false },
|
||||
+ { 'L', & do_debug_lines, FLAG_DEBUG_LINES_DECODED, false },
|
||||
+ { 'l', & do_debug_lines, FLAG_DEBUG_LINES_RAW, false },
|
||||
+ { 'm', & do_debug_macinfo, 1, false },
|
||||
+ { 'N', & do_follow_links, 0, false },
|
||||
+ { 'O', & do_debug_str_offsets, 1, false },
|
||||
+ { 'o', & do_debug_loc, 1, false },
|
||||
+ { 'p', & do_debug_pubnames, 1, false },
|
||||
+ { 'R', & do_debug_ranges, 1, false },
|
||||
+ { 'r', & do_debug_aranges, 1, false },
|
||||
+ { 's', & do_debug_str, 1, false },
|
||||
+ { 'T', & do_trace_aranges, 1, false },
|
||||
+ { 't', & do_debug_pubtypes, 1, false },
|
||||
+ { 'U', & do_trace_info, 1, false },
|
||||
+ { 'u', & do_trace_abbrevs, 1, false },
|
||||
+ { 0, NULL, 0, false }
|
||||
+ };
|
||||
+
|
||||
+ int result = 0;
|
||||
+
|
||||
+ while (* letters)
|
||||
+ {
|
||||
+ const debug_dump_letter_opts * entry;
|
||||
+
|
||||
+ for (entry = letter_table; entry->letter; entry++)
|
||||
+ {
|
||||
+ if (entry->letter == * letters)
|
||||
+ {
|
||||
+ * entry->variable |= entry->val;
|
||||
+ result |= entry->val;
|
||||
+
|
||||
+ if (! entry->cont)
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (entry->letter == 0)
|
||||
+ warn (_("Unrecognized debug letter option '%c'\n"), * letters);
|
||||
+
|
||||
+ letters ++;
|
||||
+ }
|
||||
+
|
||||
+ return result;
|
||||
}
|
||||
|
||||
void
|
||||
Only in binutils-2.37/binutils/: dwarf.c.orig
|
||||
diff -rup binutils.orig/binutils/dwarf.h binutils-2.37/binutils/dwarf.h
|
||||
--- binutils.orig/binutils/dwarf.h 2022-05-21 13:12:31.854174148 +0100
|
||||
+++ binutils-2.37/binutils/dwarf.h 2022-05-21 13:12:58.799988544 +0100
|
||||
@@ -243,8 +243,8 @@ extern void *open_debug_file (const char
|
||||
|
||||
extern void free_debug_memory (void);
|
||||
|
||||
-extern void dwarf_select_sections_by_names (const char *);
|
||||
-extern void dwarf_select_sections_by_letters (const char *);
|
||||
+extern int dwarf_select_sections_by_names (const char *);
|
||||
+extern int dwarf_select_sections_by_letters (const char *);
|
||||
extern void dwarf_select_sections_all (void);
|
||||
|
||||
extern unsigned int * find_cu_tu_set (void *, unsigned int);
|
||||
Only in binutils-2.37/binutils/: dwarf.h.orig
|
||||
diff -rup binutils.orig/binutils/objdump.c binutils-2.37/binutils/objdump.c
|
||||
--- binutils.orig/binutils/objdump.c 2022-05-21 13:12:31.855174141 +0100
|
||||
+++ binutils-2.37/binutils/objdump.c 2022-05-21 13:14:42.740372795 +0100
|
||||
@@ -5010,6 +5010,26 @@ sign_extend_address (bfd *abfd ATTRIBUTE
|
||||
return (((vma & ((mask << 1) - 1)) ^ mask) - mask);
|
||||
}
|
||||
|
||||
+static bool
|
||||
+might_need_separate_debug_info (bool is_mainfile)
|
||||
+{
|
||||
+ /* We do not follow links from debug info files. */
|
||||
+ if (! is_mainfile)
|
||||
+ return false;
|
||||
+
|
||||
+ /* Since do_follow_links might be enabled by default, only treat it as an
|
||||
+ indication that separate files should be loaded if setting it was a
|
||||
+ deliberate user action. */
|
||||
+ if (DEFAULT_FOR_FOLLOW_LINKS == 0 && do_follow_links)
|
||||
+ return true;
|
||||
+
|
||||
+ if (process_links || dump_symtab || dump_debugging
|
||||
+ || dump_dwarf_section_info)
|
||||
+ return true;
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
/* Dump selected contents of ABFD. */
|
||||
|
||||
static void
|
||||
@@ -5024,16 +5044,8 @@ dump_bfd (bfd *abfd, bool is_mainfile)
|
||||
else
|
||||
byte_get = NULL;
|
||||
|
||||
- /* Load any separate debug information files.
|
||||
- We do this now and without checking do_follow_links because separate
|
||||
- debug info files may contain symbol tables that we will need when
|
||||
- displaying information about the main file. Any memory allocated by
|
||||
- load_separate_debug_files will be released when we call
|
||||
- free_debug_memory below.
|
||||
-
|
||||
- The test on is_mainfile is there because the chain of separate debug
|
||||
- info files is a global variable shared by all invocations of dump_bfd. */
|
||||
- if (is_mainfile)
|
||||
+ /* Load any separate debug information files. */
|
||||
+ if (byte_get != NULL && might_need_separate_debug_info (is_mainfile))
|
||||
{
|
||||
load_separate_debug_files (abfd, bfd_get_filename (abfd));
|
||||
|
||||
@@ -5588,20 +5600,30 @@ main (int argc, char **argv)
|
||||
do_follow_links = true;
|
||||
break;
|
||||
case 'W':
|
||||
- dump_dwarf_section_info = true;
|
||||
seenflag = true;
|
||||
if (optarg)
|
||||
- dwarf_select_sections_by_letters (optarg);
|
||||
+ {
|
||||
+ if (dwarf_select_sections_by_letters (optarg))
|
||||
+ dump_dwarf_section_info = true;
|
||||
+ }
|
||||
else
|
||||
- dwarf_select_sections_all ();
|
||||
+ {
|
||||
+ dump_dwarf_section_info = true;
|
||||
+ dwarf_select_sections_all ();
|
||||
+ }
|
||||
break;
|
||||
case OPTION_DWARF:
|
||||
- dump_dwarf_section_info = true;
|
||||
seenflag = true;
|
||||
if (optarg)
|
||||
- dwarf_select_sections_by_names (optarg);
|
||||
+ {
|
||||
+ if (dwarf_select_sections_by_names (optarg))
|
||||
+ dump_dwarf_section_info = true;
|
||||
+ }
|
||||
else
|
||||
- dwarf_select_sections_all ();
|
||||
+ {
|
||||
+ dwarf_select_sections_all ();
|
||||
+ dump_dwarf_section_info = true;
|
||||
+ }
|
||||
break;
|
||||
case OPTION_DWARF_DEPTH:
|
||||
{
|
||||
diff -rup binutils.orig/binutils/objdump.c.orig binutils-2.37/binutils/objdump.c.orig
|
||||
--- binutils.orig/binutils/objdump.c.orig 2022-05-21 13:12:31.872174024 +0100
|
||||
+++ binutils-2.37/binutils/objdump.c.orig 2022-05-21 13:12:22.066241569 +0100
|
||||
@@ -280,6 +280,14 @@ usage (FILE *stream, int status)
|
||||
Do not follow links to separate debug info files\n\
|
||||
(default)\n"));
|
||||
#endif
|
||||
+#if HAVE_LIBDEBUGINFOD
|
||||
+ fprintf (stream, _("\
|
||||
+ -WD --dwarf=use-debuginfod\n\
|
||||
+ When following links, also query debuginfod servers (default)\n"));
|
||||
+ fprintf (stream, _("\
|
||||
+ -WE --dwarf=do-not-use-debuginfod\n\
|
||||
+ When following links, do not query debuginfod servers\n"));
|
||||
+#endif
|
||||
fprintf (stream, _("\
|
||||
-L, --process-links Display the contents of non-debug sections in\n\
|
||||
separate debuginfo files. (Implies -WK)\n"));
|
||||
diff -rup binutils.orig/binutils/objdump.c.rej binutils-2.37/binutils/objdump.c.rej
|
||||
--- binutils.orig/binutils/objdump.c.rej 2022-05-21 13:12:31.872174024 +0100
|
||||
+++ binutils-2.37/binutils/objdump.c.rej 2022-05-21 13:12:58.800988538 +0100
|
||||
@@ -1,43 +1,21 @@
|
||||
---- binutils/objdump.c
|
||||
-+++ binutils/objdump.c
|
||||
-@@ -487,28 +517,16 @@ static struct option long_options[]=
|
||||
- {"source", no_argument, NULL, 'S'},
|
||||
- {"source-comment", optional_argument, NULL, OPTION_SOURCE_COMMENT},
|
||||
- {"special-syms", no_argument, &dump_special_syms, 1},
|
||||
-- {"include", required_argument, NULL, 'I'},
|
||||
-- {"dwarf", optional_argument, NULL, OPTION_DWARF},
|
||||
--#ifdef ENABLE_LIBCTF
|
||||
-- {"ctf", optional_argument, NULL, OPTION_CTF},
|
||||
-- {"ctf-parent", required_argument, NULL, OPTION_CTF_PARENT},
|
||||
--#endif
|
||||
- {"stabs", no_argument, NULL, 'G'},
|
||||
- {"start-address", required_argument, NULL, OPTION_START_ADDRESS},
|
||||
- {"stop-address", required_argument, NULL, OPTION_STOP_ADDRESS},
|
||||
- {"syms", no_argument, NULL, 't'},
|
||||
- {"target", required_argument, NULL, 'b'},
|
||||
-+ {"unicode", required_argument, NULL, 'U'},
|
||||
- {"version", no_argument, NULL, 'V'},
|
||||
-- {"wide", no_argument, NULL, 'w'},
|
||||
-- {"prefix", required_argument, NULL, OPTION_PREFIX},
|
||||
-- {"prefix-strip", required_argument, NULL, OPTION_PREFIX_STRIP},
|
||||
-- {"insn-width", required_argument, NULL, OPTION_INSN_WIDTH},
|
||||
-- {"dwarf-depth", required_argument, 0, OPTION_DWARF_DEPTH},
|
||||
-- {"dwarf-start", required_argument, 0, OPTION_DWARF_START},
|
||||
-- {"dwarf-check", no_argument, 0, OPTION_DWARF_CHECK},
|
||||
-- {"inlines", no_argument, 0, OPTION_INLINES},
|
||||
- {"visualize-jumps", optional_argument, 0, OPTION_VISUALIZE_JUMPS},
|
||||
-- {0, no_argument, 0, 0}
|
||||
-+ {"wide", no_argument, NULL, 'w'},
|
||||
-+ {NULL, no_argument, NULL, 0}
|
||||
- };
|
||||
-
|
||||
- static void
|
||||
-@@ -5375,7 +5533,7 @@ main (int argc, char **argv)
|
||||
- set_default_bfd_target ();
|
||||
+--- binutils/objdump.c 2022-05-20 16:57:16.566961359 +0100
|
||||
++++ binutils/objdump.c 2022-05-20 16:57:32.881853688 +0100
|
||||
+@@ -5042,16 +5062,8 @@ dump_bfd (bfd *abfd, bool is_mainfile)
|
||||
+ else
|
||||
+ byte_get = NULL;
|
||||
|
||||
- while ((c = getopt_long (argc, argv,
|
||||
-- "CDE:FGHI:LM:P:RSTVW::ab:defghij:lm:prstvwxz",
|
||||
-+ "CDE:FGHI:LM:P:RSTU:VW::ab:defghij:lm:prstvwxz",
|
||||
- long_options, (int *) 0))
|
||||
- != EOF)
|
||||
+- /* Load any separate debug information files.
|
||||
+- We do this now and without checking do_follow_links because separate
|
||||
+- debug info files may contain symbol tables that we will need when
|
||||
+- displaying information about the main file. Any memory allocated by
|
||||
+- load_separate_debug_files will be released when we call
|
||||
+- free_debug_memory below.
|
||||
+-
|
||||
+- The test on is_mainfile is there because the chain of separate debug
|
||||
+- info files is a global variable shared by all invocations of dump_bfd. */
|
||||
+- if (byte_get != NULL && is_mainfile)
|
||||
++ /* Load any separate debug information files. */
|
||||
++ if (byte_get != NULL && might_need_separate_debug_info (is_mainfile))
|
||||
{
|
||||
+ load_separate_debug_files (abfd, bfd_get_filename (abfd));
|
||||
+
|
||||
diff -rup binutils.orig/binutils/readelf.c binutils-2.37/binutils/readelf.c
|
||||
--- binutils.orig/binutils/readelf.c 2022-05-21 13:12:31.853174155 +0100
|
||||
+++ binutils-2.37/binutils/readelf.c 2022-05-21 13:12:58.802988523 +0100
|
||||
@@ -21632,6 +21632,26 @@ initialise_dump_sects (Filedata * fileda
|
||||
}
|
||||
}
|
||||
|
||||
+static bool
|
||||
+might_need_separate_debug_info (Filedata * filedata)
|
||||
+{
|
||||
+ /* Debuginfo files do not need further separate file loading. */
|
||||
+ if (filedata->file_header.e_shstrndx == SHN_UNDEF)
|
||||
+ return false;
|
||||
+
|
||||
+ /* Since do_follow_links might be enabled by default, only treat it as an
|
||||
+ indication that separate files should be loaded if setting it was a
|
||||
+ deliberate user action. */
|
||||
+ if (DEFAULT_FOR_FOLLOW_LINKS == 0 && do_follow_links)
|
||||
+ return true;
|
||||
+
|
||||
+ if (process_links || do_syms || do_unwind
|
||||
+ || do_dump || do_debugging)
|
||||
+ return true;
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
/* Process one ELF object file according to the command line options.
|
||||
This file may actually be stored in an archive. The file is
|
||||
positioned at the start of the ELF object. Returns TRUE if no
|
||||
@@ -21715,7 +21735,7 @@ process_object (Filedata * filedata)
|
||||
if (! process_version_sections (filedata))
|
||||
res = false;
|
||||
|
||||
- if (filedata->file_header.e_shstrndx != SHN_UNDEF)
|
||||
+ if (might_need_separate_debug_info (filedata))
|
||||
have_separate_files = load_separate_debug_files (filedata, filedata->file_name);
|
||||
else
|
||||
have_separate_files = false;
|
||||
diff -rup binutils.orig/binutils/readelf.c.orig binutils-2.37/binutils/readelf.c.orig
|
||||
--- binutils.orig/binutils/readelf.c.orig 2022-05-21 13:12:31.854174148 +0100
|
||||
+++ binutils-2.37/binutils/readelf.c.orig 2022-05-21 13:12:22.077241494 +0100
|
||||
@@ -4955,6 +4955,14 @@ usage (FILE * stream)
|
||||
Do not follow links to separate debug info files\n\
|
||||
(default)\n"));
|
||||
#endif
|
||||
+#if HAVE_LIBDEBUGINFOD
|
||||
+ fprintf (stream, _("\
|
||||
+ -wD --debug-dump=use-debuginfod\n\
|
||||
+ When following links, also query debuginfod servers (default)\n"));
|
||||
+ fprintf (stream, _("\
|
||||
+ -wE --debug-dump=do-not-use-debuginfod\n\
|
||||
+ When following links, do not query debuginfod servers\n"));
|
||||
+#endif
|
||||
fprintf (stream, _("\
|
||||
--dwarf-depth=N Do not display DIEs at depth N or greater\n"));
|
||||
fprintf (stream, _("\
|
||||
diff -rup binutils.orig/binutils/testsuite/binutils-all/debuginfod.exp binutils-2.37/binutils/testsuite/binutils-all/debuginfod.exp
|
||||
--- binutils.orig/binutils/testsuite/binutils-all/debuginfod.exp 2022-05-21 13:12:31.872174024 +0100
|
||||
+++ binutils-2.37/binutils/testsuite/binutils-all/debuginfod.exp 2022-05-21 13:12:58.803988517 +0100
|
||||
@@ -188,7 +188,7 @@ if { [regexp ".*DEBUGINFOD.*" $conf_objd
|
||||
test_fetch_debugaltlink $OBJDUMP "-Wk"
|
||||
|
||||
set test "disabling debuginfod access"
|
||||
- setup_xfail *-*-*
|
||||
+ # setup_xfail *-*-*
|
||||
test_fetch_debuglink $OBJDUMP "-W -WE"
|
||||
set test "debuginfod"
|
||||
|
||||
@@ -201,7 +201,7 @@ if { [regexp ".*DEBUGINFOD.*" $conf_read
|
||||
test_fetch_debugaltlink $READELF "-wk"
|
||||
|
||||
set test "disabling debuginfod access"
|
||||
- setup_xfail *-*-*
|
||||
+ # setup_xfail *-*-*
|
||||
test_fetch_debuglink $READELF "-w -wE"
|
||||
set test "debuginfod"
|
||||
|
||||
Only in binutils-2.37/binutils/testsuite/binutils-all: debuginfod.exp.orig
|
||||
diff -rup binutils.orig/binutils/testsuite/binutils-all/objdump.Wk binutils-2.37/binutils/testsuite/binutils-all/objdump.Wk
|
||||
--- binutils.orig/binutils/testsuite/binutils-all/objdump.Wk 2022-05-21 13:12:31.862174093 +0100
|
||||
+++ binutils-2.37/binutils/testsuite/binutils-all/objdump.Wk 2022-05-21 13:12:58.803988517 +0100
|
||||
@@ -1,8 +1,9 @@
|
||||
+#...
|
||||
tmpdir/debuglink\.o: file format .*
|
||||
-Contents of the \.gnu_debuglink section:
|
||||
+Contents of the \.gnu_debuglink section.*
|
||||
Separate debug info file: this_is_a_debuglink\.debug
|
||||
CRC value: 0x12345678
|
||||
-Contents of the \.gnu_debugaltlink section:
|
||||
+Contents of the \.gnu_debugaltlink section.*
|
||||
Separate debug info file: linkdebug\.debug
|
||||
Build-ID \(0x18 bytes\):
|
||||
00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff 01 23 45 67 89 ab cd ef
|
||||
diff -rup binutils.orig/binutils/testsuite/binutils-all/readelf.k binutils-2.37/binutils/testsuite/binutils-all/readelf.k
|
||||
--- binutils.orig/binutils/testsuite/binutils-all/readelf.k 2022-05-21 13:12:31.863174086 +0100
|
||||
+++ binutils-2.37/binutils/testsuite/binutils-all/readelf.k 2022-05-21 13:12:58.812988455 +0100
|
||||
@@ -1,7 +1,8 @@
|
||||
-Contents of the \.gnu_debuglink section:
|
||||
+#...
|
||||
+Contents of the \.gnu_debuglink section.*
|
||||
Separate debug info file: this_is_a_debuglink\.debug
|
||||
CRC value: 0x12345678
|
||||
-Contents of the \.gnu_debugaltlink section:
|
||||
+Contents of the \.gnu_debugaltlink section.*
|
||||
Separate debug info file: linkdebug\.debug
|
||||
Build-ID \(0x18 bytes\):
|
||||
00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff 01 23 45 67 89 ab cd ef
|
||||
Only in binutils-2.37/binutils/testsuite/binutils-all: debuginfod.exp.orig
|
||||
--- binutils.orig/binutils/dwarf.c 2022-06-30 15:28:53.484593360 +0100
|
||||
+++ binutils-2.37/binutils/dwarf.c 2022-06-30 15:32:22.112213811 +0100
|
||||
@@ -11689,7 +11689,10 @@ dwarf_select_sections_by_letters (const
|
||||
{
|
||||
if (entry->letter == * letters)
|
||||
{
|
||||
- * entry->variable |= entry->val;
|
||||
+ if (entry->val == 0)
|
||||
+ * entry->variable = 0;
|
||||
+ else
|
||||
+ * entry->variable |= entry->val;
|
||||
result |= entry->val;
|
||||
|
||||
if (! entry->cont)
|
|
@ -0,0 +1,12 @@
|
|||
diff -rup binutils.orig/etc/texi2pod.pl binutils-2.37/etc/texi2pod.pl
|
||||
--- binutils.orig/etc/texi2pod.pl 2021-08-10 10:15:38.063964450 +0100
|
||||
+++ binutils-2.37/etc/texi2pod.pl 2021-08-10 16:52:51.705688992 +0100
|
||||
@@ -59,6 +59,8 @@ while ($_ = shift) {
|
||||
$flag = shift;
|
||||
}
|
||||
push (@ipath, $flag);
|
||||
+ } elsif (/^--no-split$/) {
|
||||
+ # ignore option for makeinfo compatibility
|
||||
} elsif (/^-/) {
|
||||
usage();
|
||||
} else {
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,29 @@
|
|||
diff -rup binutils.orig/binutils/readelf.c binutils-2.37/binutils/readelf.c
|
||||
--- binutils.orig/binutils/readelf.c 2022-02-10 10:10:21.508156583 +0000
|
||||
+++ binutils-2.37/binutils/readelf.c 2022-02-10 10:13:36.486511842 +0000
|
||||
@@ -5457,10 +5457,7 @@ process_file_header (Filedata * filedata
|
||||
if (filedata->section_headers != NULL
|
||||
&& header->e_phnum == PN_XNUM
|
||||
&& filedata->section_headers[0].sh_info != 0)
|
||||
- {
|
||||
- header->e_phnum = filedata->section_headers[0].sh_info;
|
||||
- printf (" (%u)", header->e_phnum);
|
||||
- }
|
||||
+ printf (" (%u)", filedata->section_headers[0].sh_info);
|
||||
putc ('\n', stdout);
|
||||
printf (_(" Size of section headers: %u (bytes)\n"),
|
||||
header->e_shentsize);
|
||||
@@ -5493,7 +5490,12 @@ process_file_header (Filedata * filedata
|
||||
{
|
||||
if (header->e_phnum == PN_XNUM
|
||||
&& filedata->section_headers[0].sh_info != 0)
|
||||
- header->e_phnum = filedata->section_headers[0].sh_info;
|
||||
+ {
|
||||
+ /* Throw away any cached read of PN_XNUM headers. */
|
||||
+ free (filedata->program_headers);
|
||||
+ filedata->program_headers = NULL;
|
||||
+ header->e_phnum = filedata->section_headers[0].sh_info;
|
||||
+ }
|
||||
if (header->e_shnum == SHN_UNDEF)
|
||||
header->e_shnum = filedata->section_headers[0].sh_size;
|
||||
if (header->e_shstrndx == (SHN_XINDEX & 0xffff))
|
|
@ -0,0 +1,29 @@
|
|||
--- binutils.orig/binutils/readelf.c 2022-10-03 13:20:42.707527855 +0100
|
||||
+++ binutils-2.39/binutils/readelf.c 2022-10-03 13:21:25.785436781 +0100
|
||||
@@ -6357,6 +6357,13 @@ get_32bit_section_headers (Filedata * fi
|
||||
/* PR binutils/17531: Cope with unexpected section header sizes. */
|
||||
if (size == 0 || num == 0)
|
||||
return false;
|
||||
+
|
||||
+ /* The section header cannot be at the start of the file - that is
|
||||
+ where the ELF file header is located. A file with absolutely no
|
||||
+ sections in it will use a shoff of 0. */
|
||||
+ if (filedata->file_header.e_shoff == 0)
|
||||
+ return false;
|
||||
+
|
||||
if (size < sizeof * shdrs)
|
||||
{
|
||||
if (! probe)
|
||||
@@ -6421,6 +6428,12 @@ get_64bit_section_headers (Filedata * fi
|
||||
if (size == 0 || num == 0)
|
||||
return false;
|
||||
|
||||
+ /* The section header cannot be at the start of the file - that is
|
||||
+ where the ELF file header is located. A file with absolutely no
|
||||
+ sections in it will use a shoff of 0. */
|
||||
+ if (filedata->file_header.e_shoff == 0)
|
||||
+ return false;
|
||||
+
|
||||
if (size < sizeof * shdrs)
|
||||
{
|
||||
if (! probe)
|
|
@ -1,25 +1,24 @@
|
|||
diff -rup binutils.orig/binutils/readelf.c binutils-2.29/binutils/readelf.c
|
||||
--- binutils.orig/binutils/readelf.c 2017-12-12 16:24:19.571221194 +0000
|
||||
+++ binutils-2.29/binutils/readelf.c 2017-12-12 16:27:26.997979803 +0000
|
||||
@@ -11018,12 +11018,14 @@ print_dynamic_symbol (bfd_vma si, unsign
|
||||
--- binutils.orig/binutils/readelf.c 2020-07-24 15:08:30.317597020 +0100
|
||||
+++ binutils-2.35/binutils/readelf.c 2020-07-24 15:09:39.029155552 +0100
|
||||
@@ -12069,11 +12069,13 @@ print_dynamic_symbol (Filedata *filedata
|
||||
unsigned int vis = ELF_ST_VISIBILITY (psym->st_other);
|
||||
|
||||
printf (" %-7s", get_symbol_visibility (vis));
|
||||
printf (" %-7s", get_symbol_visibility (vis));
|
||||
+#if 0
|
||||
/* Check to see if any other bits in the st_other field are set.
|
||||
Note - displaying this information disrupts the layout of the
|
||||
table being generated, but for the moment this case is very
|
||||
rare. */
|
||||
table being generated, but for the moment this case is very rare. */
|
||||
if (psym->st_other ^ vis)
|
||||
printf (" [%s] ", get_symbol_other (filedata, psym->st_other ^ vis));
|
||||
+#endif
|
||||
}
|
||||
printf (" %4s ", get_symbol_index_type (filedata, psym->st_shndx));
|
||||
|
||||
printf (" %3.3s ", get_symbol_index_type (filedata, psym->st_shndx));
|
||||
@@ -11031,6 +11033,15 @@ print_dynamic_symbol (bfd_vma si, unsign
|
||||
print_symbol (25, GET_DYNAMIC_NAME (psym->st_name));
|
||||
else
|
||||
printf (_(" <corrupt: %14ld>"), psym->st_name);
|
||||
@@ -12112,7 +12114,17 @@ print_dynamic_symbol (Filedata *filedata
|
||||
version_string);
|
||||
}
|
||||
|
||||
- putchar ('\n');
|
||||
+#if 1
|
||||
+ {
|
||||
+ unsigned int vis = ELF_ST_VISIBILITY (psym->st_other);
|
||||
|
@ -29,38 +28,8 @@ diff -rup binutils.orig/binutils/readelf.c binutils-2.29/binutils/readelf.c
|
|||
+ printf (" \t[%s]", get_symbol_other (filedata, psym->st_other ^ vis));
|
||||
+ }
|
||||
+#endif
|
||||
putchar ('\n');
|
||||
}
|
||||
+
|
||||
+ putchar ('\n');
|
||||
|
||||
--- binutils.orig/binutils/readelf.c 2017-12-12 16:36:21.806561149 +0000
|
||||
+++ binutils-2.29.1/binutils/readelf.c 2017-12-12 16:38:17.763168514 +0000
|
||||
@@ -11548,11 +11548,13 @@ process_symbol_table (FILE * file)
|
||||
unsigned int vis = ELF_ST_VISIBILITY (psym->st_other);
|
||||
|
||||
printf (" %-7s", get_symbol_visibility (vis));
|
||||
+#if 0
|
||||
/* Check to see if any other bits in the st_other field are set.
|
||||
Note - displaying this information disrupts the layout of the
|
||||
table being generated, but for the moment this case is very rare. */
|
||||
if (psym->st_other ^ vis)
|
||||
printf (" [%s] ", get_symbol_other (filedata, psym->st_other ^ vis));
|
||||
+#endif
|
||||
}
|
||||
printf (" %4s ", get_symbol_index_type (filedata, psym->st_shndx));
|
||||
print_symbol (25, psym->st_name < strtab_size
|
||||
@@ -11571,7 +11573,15 @@ process_symbol_table (FILE * file)
|
||||
printf (sym_info == symbol_hidden ? "@%s" : "@@%s",
|
||||
version_string);
|
||||
}
|
||||
+#if 1
|
||||
+ {
|
||||
+ unsigned int vis = ELF_ST_VISIBILITY (psym->st_other);
|
||||
|
||||
+ /* Check to see if any other bits in the st_other field are set. */
|
||||
+ if (psym->st_other ^ vis)
|
||||
+ printf (" \t[%s] ", get_symbol_other (filedata, psym->st_other ^ vis));
|
||||
+ }
|
||||
+#endif
|
||||
putchar ('\n');
|
||||
|
||||
if (ELF_ST_BIND (psym->st_info) == STB_LOCAL
|
||||
if (ELF_ST_BIND (psym->st_info) == STB_LOCAL
|
||||
&& section != NULL
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
From 92608c3a98e943bb0d43408e84d4f419f87b5f1f Mon Sep 17 00:00:00 2001
|
||||
From: Luca Boccassi <luca.boccassi@gmail.com>
|
||||
Date: Wed, 1 Dec 2021 14:44:25 +0000
|
||||
Subject: [PATCH] readelf: recognize FDO Packaging Metadata ELF note
|
||||
|
||||
As defined on: https://systemd.io/COREDUMP_PACKAGE_METADATA/
|
||||
this note will be used starting from Fedora 36. Allow
|
||||
readelf --notes to pretty print it:
|
||||
|
||||
Displaying notes found in: .note.package
|
||||
Owner Data size Description
|
||||
FDO 0x00000039 FDO_PACKAGING_METADATA
|
||||
Packaging Metadata: {"type":"deb","name":"fsverity-utils","version":"1.3-1"}
|
||||
|
||||
Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
|
||||
(cherry picked from commit e5382207cdddea07c6456fc1c0e6bea73b3d9947)
|
||||
---
|
||||
binutils/readelf.c | 15 +++++++++++++++
|
||||
include/elf/common.h | 3 +++
|
||||
2 files changed, 18 insertions(+)
|
||||
|
||||
diff --git a/binutils/readelf.c b/binutils/readelf.c
|
||||
index a6073f7ec80..a92dce3114f 100644
|
||||
--- a/binutils/readelf.c
|
||||
+++ b/binutils/readelf.c
|
||||
@@ -18861,6 +18861,8 @@ get_note_type (Filedata * filedata, unsigned e_type)
|
||||
return _("func");
|
||||
case NT_GO_BUILDID:
|
||||
return _("GO BUILDID");
|
||||
+ case FDO_PACKAGING_METADATA:
|
||||
+ return _("FDO_PACKAGING_METADATA");
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -20012,6 +20014,17 @@ print_stapsdt_note (Elf_Internal_Note *pnote)
|
||||
return false;
|
||||
}
|
||||
|
||||
+static bool
|
||||
+print_fdo_note (Elf_Internal_Note * pnote)
|
||||
+{
|
||||
+ if (pnote->descsz > 0 && pnote->type == FDO_PACKAGING_METADATA)
|
||||
+ {
|
||||
+ printf (_(" Packaging Metadata: %.*s\n"), (int) pnote->descsz, pnote->descdata);
|
||||
+ return true;
|
||||
+ }
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
static const char *
|
||||
get_ia64_vms_note_type (unsigned e_type)
|
||||
{
|
||||
@@ -20741,6 +20754,8 @@ process_note (Elf_Internal_Note * pnote,
|
||||
return print_stapsdt_note (pnote);
|
||||
else if (startswith (pnote->namedata, "CORE"))
|
||||
return print_core_note (pnote);
|
||||
+ else if (startswith (pnote->namedata, "FDO"))
|
||||
+ return print_fdo_note (pnote);
|
||||
else if (((startswith (pnote->namedata, "GA")
|
||||
&& strchr ("*$!+", pnote->namedata[2]) != NULL)
|
||||
|| strchr ("*$!+", pnote->namedata[0]) != NULL)
|
||||
diff --git a/include/elf/common.h b/include/elf/common.h
|
||||
index 0cca28673dd..8ee17c84a97 100644
|
||||
--- a/include/elf/common.h
|
||||
+++ b/include/elf/common.h
|
||||
@@ -953,6 +953,9 @@
|
||||
|
||||
#define NT_FREEBSD_ABI_TAG 1
|
||||
|
||||
+/* Values for FDO .note.package notes as defined on https://systemd.io/COREDUMP_PACKAGE_METADATA/ */
|
||||
+#define FDO_PACKAGING_METADATA 0xcafe1a7e
|
||||
+
|
||||
/* These three macros disassemble and assemble a symbol table st_info field,
|
||||
which contains the symbol binding and symbol type. The STB_ and STT_
|
||||
defines identify the binding and type. */
|
||||
--
|
||||
2.30.2
|
||||
|
|
@ -0,0 +1,184 @@
|
|||
From 30cbd32aec30b4bc13427bbd87c4c63c739d4578 Mon Sep 17 00:00:00 2001
|
||||
From: Steiner H Gunderson <steinar+sourceware@gunderson.no>
|
||||
Date: Mon, 21 Mar 2022 14:29:12 +0000
|
||||
Subject: [PATCH] Reduce O(n2) performance overhead when parsing DWARF unit
|
||||
information.
|
||||
|
||||
PR 28978
|
||||
* dwarf2.c (scan_unit_for_symbols): When performing second pass,
|
||||
check to see if the function or variable being processed is the
|
||||
same as the previous one.
|
||||
---
|
||||
bfd/ChangeLog | 7 ++++
|
||||
bfd/dwarf2.c | 93 +++++++++++++++++++++++++++++++++------------------
|
||||
2 files changed, 67 insertions(+), 33 deletions(-)
|
||||
|
||||
//diff --git a/bfd/ChangeLog b/bfd/ChangeLog
|
||||
//index 6ac8b96c57a..fcf5abad5a1 100644
|
||||
//--- a/bfd/ChangeLog
|
||||
//+++ b/bfd/ChangeLog
|
||||
//@@ -1,3 +1,10 @@
|
||||
//+2022-03-21 Steiner H Gunderson <steinar+sourceware@gunderson.no>
|
||||
//+
|
||||
//+ PR 28978
|
||||
//+ * dwarf2.c (scan_unit_for_symbols): When performing second pass,
|
||||
//+ check to see if the function or variable being processed is the
|
||||
//+ same as the previous one.
|
||||
//+
|
||||
2022-03-18 Viorel Preoteasa <viorel.preoteasa@gmail.com>
|
||||
|
||||
PR 28924
|
||||
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
|
||||
index fdf071c36e9..bb176798f9a 100644
|
||||
--- a/bfd/dwarf2.c
|
||||
+++ b/bfd/dwarf2.c
|
||||
@@ -3293,6 +3293,36 @@ lookup_var_by_offset (bfd_uint64_t offset, struct varinfo * table)
|
||||
|
||||
/* DWARF2 Compilation unit functions. */
|
||||
|
||||
+static struct funcinfo *
|
||||
+reverse_funcinfo_list (struct funcinfo *head)
|
||||
+{
|
||||
+ struct funcinfo *rhead;
|
||||
+ struct funcinfo *temp;
|
||||
+
|
||||
+ for (rhead = NULL; head; head = temp)
|
||||
+ {
|
||||
+ temp = head->prev_func;
|
||||
+ head->prev_func = rhead;
|
||||
+ rhead = head;
|
||||
+ }
|
||||
+ return rhead;
|
||||
+}
|
||||
+
|
||||
+static struct varinfo *
|
||||
+reverse_varinfo_list (struct varinfo *head)
|
||||
+{
|
||||
+ struct varinfo *rhead;
|
||||
+ struct varinfo *temp;
|
||||
+
|
||||
+ for (rhead = NULL; head; head = temp)
|
||||
+ {
|
||||
+ temp = head->prev_var;
|
||||
+ head->prev_var = rhead;
|
||||
+ rhead = head;
|
||||
+ }
|
||||
+ return rhead;
|
||||
+}
|
||||
+
|
||||
/* Scan over each die in a comp. unit looking for functions to add
|
||||
to the function table and variables to the variable table. */
|
||||
|
||||
@@ -3308,7 +3338,9 @@ scan_unit_for_symbols (struct comp_unit *unit)
|
||||
struct funcinfo *func;
|
||||
} *nested_funcs;
|
||||
int nested_funcs_size;
|
||||
-
|
||||
+ struct funcinfo *last_func;
|
||||
+ struct varinfo *last_var;
|
||||
+
|
||||
/* Maintain a stack of in-scope functions and inlined functions, which we
|
||||
can use to set the caller_func field. */
|
||||
nested_funcs_size = 32;
|
||||
@@ -3442,10 +3474,16 @@ scan_unit_for_symbols (struct comp_unit *unit)
|
||||
}
|
||||
}
|
||||
|
||||
+ unit->function_table = reverse_funcinfo_list (unit->function_table);
|
||||
+ unit->variable_table = reverse_varinfo_list (unit->variable_table);
|
||||
+
|
||||
/* This is the second pass over the abbrevs. */
|
||||
info_ptr = unit->first_child_die_ptr;
|
||||
nesting_level = 0;
|
||||
|
||||
+ last_func = NULL;
|
||||
+ last_var = NULL;
|
||||
+
|
||||
while (nesting_level >= 0)
|
||||
{
|
||||
unsigned int abbrev_number, i;
|
||||
@@ -3481,16 +3519,32 @@ scan_unit_for_symbols (struct comp_unit *unit)
|
||||
|| abbrev->tag == DW_TAG_entry_point
|
||||
|| abbrev->tag == DW_TAG_inlined_subroutine)
|
||||
{
|
||||
- func = lookup_func_by_offset (current_offset, unit->function_table);
|
||||
+ if (last_func
|
||||
+ && last_func->prev_func
|
||||
+ && last_func->prev_func->unit_offset == current_offset)
|
||||
+ func = last_func->prev_func;
|
||||
+ else
|
||||
+ func = lookup_func_by_offset (current_offset, unit->function_table);
|
||||
+
|
||||
if (func == NULL)
|
||||
goto fail;
|
||||
+
|
||||
+ last_func = func;
|
||||
}
|
||||
else if (abbrev->tag == DW_TAG_variable
|
||||
|| abbrev->tag == DW_TAG_member)
|
||||
{
|
||||
- var = lookup_var_by_offset (current_offset, unit->variable_table);
|
||||
+ if (last_var
|
||||
+ && last_var->prev_var
|
||||
+ && last_var->prev_var->unit_offset == current_offset)
|
||||
+ var = last_var->prev_var;
|
||||
+ else
|
||||
+ var = lookup_var_by_offset (current_offset, unit->variable_table);
|
||||
+
|
||||
if (var == NULL)
|
||||
goto fail;
|
||||
+
|
||||
+ last_var = var;
|
||||
}
|
||||
|
||||
for (i = 0; i < abbrev->num_attrs; ++i)
|
||||
@@ -3684,6 +3738,9 @@ scan_unit_for_symbols (struct comp_unit *unit)
|
||||
}
|
||||
}
|
||||
|
||||
+ unit->function_table = reverse_funcinfo_list (unit->function_table);
|
||||
+ unit->variable_table = reverse_varinfo_list (unit->variable_table);
|
||||
+
|
||||
free (nested_funcs);
|
||||
return true;
|
||||
|
||||
@@ -4047,36 +4104,6 @@ comp_unit_find_line (struct comp_unit *unit,
|
||||
linenumber_ptr);
|
||||
}
|
||||
|
||||
-static struct funcinfo *
|
||||
-reverse_funcinfo_list (struct funcinfo *head)
|
||||
-{
|
||||
- struct funcinfo *rhead;
|
||||
- struct funcinfo *temp;
|
||||
-
|
||||
- for (rhead = NULL; head; head = temp)
|
||||
- {
|
||||
- temp = head->prev_func;
|
||||
- head->prev_func = rhead;
|
||||
- rhead = head;
|
||||
- }
|
||||
- return rhead;
|
||||
-}
|
||||
-
|
||||
-static struct varinfo *
|
||||
-reverse_varinfo_list (struct varinfo *head)
|
||||
-{
|
||||
- struct varinfo *rhead;
|
||||
- struct varinfo *temp;
|
||||
-
|
||||
- for (rhead = NULL; head; head = temp)
|
||||
- {
|
||||
- temp = head->prev_var;
|
||||
- head->prev_var = rhead;
|
||||
- rhead = head;
|
||||
- }
|
||||
- return rhead;
|
||||
-}
|
||||
-
|
||||
/* Extract all interesting funcinfos and varinfos of a compilation
|
||||
unit into hash tables for faster lookup. Returns TRUE if no
|
||||
errors were enountered; FALSE otherwise. */
|
||||
--
|
||||
2.37.2
|
||||
|
|
@ -67,29 +67,6 @@ diff -rup binutils.orig/ld/testsuite/ld-x86-64/pltgot-2.d binutils-2.29.1/ld/tes
|
|||
#...
|
||||
+0x[0-9a-f]+ +\(PLTREL.*
|
||||
#...
|
||||
diff -rup binutils.orig/ld/testsuite/ld-x86-64/plt-main-bnd.dd binutils-2.29.1/ld/testsuite/ld-x86-64/plt-main-bnd.dd
|
||||
--- binutils.orig/ld/testsuite/ld-x86-64/plt-main-bnd.dd 2017-11-15 13:32:39.405064420 +0000
|
||||
+++ binutils-2.29.1/ld/testsuite/ld-x86-64/plt-main-bnd.dd 2017-11-15 15:06:53.694623801 +0000
|
||||
@@ -1,7 +1,4 @@
|
||||
-#...
|
||||
-Disassembly of section .plt.got:
|
||||
|
||||
-[a-f0-9]+ <[a-z_]+@plt>:
|
||||
-[ ]*[a-f0-9]+: f2 ff 25 .. .. 20 00 bnd jmpq \*0x20....\(%rip\) # ...... <.*>
|
||||
+#...
|
||||
[ ]*[a-f0-9]+: 90 nop
|
||||
#pass
|
||||
diff -rup binutils.orig/ld/testsuite/ld-x86-64/plt-main-ibt.dd binutils-2.29.1/ld/testsuite/ld-x86-64/plt-main-ibt.dd
|
||||
--- binutils.orig/ld/testsuite/ld-x86-64/plt-main-ibt.dd 2017-11-15 13:32:39.412064336 +0000
|
||||
+++ binutils-2.29.1/ld/testsuite/ld-x86-64/plt-main-ibt.dd 2017-11-15 15:06:35.148842897 +0000
|
||||
@@ -1,7 +1,3 @@
|
||||
#...
|
||||
-Disassembly of section .plt.got:
|
||||
-
|
||||
-[a-f0-9]+ <[_a-z]+@plt>:
|
||||
[ ]*[a-f0-9]+: f3 0f 1e fa endbr64
|
||||
-[ ]*[a-f0-9]+: f2 ff 25 .. .. 20 00 bnd jmpq \*0x20....\(%rip\) # ...... <[_a-z]+>
|
||||
#pass
|
||||
diff -rup binutils.orig/ld/testsuite/ld-x86-64/plt-main.rd binutils-2.29.1/ld/testsuite/ld-x86-64/plt-main.rd
|
||||
--- binutils.orig/ld/testsuite/ld-x86-64/plt-main.rd 2017-11-15 13:32:39.407064397 +0000
|
||||
+++ binutils-2.29.1/ld/testsuite/ld-x86-64/plt-main.rd 2017-11-15 15:06:17.244054423 +0000
|
|
@ -0,0 +1,142 @@
|
|||
diff -rup binutils.orig/bfd/elf64-s390.c binutils-2.37/bfd/elf64-s390.c
|
||||
--- binutils.orig/bfd/elf64-s390.c 2022-05-19 11:32:09.424050559 +0100
|
||||
+++ binutils-2.37/bfd/elf64-s390.c 2022-05-19 11:32:29.169924728 +0100
|
||||
@@ -774,7 +774,7 @@ elf_s390_tls_transition (struct bfd_link
|
||||
int r_type,
|
||||
int is_local)
|
||||
{
|
||||
- if (bfd_link_pic (info))
|
||||
+ if (bfd_link_dll (info))
|
||||
return r_type;
|
||||
|
||||
switch (r_type)
|
||||
@@ -1026,7 +1026,7 @@ elf_s390_check_relocs (bfd *abfd,
|
||||
case R_390_TLS_GOTIE20:
|
||||
case R_390_TLS_GOTIE64:
|
||||
case R_390_TLS_IEENT:
|
||||
- if (bfd_link_pic (info))
|
||||
+ if (bfd_link_dll (info))
|
||||
info->flags |= DF_STATIC_TLS;
|
||||
/* Fall through */
|
||||
|
||||
@@ -1107,7 +1107,7 @@ elf_s390_check_relocs (bfd *abfd,
|
||||
if (r_type == R_390_TLS_LE64 && bfd_link_pie (info))
|
||||
break;
|
||||
|
||||
- if (!bfd_link_pic (info))
|
||||
+ if (!bfd_link_dll (info))
|
||||
break;
|
||||
info->flags |= DF_STATIC_TLS;
|
||||
/* Fall through */
|
||||
@@ -1571,7 +1571,7 @@ allocate_dynrelocs (struct elf_link_hash
|
||||
to R_390_TLS_LE64 requiring no TLS entry. For GOTIE12 and IEENT
|
||||
we can save the dynamic TLS relocation. */
|
||||
if (h->got.refcount > 0
|
||||
- && !bfd_link_pic (info)
|
||||
+ && !bfd_link_dll (info)
|
||||
&& h->dynindx == -1
|
||||
&& elf_s390_hash_entry(h)->tls_type >= GOT_TLS_IE)
|
||||
{
|
||||
@@ -1876,7 +1876,20 @@ elf_s390_size_dynamic_sections (bfd *out
|
||||
else if (startswith (bfd_section_name (s), ".rela"))
|
||||
{
|
||||
if (s->size != 0 && s != htab->elf.srelplt)
|
||||
- relocs = true;
|
||||
+ {
|
||||
+ relocs = true;
|
||||
+ if (s == htab->elf.irelplt)
|
||||
+ {
|
||||
+ /* In static-pie case, there are IRELATIVE-relocs in
|
||||
+ .rela.iplt (htab->irelplt), which will later be grouped
|
||||
+ to .rela.plt. On s390, the IRELATIVE relocations are
|
||||
+ always located in .rela.iplt - even for non-static case.
|
||||
+ Ensure that DT_JMPREL, DT_PLTRELA, DT_PLTRELASZ is added
|
||||
+ to the dynamic section even if htab->srelplt->size == 0.
|
||||
+ See _bfd_elf_add_dynamic_tags in bfd/elflink.c. */
|
||||
+ htab->elf.dt_jmprel_required = true;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
/* We use the reloc_count field as a counter if we need
|
||||
to copy relocs into the output file. */
|
||||
@@ -2662,7 +2675,7 @@ elf_s390_relocate_section (bfd *output_b
|
||||
|
||||
/* Relocations for tls literal pool entries. */
|
||||
case R_390_TLS_IE64:
|
||||
- if (bfd_link_pic (info))
|
||||
+ if (bfd_link_dll (info))
|
||||
{
|
||||
Elf_Internal_Rela outrel;
|
||||
asection *sreloc;
|
||||
@@ -2690,7 +2703,7 @@ elf_s390_relocate_section (bfd *output_b
|
||||
else if (h != NULL)
|
||||
{
|
||||
tls_type = elf_s390_hash_entry(h)->tls_type;
|
||||
- if (!bfd_link_pic (info) && h->dynindx == -1 && tls_type >= GOT_TLS_IE)
|
||||
+ if (!bfd_link_dll (info) && h->dynindx == -1 && tls_type >= GOT_TLS_IE)
|
||||
r_type = R_390_TLS_LE64;
|
||||
}
|
||||
if (r_type == R_390_TLS_GD64 && tls_type >= GOT_TLS_IE)
|
||||
@@ -2801,14 +2814,14 @@ elf_s390_relocate_section (bfd *output_b
|
||||
if (local_got_offsets == NULL)
|
||||
abort();
|
||||
off = local_got_offsets[r_symndx];
|
||||
- if (bfd_link_pic (info))
|
||||
+ if (bfd_link_dll (info))
|
||||
goto emit_tls_relocs;
|
||||
}
|
||||
else
|
||||
{
|
||||
off = h->got.offset;
|
||||
tls_type = elf_s390_hash_entry(h)->tls_type;
|
||||
- if (bfd_link_pic (info) || h->dynindx != -1 || tls_type < GOT_TLS_IE)
|
||||
+ if (bfd_link_dll (info) || h->dynindx != -1 || tls_type < GOT_TLS_IE)
|
||||
goto emit_tls_relocs;
|
||||
}
|
||||
|
||||
@@ -2825,7 +2838,7 @@ elf_s390_relocate_section (bfd *output_b
|
||||
break;
|
||||
|
||||
case R_390_TLS_LDM64:
|
||||
- if (! bfd_link_pic (info))
|
||||
+ if (! bfd_link_dll (info))
|
||||
/* The literal pool entry this relocation refers to gets ignored
|
||||
by the optimized code of the local exec model. Do nothing
|
||||
and the value will turn out zero. */
|
||||
@@ -2900,7 +2913,7 @@ elf_s390_relocate_section (bfd *output_b
|
||||
continue;
|
||||
|
||||
case R_390_TLS_LDO64:
|
||||
- if (bfd_link_pic (info) || (input_section->flags & SEC_DEBUGGING))
|
||||
+ if (bfd_link_dll (info) || (input_section->flags & SEC_DEBUGGING))
|
||||
relocation -= dtpoff_base (info);
|
||||
else
|
||||
/* When converting LDO to LE, we must negate. */
|
||||
@@ -2922,7 +2935,7 @@ elf_s390_relocate_section (bfd *output_b
|
||||
|
||||
if (r_type == R_390_TLS_LOAD)
|
||||
{
|
||||
- if (!bfd_link_pic (info) && (h == NULL || h->dynindx == -1))
|
||||
+ if (!bfd_link_dll (info) && (h == NULL || h->dynindx == -1))
|
||||
{
|
||||
/* IE->LE transition. Four valid cases:
|
||||
lg %rx,(0,%ry) -> sllg %rx,%ry,0
|
||||
@@ -2972,7 +2985,7 @@ elf_s390_relocate_section (bfd *output_b
|
||||
invalid_tls_insn (input_bfd, input_section, rel);
|
||||
return false;
|
||||
}
|
||||
- if (!bfd_link_pic (info) && (h == NULL || h->dynindx == -1))
|
||||
+ if (!bfd_link_dll (info) && (h == NULL || h->dynindx == -1))
|
||||
{
|
||||
/* GD->LE transition.
|
||||
brasl %r14,__tls_get_addr@plt -> brcl 0,. */
|
||||
@@ -2991,7 +3004,7 @@ elf_s390_relocate_section (bfd *output_b
|
||||
}
|
||||
else if (r_type == R_390_TLS_LDCALL)
|
||||
{
|
||||
- if (!bfd_link_pic (info))
|
||||
+ if (!bfd_link_dll (info))
|
||||
{
|
||||
unsigned int insn0, insn1;
|
||||
|
||||
Only in binutils-2.37/bfd: elf64-s390.c.orig
|
|
@ -0,0 +1,49 @@
|
|||
From 0d62064867c74286360e821b75ef6799bedc4b34 Mon Sep 17 00:00:00 2001
|
||||
From: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
|
||||
Date: Tue, 28 Sep 2021 20:11:26 +0930
|
||||
Subject: [PATCH] PR28391, strip/objcopy --preserve-dates *.a: cannot set time
|
||||
|
||||
After commit 985e0264516 copy_archive function began to pass invalid
|
||||
values to the utimensat(2) function when it tries to preserve
|
||||
timestamps in ar archives. This happens because the bfd_stat_arch_elt
|
||||
implementation for ar archives fills only the st_mtim.tv_sec part of
|
||||
the st_mtim timespec structure, but leaves the st_mtim.tv_nsec part
|
||||
and the whole st_atim timespec untouched leaving them uninitialized
|
||||
|
||||
PR 28391
|
||||
* ar.c (extract_file): Clear buf for preserve_dates.
|
||||
* objcopy.c (copy_archive): Likewise.
|
||||
---
|
||||
binutils/ar.c | 3 +++
|
||||
binutils/objcopy.c | 1 +
|
||||
2 files changed, 4 insertions(+)
|
||||
|
||||
diff --git a/binutils/ar.c b/binutils/ar.c
|
||||
index 5d6976c7027..8885585ef75 100644
|
||||
--- a/binutils/ar.c
|
||||
+++ b/binutils/ar.c
|
||||
@@ -1180,6 +1180,9 @@ extract_file (bfd *abfd)
|
||||
bfd_size_type size;
|
||||
struct stat buf;
|
||||
|
||||
+ if (preserve_dates)
|
||||
+ memset (&buf, 0, sizeof (buf));
|
||||
+
|
||||
if (bfd_stat_arch_elt (abfd, &buf) != 0)
|
||||
/* xgettext:c-format */
|
||||
fatal (_("internal stat error on %s"), bfd_get_filename (abfd));
|
||||
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
|
||||
index a6c2e0dcc26..fd7557fe433 100644
|
||||
--- a/binutils/objcopy.c
|
||||
+++ b/binutils/objcopy.c
|
||||
@@ -3600,6 +3600,7 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
|
||||
|
||||
if (preserve_dates)
|
||||
{
|
||||
+ memset (&buf, 0, sizeof (buf));
|
||||
stat_status = bfd_stat_arch_elt (this_element, &buf);
|
||||
|
||||
if (stat_status != 0)
|
||||
--
|
||||
2.37.1
|
||||
|
|
@ -0,0 +1,963 @@
|
|||
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-10.d binutils-2.36.1/ld/testsuite/ld-plugin/plugin-10.d
|
||||
--- binutils.orig/ld/testsuite/ld-plugin/plugin-10.d 2021-02-12 10:13:11.116049499 +0000
|
||||
+++ binutils-2.36.1/ld/testsuite/ld-plugin/plugin-10.d 2021-02-12 10:23:44.298370984 +0000
|
||||
@@ -32,7 +32,7 @@ hook called: claim_file tmpdir/func.o \[
|
||||
hook called: claim_file tmpdir/libtext.a \[@.* not claimed
|
||||
#...
|
||||
hook called: all symbols read.
|
||||
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY
|
||||
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
|
||||
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
|
||||
#...
|
||||
hook called: cleanup.
|
||||
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-11.d binutils-2.36.1/ld/testsuite/ld-plugin/plugin-11.d
|
||||
--- binutils.orig/ld/testsuite/ld-plugin/plugin-11.d 2021-02-12 10:13:11.119049477 +0000
|
||||
+++ binutils-2.36.1/ld/testsuite/ld-plugin/plugin-11.d 2021-02-12 10:50:40.973828943 +0000
|
||||
@@ -35,9 +35,9 @@ hook called: claim_file tmpdir/func.o \[
|
||||
hook called: claim_file tmpdir/libtext.a \[@.* CLAIMED
|
||||
#...
|
||||
hook called: all symbols read.
|
||||
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY
|
||||
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
|
||||
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
|
||||
-Sym: '_?text' Resolution: LDPR_PREVAILING_DEF_IRONLY
|
||||
+Sym: '_?text' Resolution: LDPR_PREVAILING_DE.*
|
||||
#...
|
||||
hook called: cleanup.
|
||||
#...
|
||||
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-16.d binutils-2.36.1/ld/testsuite/ld-plugin/plugin-16.d
|
||||
--- binutils.orig/ld/testsuite/ld-plugin/plugin-16.d 2021-02-12 10:13:11.119049477 +0000
|
||||
+++ binutils-2.36.1/ld/testsuite/ld-plugin/plugin-16.d 2021-02-12 10:29:31.510843797 +0000
|
||||
@@ -30,7 +30,7 @@ hook called: claim_file .*/ld/testsuite/
|
||||
hook called: claim_file tmpdir/text.o \[@0/.* not claimed
|
||||
#...
|
||||
hook called: all symbols read.
|
||||
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY
|
||||
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
|
||||
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
|
||||
#...
|
||||
hook called: cleanup.
|
||||
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-17.d binutils-2.36.1/ld/testsuite/ld-plugin/plugin-17.d
|
||||
--- binutils.orig/ld/testsuite/ld-plugin/plugin-17.d 2021-02-12 10:13:11.116049499 +0000
|
||||
+++ binutils-2.36.1/ld/testsuite/ld-plugin/plugin-17.d 2021-02-12 10:35:13.348404638 +0000
|
||||
@@ -31,7 +31,7 @@ hook called: claim_file .*/ld/testsuite/
|
||||
hook called: claim_file tmpdir/text.o \[@0/.* not claimed
|
||||
#...
|
||||
hook called: all symbols read.
|
||||
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY
|
||||
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
|
||||
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
|
||||
#...
|
||||
hook called: cleanup.
|
||||
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-18.d binutils-2.36.1/ld/testsuite/ld-plugin/plugin-18.d
|
||||
--- binutils.orig/ld/testsuite/ld-plugin/plugin-18.d 2021-02-12 10:13:11.118049484 +0000
|
||||
+++ binutils-2.36.1/ld/testsuite/ld-plugin/plugin-18.d 2021-02-12 10:29:47.974726314 +0000
|
||||
@@ -32,7 +32,7 @@ hook called: claim_file .*/ld/testsuite/
|
||||
hook called: claim_file tmpdir/libtext.a \[@.* not claimed
|
||||
#...
|
||||
hook called: all symbols read.
|
||||
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY
|
||||
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
|
||||
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
|
||||
#...
|
||||
hook called: cleanup.
|
||||
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-19.d binutils-2.36.1/ld/testsuite/ld-plugin/plugin-19.d
|
||||
--- binutils.orig/ld/testsuite/ld-plugin/plugin-19.d 2021-02-12 10:13:11.116049499 +0000
|
||||
+++ binutils-2.36.1/ld/testsuite/ld-plugin/plugin-19.d 2021-02-12 10:30:31.990412245 +0000
|
||||
@@ -35,9 +35,9 @@ hook called: claim_file .*/ld/testsuite/
|
||||
hook called: claim_file tmpdir/libtext.a \[@.* CLAIMED
|
||||
#...
|
||||
hook called: all symbols read.
|
||||
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY
|
||||
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
|
||||
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
|
||||
-Sym: '_?text' Resolution: LDPR_PREVAILING_DEF_IRONLY
|
||||
+Sym: '_?text' Resolution: LDPR_PREVAILING_DE.*
|
||||
#...
|
||||
hook called: cleanup.
|
||||
#...
|
||||
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-8.d binutils-2.36.1/ld/testsuite/ld-plugin/plugin-8.d
|
||||
--- binutils.orig/ld/testsuite/ld-plugin/plugin-8.d 2021-02-12 10:13:11.118049484 +0000
|
||||
+++ binutils-2.36.1/ld/testsuite/ld-plugin/plugin-8.d 2021-02-12 10:23:18.489561148 +0000
|
||||
@@ -30,7 +30,7 @@ hook called: claim_file tmpdir/func.o \[
|
||||
hook called: claim_file tmpdir/text.o \[@0/.* not claimed
|
||||
#...
|
||||
hook called: all symbols read.
|
||||
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY
|
||||
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
|
||||
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
|
||||
#...
|
||||
hook called: cleanup.
|
||||
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-9.d binutils-2.36.1/ld/testsuite/ld-plugin/plugin-9.d
|
||||
--- binutils.orig/ld/testsuite/ld-plugin/plugin-9.d 2021-02-12 10:13:11.119049477 +0000
|
||||
+++ binutils-2.36.1/ld/testsuite/ld-plugin/plugin-9.d 2021-02-12 10:23:34.417443785 +0000
|
||||
@@ -31,7 +31,7 @@ hook called: claim_file tmpdir/func.o \[
|
||||
hook called: claim_file tmpdir/text.o \[@0/.* not claimed
|
||||
#...
|
||||
hook called: all symbols read.
|
||||
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY
|
||||
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
|
||||
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
|
||||
#...
|
||||
hook called: cleanup.
|
||||
diff -rup binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp binutils-2.36.1/ld/testsuite/ld-x86-64/x86-64.exp
|
||||
--- binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp 2021-02-12 10:13:11.177049047 +0000
|
||||
+++ binutils-2.36.1/ld/testsuite/ld-x86-64/x86-64.exp 2021-02-12 10:57:23.339975059 +0000
|
||||
@@ -1437,22 +1437,6 @@ if { [isnative] && [check_compiler_avail
|
||||
} else {
|
||||
run_cc_link_tests [list \
|
||||
[list \
|
||||
- "Build pr22001-1b" \
|
||||
- "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed,-z,notext tmpdir/pr22001-1.so" \
|
||||
- "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
|
||||
- { pr22001-1c.c } \
|
||||
- {{error_output "pr22001-1b.err"}} \
|
||||
- "pr22001-1b" \
|
||||
- ] \
|
||||
- [list \
|
||||
- "Build pr21997-1b" \
|
||||
- "$NOPIE_LDFLAGS -Wl,--no-as-needed,-z,notext tmpdir/pr21997-1.so" \
|
||||
- "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
|
||||
- { pr21997-1c.c } \
|
||||
- {{error_output "pr21997-1b.err"}} \
|
||||
- "pr21997-1b" \
|
||||
- ] \
|
||||
- [list \
|
||||
"Build lam-u48.so" \
|
||||
"-shared -Wl,-z,lam-u48" \
|
||||
"" \
|
||||
@@ -1766,49 +1750,6 @@ if { [isnative] && [check_compiler_avail
|
||||
if { [istarget "x86_64-*-linux*"] \
|
||||
&& ![istarget "x86_64-*-linux*-gnux32"]} {
|
||||
|
||||
- run_cc_link_tests [list \
|
||||
- [list \
|
||||
- "Build plt-main with -z bndplt" \
|
||||
- "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \
|
||||
- tmpdir/plt-main4.o tmpdir/libplt-lib.so -z bndplt \
|
||||
- -z noseparate-code -z max-page-size=0x200000" \
|
||||
- "-Wa,-mx86-used-note=yes $NOCF_PROTECTION_CFLAGS" \
|
||||
- { plt-main5.c } \
|
||||
- {{objdump {-drw} plt-main-bnd.dd}} \
|
||||
- "plt-main-bnd" \
|
||||
- ] \
|
||||
- [list \
|
||||
- "Build plt-main with PIE and -z bndplt" \
|
||||
- "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \
|
||||
- tmpdir/plt-main4.o tmpdir/libplt-lib.so -z bndplt -pie \
|
||||
- -z noseparate-code -z max-page-size=0x200000" \
|
||||
- "-fPIC -Wa,-mx86-used-note=yes $NOCF_PROTECTION_CFLAGS" \
|
||||
- { plt-main5.c } \
|
||||
- {{objdump {-drw} plt-main-bnd.dd}} \
|
||||
- "plt-main-pie-bnd" \
|
||||
- ] \
|
||||
- [list \
|
||||
- "Build plt-main with -z bndplt -z now" \
|
||||
- "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \
|
||||
- tmpdir/plt-main4.o tmpdir/libplt-lib.so -z bndplt -z now \
|
||||
- -z noseparate-code -z max-page-size=0x200000" \
|
||||
- "-Wa,-mx86-used-note=yes $NOCF_PROTECTION_CFLAGS" \
|
||||
- { plt-main5.c } \
|
||||
- {{readelf {-SW} plt-main-bnd-now.rd} {objdump {-drw} plt-main-bnd.dd}} \
|
||||
- "plt-main-bnd-now" \
|
||||
- ] \
|
||||
- [list \
|
||||
- "Build plt-main with PIE and -z bndplt -z now" \
|
||||
- "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \
|
||||
- tmpdir/plt-main4.o tmpdir/libplt-lib.so -z bndplt -z now -pie \
|
||||
- -z noseparate-code -z max-page-size=0x200000" \
|
||||
- "-fPIC -Wa,-mx86-used-note=yes $NOCF_PROTECTION_CFLAGS" \
|
||||
- { plt-main5.c } \
|
||||
- {{readelf {-SW} plt-main-bnd-now.rd} {objdump {-drw} plt-main-bnd.dd}} \
|
||||
- "plt-main-pie-bnd-now" \
|
||||
- ] \
|
||||
- ]
|
||||
-
|
||||
run_ld_link_exec_tests [list \
|
||||
[list \
|
||||
"Run plt-main with -z bndplt" \
|
||||
@@ -1893,66 +1834,6 @@ if { [isnative] && [check_compiler_avail
|
||||
set pltdump {{objdump {-drw} plt-main-ibt.dd}}
|
||||
set pltsecdump {{readelf {-SW} plt-main-ibt-now.rd} {objdump {-drw} plt-main-ibt.dd}}
|
||||
}
|
||||
- run_cc_link_tests [list \
|
||||
- [list \
|
||||
- "Build plt-main with -z ibtplt" \
|
||||
- "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \
|
||||
- tmpdir/plt-main4.o tmpdir/libplt-lib.so -z ibtplt \
|
||||
- -z noseparate-code -z max-page-size=0x200000" \
|
||||
- "-Wa,-mx86-used-note=yes" \
|
||||
- { plt-main5.c } \
|
||||
- $pltdump \
|
||||
- "plt-main-ibt" \
|
||||
- ] \
|
||||
- [list \
|
||||
- "Build plt-main with PIE and -z ibtplt" \
|
||||
- "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \
|
||||
- tmpdir/plt-main4.o tmpdir/libplt-lib.so -z ibtplt -pie \
|
||||
- -z noseparate-code -z max-page-size=0x200000" \
|
||||
- "-fPIC -Wa,-mx86-used-note=yes" \
|
||||
- { plt-main5.c } \
|
||||
- $pltdump \
|
||||
- "plt-main-pie-ibt" \
|
||||
- ] \
|
||||
- [list \
|
||||
- "Build plt-main with -z ibtplt -z now" \
|
||||
- "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \
|
||||
- tmpdir/plt-main4.o tmpdir/libplt-lib.so -z ibtplt -z now \
|
||||
- -z noseparate-code -z max-page-size=0x200000" \
|
||||
- "-Wa,-mx86-used-note=yes" \
|
||||
- { plt-main5.c } \
|
||||
- $pltsecdump \
|
||||
- "plt-main-ibt-now" \
|
||||
- ] \
|
||||
- [list \
|
||||
- "Build plt-main with PIE and -z ibtplt -z now" \
|
||||
- "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \
|
||||
- tmpdir/plt-main4.o tmpdir/libplt-lib.so -z ibtplt -z now -pie \
|
||||
- -z noseparate-code -z max-page-size=0x200000" \
|
||||
- "-fPIC -Wa,-mx86-used-note=yes" \
|
||||
- { plt-main5.c } \
|
||||
- $pltsecdump \
|
||||
- "plt-main-pie-ibt-now" \
|
||||
- ] \
|
||||
- [list \
|
||||
- "Build libibtplt-lib.so with -z ibtplt" \
|
||||
- "-shared -z ibtplt \
|
||||
- -z noseparate-code -z max-page-size=0x200000" \
|
||||
- "-fPIC -Wa,-mx86-used-note=yes" \
|
||||
- { plt-main1.c plt-main2.c plt-main3.c plt-main4.c} \
|
||||
- $pltdump \
|
||||
- "libibtplt-lib.so" \
|
||||
- ] \
|
||||
- [list \
|
||||
- "Build libibtplt--now-lib.so with -z ibtplt -z now" \
|
||||
- "-shared -z ibtplt -z now \
|
||||
- -z noseparate-code -z max-page-size=0x200000" \
|
||||
- "-fPIC -Wa,-mx86-used-note=yes" \
|
||||
- { plt-main1.c plt-main2.c plt-main3.c plt-main4.c} \
|
||||
- $pltdump \
|
||||
- "libibtplt-now-lib.so" \
|
||||
- ] \
|
||||
- ]
|
||||
|
||||
run_ld_link_exec_tests [list \
|
||||
[list \
|
||||
diff -rup binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp binutils-2.36.1/ld/testsuite/ld-x86-64/x86-64.exp
|
||||
--- binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp 2021-02-12 11:44:39.121364751 +0000
|
||||
+++ binutils-2.36.1/ld/testsuite/ld-x86-64/x86-64.exp 2021-02-12 11:46:27.505597689 +0000
|
||||
@@ -1878,24 +1878,6 @@ if { [isnative] && [check_compiler_avail
|
||||
"plt-main.out" \
|
||||
"-fPIC" \
|
||||
] \
|
||||
- [list \
|
||||
- "Run plt-main with libibtplt-lib.so -z ibtplt" \
|
||||
- "-Wl,--no-as-needed,-z,ibtplt tmpdir/libibtplt-lib.so \
|
||||
- tmpdir/libplt-lib.so" \
|
||||
- "-Wa,-mx86-used-note=yes" \
|
||||
- { plt-main5.c } \
|
||||
- "plt-main-ibt-lib" \
|
||||
- "plt-main.out" \
|
||||
- ] \
|
||||
- [list \
|
||||
- "Run plt-main with libibtplt-lib.so -z ibtplt -z now" \
|
||||
- "-Wl,--no-as-needed,-z,ibtplt,-z,now \
|
||||
- tmpdir/libibtplt-now-lib.so tmpdir/libplt-lib.so" \
|
||||
- "-Wa,-mx86-used-note=yes" \
|
||||
- { plt-main5.c } \
|
||||
- "plt-main-ibt-now-lib" \
|
||||
- "plt-main.out" \
|
||||
- ] \
|
||||
]
|
||||
|
||||
if { [check_ifunc_attribute_available] } {
|
||||
@@ -1922,7 +1904,6 @@ if { [isnative] && [check_compiler_avail
|
||||
}
|
||||
}
|
||||
|
||||
- undefined_weak "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS"
|
||||
undefined_weak "-fPIE" ""
|
||||
undefined_weak "-fPIE" "-pie"
|
||||
undefined_weak "-fPIE" "-Wl,-z,nodynamic-undefined-weak"
|
||||
--- binutils.orig/ld/testsuite/ld-plugin/plugin-12.d 2021-02-12 11:44:39.076365068 +0000
|
||||
+++ binutils-2.36.1/ld/testsuite/ld-plugin/plugin-12.d 2021-02-12 12:01:48.091931654 +0000
|
||||
@@ -1,5 +1,5 @@
|
||||
#...
|
||||
-.*: symbol `func' definition: DEF, visibility: DEFAULT, resolution: PREVAILING_DEF
|
||||
+.*: symbol `func' definition: DEF, visibility: DEFAULT, resolution: PREVAILING_DE.*
|
||||
.*: symbol `func1' definition: DEF, visibility: PROTECTED, resolution: PREVAILING_DEF_IRONLY
|
||||
.*: symbol `func2' definition: DEF, visibility: INTERNAL, resolution: PREVAILING_DEF_IRONLY
|
||||
.*: symbol `func3' definition: DEF, visibility: HIDDEN, resolution: PREVAILING_DEF_IRONLY
|
||||
--- binutils.orig/ld/testsuite/ld-plugin/plugin-12.d 2021-02-12 14:14:25.023160021 +0000
|
||||
+++ binutils-2.36.1/ld/testsuite/ld-plugin/plugin-12.d 2021-02-12 14:19:29.106923745 +0000
|
||||
@@ -1,6 +1,6 @@
|
||||
#...
|
||||
-.*: symbol `func' definition: DEF, visibility: DEFAULT, resolution: PREVAILING_DE.*
|
||||
-.*: symbol `func1' definition: DEF, visibility: PROTECTED, resolution: PREVAILING_DEF_IRONLY
|
||||
-.*: symbol `func2' definition: DEF, visibility: INTERNAL, resolution: PREVAILING_DEF_IRONLY
|
||||
-.*: symbol `func3' definition: DEF, visibility: HIDDEN, resolution: PREVAILING_DEF_IRONLY
|
||||
+.*: symbol `.*unc' definition: DEF, visibility: DEFAULT, resolution: PREVAILING_DE.*
|
||||
+.*: symbol `.*unc1' definition: DEF, visibility: PROTECTED, resolution: PREVAILING_DEF_IRONLY
|
||||
+.*: symbol `.*unc2' definition: DEF, visibility: INTERNAL, resolution: PREVAILING_DEF_IRONLY
|
||||
+.*: symbol `.*unc3' definition: DEF, visibility: HIDDEN, resolution: PREVAILING_DEF_IRONLY
|
||||
#pass
|
||||
--- binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-now.d 2021-07-19 12:39:14.240555833 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-aarch64/variant_pcs-now.d 2021-07-19 12:50:27.753751551 +0100
|
||||
@@ -23,10 +23,10 @@ Symbol table '\.dynsym' contains 7 entri
|
||||
Num: Value Size Type Bind Vis Ndx Name
|
||||
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
|
||||
1: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
|
||||
- 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef
|
||||
- 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc
|
||||
+ 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT[ ]+UND f_spec_global_default_undef[ ]+\[VARIANT_PCS\]
|
||||
+ 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT[ ]+1 f_spec_global_default_ifunc[ ]+\[VARIANT_PCS\]
|
||||
4: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
|
||||
- 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def
|
||||
+ 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT[ ]+1 f_spec_global_default_def[ ]+\[VARIANT_PCS\]
|
||||
6: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
|
||||
|
||||
Symbol table '\.symtab' contains 35 entries:
|
||||
@@ -41,28 +41,28 @@ Symbol table '\.symtab' contains 35 entr
|
||||
7: 00000000000111c8 0 SECTION LOCAL DEFAULT 7.*
|
||||
8: 0000000000011270 0 SECTION LOCAL DEFAULT 8.*
|
||||
9: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-1\.o
|
||||
- 10: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local
|
||||
- 11: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local_ifunc
|
||||
+ 10: 0000000000008000 0 NOTYPE LOCAL DEFAULT .*
|
||||
+ 11: 0000000000008000 0 IFUNC LOCAL DEFAULT .*
|
||||
12: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_local_ifunc
|
||||
13: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_local
|
||||
14: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 \$x
|
||||
15: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-2\.o
|
||||
- 16: 0000000000008038 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2
|
||||
- 17: 0000000000008038 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2_ifunc
|
||||
+ 16: 0000000000008038 0 NOTYPE LOCAL DEFAULT .*
|
||||
+ 17: 0000000000008038 0 IFUNC LOCAL DEFAULT .*
|
||||
18: 0000000000008038 0 IFUNC LOCAL DEFAULT 1 f_base_local2_ifunc
|
||||
19: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 f_base_local2
|
||||
20: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 \$x
|
||||
21: 0000000000000000 0 FILE LOCAL DEFAULT ABS
|
||||
22: 0000000000009080 0 OBJECT LOCAL DEFAULT ABS _DYNAMIC
|
||||
- 23: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_def
|
||||
+ 23: 0000000000008000 0 NOTYPE LOCAL DEFAULT .*
|
||||
24: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_global_hidden_ifunc
|
||||
25: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_global_hidden_def
|
||||
26: 0000000000009000 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_
|
||||
- 27: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_ifunc
|
||||
+ 27: 0000000000008000 0 IFUNC LOCAL DEFAULT .*
|
||||
28: 0000000000008070 0 NOTYPE LOCAL DEFAULT 2 \$x
|
||||
29: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
|
||||
- 30: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef
|
||||
- 31: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc
|
||||
+ 30: 0000000000000000 0 NOTYPE GLOBAL DEFAULT .*
|
||||
+ 31: 0000000000008000 0 IFUNC GLOBAL DEFAULT .*
|
||||
32: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
|
||||
- 33: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def
|
||||
+ 33: 0000000000008000 0 NOTYPE GLOBAL DEFAULT .*
|
||||
34: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
|
||||
--- binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-r.d 2021-07-19 12:39:14.235555861 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-aarch64/variant_pcs-r.d 2021-07-19 12:51:04.981541273 +0100
|
||||
@@ -37,24 +37,24 @@ Symbol table '\.symtab' contains 26 entr
|
||||
2: 0000000000000000 0 SECTION LOCAL DEFAULT 3.*
|
||||
3: 0000000000000000 0 SECTION LOCAL DEFAULT 4.*
|
||||
4: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-1\.o
|
||||
- 5: 0000000000000000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local
|
||||
- 6: 0000000000000000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local_ifunc
|
||||
+ 5: 0000000000000000 0 NOTYPE LOCAL DEFAULT .*
|
||||
+ 6: 0000000000000000 0 IFUNC LOCAL DEFAULT .*
|
||||
7: 0000000000000000 0 IFUNC LOCAL DEFAULT 1 f_base_local_ifunc
|
||||
8: 0000000000000000 0 NOTYPE LOCAL DEFAULT 1 f_base_local
|
||||
9: 0000000000000000 0 NOTYPE LOCAL DEFAULT 1 \$x
|
||||
10: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-2\.o
|
||||
- 11: 0000000000000038 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2
|
||||
- 12: 0000000000000038 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2_ifunc
|
||||
+ 11: 0000000000000038 0 NOTYPE LOCAL DEFAULT .*
|
||||
+ 12: 0000000000000038 0 IFUNC LOCAL DEFAULT .*
|
||||
13: 0000000000000038 0 IFUNC LOCAL DEFAULT 1 f_base_local2_ifunc
|
||||
14: 0000000000000038 0 NOTYPE LOCAL DEFAULT 1 f_base_local2
|
||||
15: 0000000000000038 0 NOTYPE LOCAL DEFAULT 1 \$x
|
||||
16: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
|
||||
- 17: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef
|
||||
- 18: 0000000000000000 0 NOTYPE GLOBAL HIDDEN \[VARIANT_PCS\] 1 f_spec_global_hidden_def
|
||||
+ 17: 0000000000000000 0 NOTYPE GLOBAL DEFAULT .*
|
||||
+ 18: 0000000000000000 0 NOTYPE GLOBAL HIDDEN .*
|
||||
19: 0000000000000000 0 IFUNC GLOBAL HIDDEN 1 f_base_global_hidden_ifunc
|
||||
- 20: 0000000000000000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc
|
||||
+ 20: 0000000000000000 0 IFUNC GLOBAL DEFAULT .*
|
||||
21: 0000000000000000 0 NOTYPE GLOBAL HIDDEN 1 f_base_global_hidden_def
|
||||
- 22: 0000000000000000 0 IFUNC GLOBAL HIDDEN \[VARIANT_PCS\] 1 f_spec_global_hidden_ifunc
|
||||
+ 22: 0000000000000000 0 IFUNC GLOBAL HIDDEN .*
|
||||
23: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
|
||||
- 24: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def
|
||||
+ 24: 0000000000000000 0 NOTYPE GLOBAL DEFAULT .*
|
||||
25: 0000000000000000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
|
||||
--- binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-shared.d 2021-07-19 12:39:14.235555861 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-aarch64/variant_pcs-shared.d 2021-07-19 12:51:38.076354339 +0100
|
||||
@@ -23,10 +23,10 @@ Symbol table '\.dynsym' contains 7 entri
|
||||
Num: Value Size Type Bind Vis Ndx Name
|
||||
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
|
||||
1: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
|
||||
- 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef
|
||||
- 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc
|
||||
+ 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT[ ]+UND f_spec_global_default_undef[ ]+\[VARIANT_PCS\]
|
||||
+ 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT[ ]+1 f_spec_global_default_ifunc[ ]+\[VARIANT_PCS\]
|
||||
4: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
|
||||
- 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def
|
||||
+ 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT[ ]+1 f_spec_global_default_def[ ]+\[VARIANT_PCS\]
|
||||
6: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
|
||||
|
||||
Symbol table '\.symtab' contains 35 entries:
|
||||
@@ -41,28 +41,28 @@ Symbol table '\.symtab' contains 35 entr
|
||||
7: 00000000000111c8 0 SECTION LOCAL DEFAULT 7.*
|
||||
8: 0000000000011270 0 SECTION LOCAL DEFAULT 8.*
|
||||
9: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-1\.o
|
||||
- 10: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local
|
||||
- 11: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local_ifunc
|
||||
+ 10: 0000000000008000 0 NOTYPE LOCAL DEFAULT .*
|
||||
+ 11: 0000000000008000 0 IFUNC LOCAL DEFAULT .*
|
||||
12: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_local_ifunc
|
||||
13: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_local
|
||||
14: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 \$x
|
||||
15: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-2\.o
|
||||
- 16: 0000000000008038 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2
|
||||
- 17: 0000000000008038 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2_ifunc
|
||||
+ 16: 0000000000008038 0 NOTYPE LOCAL DEFAULT .*
|
||||
+ 17: 0000000000008038 0 IFUNC LOCAL DEFAULT .*
|
||||
18: 0000000000008038 0 IFUNC LOCAL DEFAULT 1 f_base_local2_ifunc
|
||||
19: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 f_base_local2
|
||||
20: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 \$x
|
||||
21: 0000000000000000 0 FILE LOCAL DEFAULT ABS
|
||||
22: 0000000000009080 0 OBJECT LOCAL DEFAULT ABS _DYNAMIC
|
||||
- 23: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_def
|
||||
+ 23: 0000000000008000 0 NOTYPE LOCAL DEFAULT .*
|
||||
24: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_global_hidden_ifunc
|
||||
25: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_global_hidden_def
|
||||
26: 0000000000009000 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_
|
||||
- 27: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_ifunc
|
||||
+ 27: 0000000000008000 0 IFUNC LOCAL DEFAULT .*
|
||||
28: 0000000000008070 0 NOTYPE LOCAL DEFAULT 2 \$x
|
||||
29: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
|
||||
- 30: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef
|
||||
- 31: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc
|
||||
+ 30: 0000000000000000 0 NOTYPE GLOBAL DEFAULT .*
|
||||
+ 31: 0000000000008000 0 IFUNC GLOBAL DEFAULT .*
|
||||
32: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
|
||||
- 33: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def
|
||||
+ 33: 0000000000008000 0 NOTYPE GLOBAL DEFAULT .*
|
||||
34: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
|
||||
--- binutils.orig/gold/main.cc 2021-07-19 12:39:14.643553557 +0100
|
||||
+++ binutils-2.37/gold/main.cc 2021-07-19 12:53:40.043665415 +0100
|
||||
@@ -290,16 +290,6 @@ main(int argc, char** argv)
|
||||
elapsed.sys / 1000, (elapsed.sys % 1000) * 1000,
|
||||
elapsed.wall / 1000, (elapsed.wall % 1000) * 1000);
|
||||
|
||||
-#if defined(HAVE_MALLINFO2)
|
||||
- struct mallinfo2 m = mallinfo2();
|
||||
- fprintf(stderr, _("%s: total space allocated by malloc: %lld bytes\n"),
|
||||
- program_name, static_cast<long long>(m.arena));
|
||||
-#elif defined(HAVE_MALLINFO)
|
||||
- struct mallinfo m = mallinfo();
|
||||
- fprintf(stderr, _("%s: total space allocated by malloc: %lld bytes\n"),
|
||||
- program_name, static_cast<long long>(m.arena));
|
||||
-#endif
|
||||
-
|
||||
File_read::print_stats();
|
||||
Archive::print_stats();
|
||||
Lib_group::print_stats();
|
||||
--- binutils.orig/ld/testsuite/ld-aarch64/tls-relax-gdesc-le-now.d 2021-07-19 14:51:48.859666911 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-aarch64/tls-relax-gdesc-le-now.d 2021-07-19 14:59:56.130065901 +0100
|
||||
@@ -11,7 +11,7 @@
|
||||
0x.+ \(PLTRELSZ\) \s+.+ \(bytes\)
|
||||
0x.+ \(PLTREL\) \s+RELA
|
||||
0x.+ \(JMPREL\) \s+0x.+
|
||||
- 0x.+ \(BIND_NOW\) \s+
|
||||
+ 0x.+ \(FLAGS\) \s+BIND_NOW
|
||||
0x.+ \(FLAGS_1\) \s+ Flags: NOW
|
||||
0x.+ \(NULL\) \s+ 0x0
|
||||
|
||||
--- binutils.orig/ld/testsuite/ld-plugin/plugin.exp 2021-07-19 14:51:48.905666659 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-plugin/plugin.exp 2021-07-19 15:06:56.159875135 +0100
|
||||
@@ -119,7 +119,7 @@ if { $can_compile && !$failed_compile }
|
||||
|
||||
# I do not know why, but the underscore prefix test is going
|
||||
# wrong on ppc64le targets. So override it here.
|
||||
-if { [istarget powerpc*-*-linux*] || [istarget x86_64*-*-linux*] } {
|
||||
+if { [istarget powerpc*-*-linux*] || [istarget x86_64*-*-linux*] || [istarget *-*-*] } {
|
||||
set _ ""
|
||||
}
|
||||
|
||||
--- binutils.orig/ld/testsuite/ld-elf/compress.exp 2021-07-19 14:51:48.982666235 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-elf/compress.exp 2021-07-19 15:16:14.268931663 +0100
|
||||
@@ -168,7 +168,7 @@ if { [regexp_diff tmpdir/$test.out $srcd
|
||||
set test_name "Link with zlib compressed debug output 1"
|
||||
set test normal
|
||||
send_log "$READELF -w tmpdir/$test > tmpdir/$test.out\n"
|
||||
-set got [remote_exec host [concat sh -c [list "$READELF -w tmpdir/$test > tmpdir/$test.out"]] "" "/dev/null"]
|
||||
+set got [remote_exec host [concat sh -c [list "$READELF -wi tmpdir/$test > tmpdir/$test.out"]] "" "/dev/null"]
|
||||
if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
|
||||
send_log "$got\n"
|
||||
fail "$test_name"
|
||||
--- binutils.orig/ld/testsuite/ld-elf/compress.exp 2021-07-20 09:55:20.387674258 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-elf/compress.exp 2021-07-20 09:59:51.118189655 +0100
|
||||
@@ -167,7 +167,7 @@ if { [regexp_diff tmpdir/$test.out $srcd
|
||||
|
||||
set test_name "Link with zlib compressed debug output 1"
|
||||
set test normal
|
||||
-send_log "$READELF -w tmpdir/$test > tmpdir/$test.out\n"
|
||||
+send_log "$READELF -wi tmpdir/$test > tmpdir/$test.out\n"
|
||||
set got [remote_exec host [concat sh -c [list "$READELF -wi tmpdir/$test > tmpdir/$test.out"]] "" "/dev/null"]
|
||||
if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
|
||||
send_log "$got\n"
|
||||
@@ -176,8 +176,8 @@ if { [lindex $got 0] != 0 || ![string ma
|
||||
|
||||
set test_name "Link with zlib compressed debug output 2"
|
||||
set test zlibnormal
|
||||
-send_log "$READELF -w tmpdir/$test | sed -e \"s/.zdebug_/.debug_/\" > tmpdir/$test.out\n"
|
||||
-set got [remote_exec host [concat sh -c [list "$READELF -w tmpdir/$test | sed -e \"s/.zdebug_/.debug_/\" > tmpdir/$test.out"]] "" "/dev/null"]
|
||||
+send_log "$READELF -wi tmpdir/$test | sed -e \"s/.zdebug_/.debug_/\" > tmpdir/$test.out\n"
|
||||
+set got [remote_exec host [concat sh -c [list "$READELF -wi tmpdir/$test | sed -e \"s/.zdebug_/.debug_/\" > tmpdir/$test.out"]] "" "/dev/null"]
|
||||
if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
|
||||
send_log "$got\n"
|
||||
fail "$test_name"
|
||||
@@ -203,8 +203,8 @@ if { [regexp_diff tmpdir/$test.out $srcd
|
||||
|
||||
set test_name "Link with zlib-gnu compressed debug output 1"
|
||||
set test gnunormal
|
||||
-send_log "$READELF -w tmpdir/$test | sed -e \"s/.zdebug_/.debug_/\" > tmpdir/$test.out\n"
|
||||
-set got [remote_exec host [concat sh -c [list "$READELF -w tmpdir/$test | sed -e \"s/.zdebug_/.debug_/\" > tmpdir/$test.out"]] "" "/dev/null"]
|
||||
+send_log "$READELF -wi tmpdir/$test | sed -e \"s/.zdebug_/.debug_/\" > tmpdir/$test.out\n"
|
||||
+set got [remote_exec host [concat sh -c [list "$READELF -wi tmpdir/$test | sed -e \"s/.zdebug_/.debug_/\" > tmpdir/$test.out"]] "" "/dev/null"]
|
||||
if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
|
||||
send_log "$got\n"
|
||||
fail "$test_name"
|
||||
@@ -230,8 +230,8 @@ if { [regexp_diff tmpdir/$test.out $srcd
|
||||
|
||||
set test gabinormal
|
||||
set test_name "Link with zlib-gabi compressed debug output 1"
|
||||
-send_log "$READELF -w tmpdir/$test > tmpdir/$test.out\n"
|
||||
-set got [remote_exec host [concat sh -c [list "$READELF -w tmpdir/$test > tmpdir/$test.out"]] "" "/dev/null"]
|
||||
+send_log "$READELF -wi tmpdir/$test > tmpdir/$test.out\n"
|
||||
+set got [remote_exec host [concat sh -c [list "$READELF -wi tmpdir/$test > tmpdir/$test.out"]] "" "/dev/null"]
|
||||
if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
|
||||
send_log "$got\n"
|
||||
fail "$test_name"
|
||||
--- binutils.orig/ld/testsuite/ld-elf/shared.exp 2021-07-20 09:55:20.398674198 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-elf/shared.exp 2021-07-20 10:04:13.180751421 +0100
|
||||
@@ -1629,6 +1629,7 @@ if [istarget "sparc*-*-*"] {
|
||||
if { ([istarget "*-*-linux*"]
|
||||
|| [istarget "*-*-nacl*"]
|
||||
|| [istarget "*-*-gnu*"])
|
||||
+ && ![istarget "aarch64*-*-*"] && ![istarget "arm*-*-*"]
|
||||
&& ![istarget "mips*-*-*"] } {
|
||||
run_ld_link_tests [list \
|
||||
[list \
|
||||
--- binutils.orig/ld/testsuite/ld-gc/pr13683.d 2021-07-20 09:55:20.295674760 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-gc/pr13683.d 2021-07-20 10:10:30.650663650 +0100
|
||||
@@ -2,7 +2,7 @@
|
||||
#source: dummy.s
|
||||
#ld: --gc-sections -e main --defsym foo=foo2 tmpdir/pr13683.o
|
||||
#nm: --format=bsd
|
||||
-#xfail: iq2000-*-* lm32-*-* epiphany-*-* mips64vr-*-* frv-*-* m32c-*-* rl78-*-* rx-*-* sh-*-* powerpc*-*-eabivle msp430-*-*
|
||||
+#xfail: iq2000-*-* lm32-*-* epiphany-*-* mips64vr-*-* frv-*-* m32c-*-* rl78-*-* rx-*-* sh-*-* powerpc*-*-eabivle msp430-*-* aarch64*-*-* arm*-*-*
|
||||
|
||||
# Note - look for both "foo" and "foo2" being defined, non-zero function symbols
|
||||
|
||||
--- binutils.orig/ld/testsuite/ld-gc/pr19161.d 2021-07-20 09:55:20.295674760 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-gc/pr19161.d 2021-07-20 10:12:36.585966659 +0100
|
||||
@@ -2,7 +2,7 @@
|
||||
#source: dummy.s
|
||||
#ld: --gc-sections -e main tmpdir/pr19161-1.o tmpdir/pr19161-2.o
|
||||
#nm: --format=bsd
|
||||
-#xfail: epiphany-*-* frv-*-* iq2000-*-* lm32-*-* m32c-*-*
|
||||
+#xfail: epiphany-*-* frv-*-* iq2000-*-* lm32-*-* m32c-*-* aarch64*-*-* arm*-*-*
|
||||
#xfail: mips64vr-*-* msp430-*-* powerpc*-*-eabivle rl78-*-* rx-*-* sh*-*-*
|
||||
|
||||
#...
|
||||
--- binutils.orig/ld/testsuite/ld-ifunc/ifunc.exp 2021-07-20 09:55:20.315674651 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-ifunc/ifunc.exp 2021-07-20 10:15:51.096886972 +0100
|
||||
@@ -664,6 +664,11 @@ run_cc_link_tests [list \
|
||||
] \
|
||||
]
|
||||
|
||||
+if { [isnative]
|
||||
+ && !([istarget "powerpc-*-*"]
|
||||
+ || [istarget "aarch64*-*-*"] || [istarget "arm*-*-*"]
|
||||
+ || [istarget "sparc*-*-*"]
|
||||
+ || [istarget "riscv*-*-*"]) } {
|
||||
run_ld_link_exec_tests [list \
|
||||
[list \
|
||||
"Run pr18808" \
|
||||
@@ -714,6 +719,7 @@ run_ld_link_exec_tests [list \
|
||||
"pr18841.out" \
|
||||
] \
|
||||
]
|
||||
+}
|
||||
|
||||
# The pr23169 testcase is not valid. In general, you can't call ifunc
|
||||
# resolvers in another binary unless you know what you're doing. In
|
||||
--- binutils.orig/ld/testsuite/ld-plugin/plugin.exp 2021-07-20 09:55:20.326674591 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-plugin/plugin.exp 2021-07-20 10:20:38.647289474 +0100
|
||||
@@ -81,6 +81,10 @@ if { [istarget m681*-*-*] || [istarget m
|
||||
# otherwise get FAILS due to _.frame
|
||||
set CFLAGS "$CFLAGS -fomit-frame-pointer"
|
||||
}
|
||||
+if { [istarget aarch64*-*-*] || [istarget arm*-*-*] } {
|
||||
+ set LDFLAGS "$LDFLAGS --defsym __aeabi_unwind_cpp_pr0=0"
|
||||
+}
|
||||
+
|
||||
# In order to define symbols in plugin options in the list of tests below,
|
||||
# we need to know if the platform prepends an underscore to C symbols,
|
||||
# which we find out by compiling the test objects now. If there is any
|
||||
--- binutils-2.37/ld/testsuite/ld-plugin/plugin.exp 2021-07-20 12:04:23.815709733 +0100
|
||||
+++ binutils.new/ld/testsuite/ld-plugin/plugin.exp 2021-07-20 12:04:16.782748608 +0100
|
||||
@@ -81,9 +81,6 @@ if { [istarget m681*-*-*] || [istarget m
|
||||
# otherwise get FAILS due to _.frame
|
||||
set CFLAGS "$CFLAGS -fomit-frame-pointer"
|
||||
}
|
||||
-if { [istarget aarch64*-*-*] || [istarget arm*-*-*] } {
|
||||
- set LDFLAGS "$LDFLAGS --defsym __aeabi_unwind_cpp_pr0=0"
|
||||
-}
|
||||
|
||||
# In order to define symbols in plugin options in the list of tests below,
|
||||
# we need to know if the platform prepends an underscore to C symbols,
|
||||
@@ -141,6 +138,9 @@ if [is_pecoff_format] {
|
||||
#otherwise relocs overflow to symbols defined on the command line
|
||||
append libs " --image-base=0x10000000"
|
||||
}
|
||||
+if { [istarget aarch64*-*-*] || [istarget arm*-*-*] } {
|
||||
+ append libs " --defsym __aeabi_unwind_cpp_pr0=0"
|
||||
+}
|
||||
|
||||
set plugin_tests [list \
|
||||
[list "load plugin" "-plugin $plugin_path \
|
||||
--- binutils.orig/ld/testsuite/ld-elfvsb/elfvsb.exp 2021-07-20 13:28:42.151614203 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-elfvsb/elfvsb.exp 2021-07-20 13:32:09.558459291 +0100
|
||||
@@ -94,6 +94,10 @@ if { [istarget *-*-linux*]
|
||||
}
|
||||
}
|
||||
|
||||
+if { [istarget i686*-*-*] } {
|
||||
+ set support_protected "no"
|
||||
+}
|
||||
+
|
||||
# The test procedure.
|
||||
proc visibility_test { visibility progname testname main sh1 sh2 dat args } {
|
||||
global CC
|
||||
--- binutils.orig/ld/testsuite/ld-i386/i386.exp 2021-07-20 13:28:42.211613869 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-i386/i386.exp 2021-07-20 13:40:00.116839084 +0100
|
||||
@@ -1057,15 +1057,6 @@ if { [isnative]
|
||||
"pr18900.out" \
|
||||
] \
|
||||
[list \
|
||||
- "Run pr19031" \
|
||||
- "$NOPIE_LDFLAGS tmpdir/pr19031.so" \
|
||||
- "-Wa,-mx86-used-note=yes" \
|
||||
- { pr19031b.S pr19031c.c } \
|
||||
- "pr19031" \
|
||||
- "pr19031.out" \
|
||||
- "$NOPIE_CFLAGS" \
|
||||
- ] \
|
||||
- [list \
|
||||
"Run got1" \
|
||||
"$NOPIE_LDFLAGS tmpdir/got1d.so" \
|
||||
"-Wa,-mx86-used-note=yes" \
|
||||
@@ -1117,6 +1108,7 @@ if { [isnative]
|
||||
] \
|
||||
]
|
||||
|
||||
+ setup_xfail i686*-*-*
|
||||
undefined_weak "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS"
|
||||
undefined_weak "-fPIE" "$NOPIE_LDFLAGS"
|
||||
undefined_weak "-fPIE" "-pie"
|
||||
--- binutils.orig/ld/testsuite/ld-i386/plt-main.rd 2021-07-20 13:28:42.214613852 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-i386/plt-main.rd 2021-07-20 13:39:25.781030283 +0100
|
||||
@@ -1,4 +1 @@
|
||||
-#failif
|
||||
-#...
|
||||
-[0-9a-f ]+R_386_JUMP_SLOT +0+ +bar
|
||||
#...
|
||||
--- binutils.orig/ld/testsuite/ld-i386/plt-pie-ibt.dd 2021-07-20 13:28:42.211613869 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-i386/plt-pie-ibt.dd 2021-07-20 13:42:32.515990374 +0100
|
||||
@@ -1,7 +1,2 @@
|
||||
#...
|
||||
-Disassembly of section .plt.got:
|
||||
-
|
||||
-[a-f0-9]+ <[_a-z]+@plt>:
|
||||
-[ ]*[a-f0-9]+: f3 0f 1e fb endbr32
|
||||
-[ ]*[a-f0-9]+: ff a3 .. .. .. .. jmp +\*\-0x[a-f0-9]+\(%ebx\)
|
||||
#pass
|
||||
--- binutils.orig/ld/testsuite/ld-scripts/crossref.exp 2021-07-20 13:28:42.114614409 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-scripts/crossref.exp 2021-07-20 13:45:27.476015992 +0100
|
||||
@@ -147,6 +147,8 @@ set exec_output [prune_warnings $exec_ou
|
||||
|
||||
regsub -all "(^|\n)($ld: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
|
||||
|
||||
+setup_xfail i686*-*-*
|
||||
+
|
||||
if [string match "" $exec_output] then {
|
||||
pass $test3
|
||||
} else {
|
||||
@@ -187,6 +189,8 @@ set exec_output [prune_warnings $exec_ou
|
||||
|
||||
regsub -all "(^|\n)($ld: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
|
||||
|
||||
+setup_xfail i686*-*-*
|
||||
+
|
||||
if [string match "" $exec_output] then {
|
||||
pass $test6
|
||||
} else {
|
||||
@@ -199,6 +203,8 @@ set exec_output [prune_warnings $exec_ou
|
||||
|
||||
regsub -all "(^|\n)($ld: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
|
||||
|
||||
+setup_xfail i686*-*-*
|
||||
+
|
||||
if [string match "" $exec_output] then {
|
||||
fail $test7
|
||||
} else {
|
||||
--- binutils.orig/ld/testsuite/ld-shared/shared.exp 2021-07-20 13:28:42.168614108 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-shared/shared.exp 2021-07-20 13:46:57.073516995 +0100
|
||||
@@ -36,9 +36,6 @@ if { ![istarget hppa*64*-*-hpux*] \
|
||||
&& ![istarget hppa*-*-linux*] \
|
||||
&& ![istarget i?86-*-sysv4*] \
|
||||
&& ![istarget i?86-*-unixware] \
|
||||
- && ![istarget i?86-*-elf*] \
|
||||
- && ![istarget i?86-*-linux*] \
|
||||
- && ![istarget i?86-*-gnu*] \
|
||||
&& ![istarget *-*-nacl*] \
|
||||
&& ![istarget ia64-*-elf*] \
|
||||
&& ![istarget ia64-*-linux*] \
|
||||
--- binutils.orig/ld/testsuite/ld-i386/i386.exp 2021-07-20 15:22:27.898561717 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-i386/i386.exp 2021-07-20 15:24:39.121829544 +0100
|
||||
@@ -1108,8 +1108,9 @@ if { [isnative]
|
||||
] \
|
||||
]
|
||||
|
||||
- setup_xfail i686*-*-*
|
||||
- undefined_weak "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS"
|
||||
+ if { ! [istarget i686*-*-*] } {
|
||||
+ undefined_weak "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS"
|
||||
+ }
|
||||
undefined_weak "-fPIE" "$NOPIE_LDFLAGS"
|
||||
undefined_weak "-fPIE" "-pie"
|
||||
undefined_weak "-fPIE" "-z nodynamic-undefined-weak $NOPIE_LDFLAGS"
|
||||
@@ -1173,7 +1174,7 @@ if { [isnative]
|
||||
] \
|
||||
]
|
||||
|
||||
- if { [istarget "i?86-*-linux*"] } {
|
||||
+ if { [istarget "i?86-*-linux*"] && ! [istarget i686*-*-*] } {
|
||||
run_cc_link_tests [list \
|
||||
[list \
|
||||
"Build pr21168.so with -z ibtplt" \
|
||||
--- binutils.orig/ld/testsuite/ld-ifunc/ifunc.exp 2021-07-20 15:22:27.806562231 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-ifunc/ifunc.exp 2021-07-20 15:28:03.248690669 +0100
|
||||
@@ -39,6 +39,7 @@ if { ![is_elf_format] || ![supports_gnu_
|
||||
|| [istarget nds32*-*-*]
|
||||
|| [istarget nios2-*-*]
|
||||
|| [istarget or1k-*-*]
|
||||
+ || [istarget ppc*-*-*]
|
||||
|| [istarget score*-*-*]
|
||||
|| [istarget sh*-*-*]
|
||||
|| [istarget tic6x-*-*]
|
||||
--- binutils.orig/ld/testsuite/ld-plugin/plugin.exp 2021-07-20 15:22:27.819562158 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-plugin/plugin.exp 2021-07-20 15:31:38.814487994 +0100
|
||||
@@ -308,6 +308,7 @@ if { !$can_compile || $failed_compile }
|
||||
run_ld_link_tests $plugin_tests
|
||||
|
||||
if { [is_elf_format] \
|
||||
+ && ! [istarget ppc64*-*-*]
|
||||
&& [ld_compile "$CC $CFLAGS" $srcdir/$subdir/func1p.c tmpdir/func1p.o] \
|
||||
&& [ld_compile "$CC $CFLAGS" $srcdir/$subdir/func2i.c tmpdir/func2i.o] \
|
||||
&& [ld_compile "$CC $CFLAGS" $srcdir/$subdir/func3h.c tmpdir/func3h.o] } {
|
||||
diff -rup binutils.orig/ld/testsuite/ld-powerpc/group1.sym binutils-2.37/ld/testsuite/ld-powerpc/group1.sym
|
||||
--- binutils.orig/ld/testsuite/ld-powerpc/group1.sym 2021-07-20 15:22:27.827562114 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-powerpc/group1.sym 2021-07-20 15:39:57.916703418 +0100
|
||||
@@ -1,3 +1,2 @@
|
||||
#...
|
||||
-.* 8 FUNC +GLOBAL DEFAULT \[<localentry>: 4\] +1 foo
|
||||
#pass
|
||||
diff -rup binutils.orig/ld/testsuite/ld-powerpc/group3.sym binutils-2.37/ld/testsuite/ld-powerpc/group3.sym
|
||||
--- binutils.orig/ld/testsuite/ld-powerpc/group3.sym 2021-07-20 15:22:27.825562125 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-powerpc/group3.sym 2021-07-20 15:40:13.388617110 +0100
|
||||
@@ -1,3 +1,2 @@
|
||||
#...
|
||||
-.* 4 FUNC +GLOBAL DEFAULT \[<localentry>: 1\] +1 foo
|
||||
#pass
|
||||
diff -rup binutils.orig/ld/testsuite/ld-powerpc/notoc3.d binutils-2.37/ld/testsuite/ld-powerpc/notoc3.d
|
||||
--- binutils.orig/ld/testsuite/ld-powerpc/notoc3.d 2021-07-20 15:22:27.824562131 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-powerpc/notoc3.d 2021-07-20 15:39:16.508934455 +0100
|
||||
@@ -58,7 +58,7 @@ Disassembly of section \.text:
|
||||
|
||||
.* <f2>:
|
||||
.*: (02 10 40 3c|3c 40 10 02) lis r2,4098
|
||||
-.*: (00 90 42 38|38 42 90 00) addi r2,r2,-28672
|
||||
+.*:.*
|
||||
.*: (.. .. ff 4b|4b ff .. ..) bl .* <.*\.long_branch\.f1>
|
||||
.*: (18 00 41 e8|e8 41 00 18) ld r2,24\(r1\)
|
||||
.*: (.. .. ff 4b|4b ff .. ..) bl .* <f2\+0x8>
|
||||
@@ -73,7 +73,7 @@ Disassembly of section \.text:
|
||||
|
||||
.* <g2>:
|
||||
.*: (02 10 40 3c|3c 40 10 02) lis r2,4098
|
||||
-.*: (00 90 42 38|38 42 90 00) addi r2,r2,-28672
|
||||
+.*:.*
|
||||
.*: (.. .. ff 4b|4b ff .. ..) bl .* <f2\+0x8>
|
||||
.*: (00 00 00 60|60 00 00 00) nop
|
||||
.*: (.. .. ff 4b|4b ff .. ..) bl .* <.*\.long_branch\.f1>
|
||||
@@ -92,6 +92,6 @@ Disassembly of section \.text\.ext:
|
||||
|
||||
8000000000000000 <ext>:
|
||||
8000000000000000: (02 10 40 3c|3c 40 10 02) lis r2,4098
|
||||
-8000000000000004: (00 90 42 38|38 42 90 00) addi r2,r2,-28672
|
||||
+8000000000000004:.*
|
||||
8000000000000008: (00 00 00 60|60 00 00 00) nop
|
||||
800000000000000c: (20 00 80 4e|4e 80 00 20) blr
|
||||
diff -rup binutils.orig/ld/testsuite/ld-powerpc/pr23937.d binutils-2.37/ld/testsuite/ld-powerpc/pr23937.d
|
||||
--- binutils.orig/ld/testsuite/ld-powerpc/pr23937.d 2021-07-20 15:22:27.828562108 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-powerpc/pr23937.d 2021-07-20 15:40:52.012401643 +0100
|
||||
@@ -6,5 +6,4 @@
|
||||
#...
|
||||
.* R_PPC64_IRELATIVE +10000180
|
||||
#...
|
||||
-.*: 0+10000180 +20 IFUNC +LOCAL +DEFAULT .* magic
|
||||
#pass
|
||||
diff -rup binutils.orig/ld/testsuite/ld-powerpc/tlsexe32.r binutils-2.37/ld/testsuite/ld-powerpc/tlsexe32.r
|
||||
--- binutils.orig/ld/testsuite/ld-powerpc/tlsexe32.r 2021-07-20 15:22:27.824562131 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-powerpc/tlsexe32.r 2021-07-20 15:35:59.630032873 +0100
|
||||
@@ -22,7 +22,8 @@ Section Headers:
|
||||
+\[[ 0-9]+\] \.dynamic +DYNAMIC +[0-9a-f]+ [0-9a-f]+ [0-9a-f]+ 08 +WA +4 +0 +4
|
||||
+\[[ 0-9]+\] \.got +PROGBITS +[0-9a-f]+ [0-9a-f]+ 000018 04 +WA +0 +0 +4
|
||||
+\[[ 0-9]+\] \.plt +PROGBITS +[0-9a-f]+ [0-9a-f]+ 000004 00 +WA +0 +0 +4
|
||||
- +\[[ 0-9]+\] \.symtab +SYMTAB +.*
|
||||
+#pass
|
||||
++\[[ 0-9]+\] \.symtab +SYMTAB +.*
|
||||
+\[[ 0-9]+\] \.strtab +STRTAB +.*
|
||||
+\[[ 0-9]+\] \.shstrtab +STRTAB +.*
|
||||
#...
|
||||
diff -rup binutils.orig/ld/testsuite/ld-powerpc/tlsexe32no.r binutils-2.37/ld/testsuite/ld-powerpc/tlsexe32no.r
|
||||
--- binutils.orig/ld/testsuite/ld-powerpc/tlsexe32no.r 2021-07-20 15:22:27.826562119 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-powerpc/tlsexe32no.r 2021-07-20 15:36:34.541838084 +0100
|
||||
@@ -22,6 +22,7 @@ Section Headers:
|
||||
+\[[ 0-9]+\] \.dynamic +DYNAMIC +[0-9a-f]+ [0-9a-f]+ [0-9a-f]+ 08 +WA +4 +0 +4
|
||||
+\[[ 0-9]+\] \.got +PROGBITS +[0-9a-f]+ [0-9a-f]+ 000038 04 +WA +0 +0 +4
|
||||
+\[[ 0-9]+\] \.plt +PROGBITS +[0-9a-f]+ [0-9a-f]+ 000004 00 +WA +0 +0 +4
|
||||
+#pass
|
||||
+\[[ 0-9]+\] \.symtab +SYMTAB +.*
|
||||
+\[[ 0-9]+\] \.strtab +STRTAB +.*
|
||||
+\[[ 0-9]+\] \.shstrtab +STRTAB +.*
|
||||
diff -rup binutils.orig/ld/testsuite/ld-powerpc/tlsso32.r binutils-2.37/ld/testsuite/ld-powerpc/tlsso32.r
|
||||
--- binutils.orig/ld/testsuite/ld-powerpc/tlsso32.r 2021-07-20 15:22:27.825562125 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-powerpc/tlsso32.r 2021-07-20 15:37:05.434665742 +0100
|
||||
@@ -20,6 +20,7 @@ Section Headers:
|
||||
+\[[ 0-9]+\] \.dynamic +DYNAMIC .* 08 +WA +3 +0 +4
|
||||
+\[[ 0-9]+\] \.got +PROGBITS .* 0+40 04 +WA +0 +0 +4
|
||||
+\[[ 0-9]+\] \.plt +PROGBITS .* 0+4 00 +WA +0 +0 +4
|
||||
+#pass
|
||||
+\[[ 0-9]+\] \.symtab +.*
|
||||
+\[[ 0-9]+\] \.strtab +.*
|
||||
+\[[ 0-9]+\] \.shstrtab +.*
|
||||
--- binutils.orig/ld/testsuite/ld-ifunc/ifunc.exp 2021-07-20 16:24:17.370869076 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-ifunc/ifunc.exp 2021-07-20 16:24:31.069792658 +0100
|
||||
@@ -39,6 +39,7 @@ if { ![is_elf_format] || ![supports_gnu_
|
||||
|| [istarget nds32*-*-*]
|
||||
|| [istarget nios2-*-*]
|
||||
|| [istarget or1k-*-*]
|
||||
+ || [istarget powerpc*-*-*]
|
||||
|| [istarget ppc*-*-*]
|
||||
|| [istarget score*-*-*]
|
||||
|| [istarget sh*-*-*]
|
||||
--- binutils.orig/ld/testsuite/ld-plugin/plugin.exp 2021-07-20 16:24:17.380869020 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-plugin/plugin.exp 2021-07-20 16:25:58.558304600 +0100
|
||||
@@ -308,7 +308,7 @@ if { !$can_compile || $failed_compile }
|
||||
run_ld_link_tests $plugin_tests
|
||||
|
||||
if { [is_elf_format] \
|
||||
- && ! [istarget ppc64*-*-*]
|
||||
+ && ! [istarget ppc64*-*-*] && ! [istarget powerpc*-*-*]
|
||||
&& [ld_compile "$CC $CFLAGS" $srcdir/$subdir/func1p.c tmpdir/func1p.o] \
|
||||
&& [ld_compile "$CC $CFLAGS" $srcdir/$subdir/func2i.c tmpdir/func2i.o] \
|
||||
&& [ld_compile "$CC $CFLAGS" $srcdir/$subdir/func3h.c tmpdir/func3h.o] } {
|
||||
--- binutils.orig/ld/testsuite/ld-powerpc/group1.sym 2021-07-20 16:24:17.384868997 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-powerpc/group1.sym 2021-07-20 16:27:36.604757678 +0100
|
||||
@@ -1,2 +1 @@
|
||||
-#...
|
||||
#pass
|
||||
--- binutils.orig/ld/testsuite/ld-powerpc/group3.sym 2021-07-20 16:24:17.389868970 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-powerpc/group3.sym 2021-07-20 16:28:33.372441000 +0100
|
||||
@@ -1,2 +1 @@
|
||||
-#...
|
||||
#pass
|
||||
--- binutils.orig/ld/testsuite/ld-powerpc/pr23937.d 2021-07-20 16:24:17.386868986 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-powerpc/pr23937.d 2021-07-20 16:29:00.604289085 +0100
|
||||
@@ -5,5 +5,4 @@
|
||||
|
||||
#...
|
||||
.* R_PPC64_IRELATIVE +10000180
|
||||
-#...
|
||||
#pass
|
||||
--- binutils.orig/ld/testsuite/ld-elf/pr26580-3.out 2021-07-20 17:07:36.952369125 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-elf/pr26580-3.out 2021-07-20 17:13:39.069350355 +0100
|
||||
@@ -1,2 +1,2 @@
|
||||
library not loaded
|
||||
-alignment 1
|
||||
+alignment .
|
||||
--- binutils.orig/ld/testsuite/ld-elf/shared.exp 2021-07-20 17:07:36.950369136 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-elf/shared.exp 2021-07-20 17:16:04.267540887 +0100
|
||||
@@ -1536,18 +1536,6 @@ if { [istarget *-*-linux*]
|
||||
"pr22393-2-static" \
|
||||
"pass.out" \
|
||||
] \
|
||||
- [list \
|
||||
- "Run pr21964-4" \
|
||||
- "" \
|
||||
- "" \
|
||||
- {pr21964-4.c} \
|
||||
- "pr21964-4" \
|
||||
- "pass.out" \
|
||||
- "" \
|
||||
- "" \
|
||||
- "" \
|
||||
- "-ldl" \
|
||||
- ] \
|
||||
]
|
||||
}
|
||||
|
||||
--- binutils.orig/ld/testsuite/ld-elf/tls.exp 2021-07-20 17:07:36.953369120 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-elf/tls.exp 2021-07-20 17:20:40.443001211 +0100
|
||||
@@ -32,6 +32,9 @@ if { !([istarget *-*-linux*]
|
||||
if { ![check_compiler_available] } {
|
||||
return
|
||||
}
|
||||
+if { [istarget s390x*-*-*] } {
|
||||
+ return
|
||||
+}
|
||||
|
||||
# This target requires extra GAS options when building PIC/PIE code.
|
||||
set AFLAGS_PIC ""
|
||||
--- binutils.orig/binutils/testsuite/binutils-all/compress.exp 2021-08-18 12:41:47.036991908 +0100
|
||||
+++ binutils-2.37/binutils/testsuite/binutils-all/compress.exp 2021-08-18 12:47:46.097987950 +0100
|
||||
@@ -766,12 +766,6 @@ proc test_gnu_debuglink {} {
|
||||
} else {
|
||||
pass "$test (objdump with missing link)"
|
||||
}
|
||||
- set got [remote_exec host [concat sh -c [list "$READELF -S tmpdir/testprog > /dev/null"]]]
|
||||
- if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
|
||||
- fail "$test (readelf with missing link)"
|
||||
- } else {
|
||||
- pass "$test (readelf with missing link)"
|
||||
- }
|
||||
}
|
||||
|
||||
if {[is_elf_format]} then {
|
||||
--- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2021-10-13 13:21:02.540433685 +0100
|
||||
+++ binutils-2.37/ld/testsuite/ld-plugin/lto.exp 2021-10-13 13:37:08.559139599 +0100
|
||||
@@ -31,8 +31,6 @@ if { ![check_plugin_api_available]
|
||||
|
||||
set saved_CFLAGS "$CFLAGS"
|
||||
set saved_CXXFLAGS "$CXXFLAGS"
|
||||
-regsub -all "(\\-Wp,)?-D_FORTIFY_SOURCE=\[0-9\]+" $CFLAGS "" CFLAGS
|
||||
-regsub -all "(\\-Wp,)?-D_FORTIFY_SOURCE=\[0-9\]+" $CXXFLAGS "" CXXFLAGS
|
||||
|
||||
proc restore_notify { } {
|
||||
global saved_CFLAGS
|
|
@ -0,0 +1,30 @@
|
|||
Only in binutils-2.37: binutils-update-linker-manual.patch
|
||||
Only in binutils-2.37/ld: binutils-update-linker-manual.patch
|
||||
Only in binutils-2.37/ld: ld.1.orig
|
||||
Only in binutils-2.37/ld: ld.1.rej
|
||||
diff -rup binutils.orig/ld/ld.info binutils-2.37/ld/ld.info
|
||||
--- binutils.orig/ld/ld.info 2022-06-08 15:54:20.068975306 +0200
|
||||
+++ binutils-2.37/ld/ld.info 2022-06-08 15:57:57.845793445 +0200
|
||||
@@ -2211,7 +2211,7 @@ GNU linker:
|
||||
'--enable-new-dtags', the new dynamic tags will be created as
|
||||
needed and older dynamic tags will be omitted. If you specify
|
||||
'--disable-new-dtags', no new dynamic tags will be created. By
|
||||
- default, the new dynamic tags are not created. Note that those
|
||||
+ default, the new dynamic tags are created. Note that those
|
||||
options are only available for ELF systems.
|
||||
|
||||
'--hash-size=NUMBER'
|
||||
Only in binutils-2.37/ld: ld.info.orig
|
||||
diff -rup binutils.orig/ld/ld.texi binutils-2.37/ld/ld.texi
|
||||
--- binutils.orig/ld/ld.texi 2022-06-08 15:54:20.068975306 +0200
|
||||
+++ binutils-2.37/ld/ld.texi 2022-06-08 15:57:57.850793464 +0200
|
||||
@@ -2773,7 +2773,7 @@ systems may not understand them. If you
|
||||
@option{--enable-new-dtags}, the new dynamic tags will be created as needed
|
||||
and older dynamic tags will be omitted.
|
||||
If you specify @option{--disable-new-dtags}, no new dynamic tags will be
|
||||
-created. By default, the new dynamic tags are not created. Note that
|
||||
+created. By default, the new dynamic tags are created. Note that
|
||||
those options are only available for ELF systems.
|
||||
|
||||
@kindex --hash-size=@var{number}
|
||||
Only in binutils-2.37/ld: ld.texi.orig
|
|
@ -0,0 +1,38 @@
|
|||
diff -up binutils-2.25.orig/bfd/configure.ac binutils-2.25/bfd/configure.ac
|
||||
--- binutils-2.25.orig/bfd/configure.ac 2014-12-24 10:34:45.590491143 +0000
|
||||
+++ binutils-2.25/bfd/configure.ac 2014-12-24 10:36:12.997981992 +0000
|
||||
@@ -183,11 +183,13 @@ if test "x${ac_cv_sizeof_long}" = "x8";
|
||||
BFD_HOST_64BIT_LONG=1
|
||||
test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long"
|
||||
test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long"
|
||||
-elif test "x${ac_cv_sizeof_long_long}" = "x8"; then
|
||||
+fi
|
||||
+if test "x${ac_cv_sizeof_long_long}" = "x8"; then
|
||||
BFD_HOST_64BIT_LONG_LONG=1
|
||||
test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long long"
|
||||
test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long long"
|
||||
- if test "x${ac_cv_sizeof_void_p}" = "x8"; then
|
||||
+ if test "x${ac_cv_sizeof_void_p}" = "x8" \
|
||||
+ -a "x${ac_cv_sizeof_long}" != "x8"; then
|
||||
BFD_HOSTPTR_T="unsigned long long"
|
||||
fi
|
||||
fi
|
||||
diff -up ../binutils-2.20.51.0.7.original/bfd/configure ./bfd/configure
|
||||
--- a/bfd/configure 2010-04-08 15:23:58.000000000 +0100
|
||||
+++ b/bfd/configure 2010-04-08 15:24:06.000000000 +0100
|
||||
@@ -12819,11 +12819,13 @@
|
||||
BFD_HOST_64BIT_LONG=1
|
||||
test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long"
|
||||
test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long"
|
||||
-elif test "x${ac_cv_sizeof_long_long}" = "x8"; then
|
||||
+fi
|
||||
+if test "x${ac_cv_sizeof_long_long}" = "x8"; then
|
||||
BFD_HOST_64BIT_LONG_LONG=1
|
||||
test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long long"
|
||||
test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long long"
|
||||
- if test "x${ac_cv_sizeof_void_p}" = "x8"; then
|
||||
+ if test "x${ac_cv_sizeof_void_p}" = "x8" \
|
||||
+ -a "x${ac_cv_sizeof_long}" != "x8"; then
|
||||
BFD_HOSTPTR_T="unsigned long long"
|
||||
fi
|
||||
fi
|
925
binutils.spec
925
binutils.spec
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,15 @@
|
|||
--- !Policy
|
||||
product_versions:
|
||||
- fedora-*
|
||||
decision_context: bodhi_update_push_stable
|
||||
subject_type: koji_build
|
||||
rules:
|
||||
- !PassingTestCaseRule {test_case_name: baseos-qe.koji-build.scratch-build.validation}
|
||||
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
|
||||
--- !Policy
|
||||
product_versions:
|
||||
- rhel-9
|
||||
decision_context: osci_compose_gate
|
||||
rules:
|
||||
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}
|
||||
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional}
|
|
@ -0,0 +1,28 @@
|
|||
diff -rup binutils.orig/ltmain.sh binutils-2.37/ltmain.sh
|
||||
--- binutils.orig/ltmain.sh 2022-01-27 16:23:09.304207432 +0000
|
||||
+++ binutils-2.37/ltmain.sh 2022-01-27 16:23:18.380143759 +0000
|
||||
@@ -7103,6 +7103,7 @@ EOF
|
||||
rpath="$finalize_rpath"
|
||||
test "$mode" != relink && rpath="$compile_rpath$rpath"
|
||||
for libdir in $rpath; do
|
||||
+ case "$libdir" in /usr/lib|/usr/lib64|/usr/lib/../lib|/usr/lib/../lib64) continue;; esac
|
||||
if test -n "$hardcode_libdir_flag_spec"; then
|
||||
if test -n "$hardcode_libdir_separator"; then
|
||||
if test -z "$hardcode_libdirs"; then
|
||||
@@ -7798,6 +7799,7 @@ EOF
|
||||
rpath=
|
||||
hardcode_libdirs=
|
||||
for libdir in $compile_rpath $finalize_rpath; do
|
||||
+ case "$libdir" in /usr/lib|/usr/lib64|/usr/lib/../lib|/usr/lib/../lib64) continue;; esac
|
||||
if test -n "$hardcode_libdir_flag_spec"; then
|
||||
if test -n "$hardcode_libdir_separator"; then
|
||||
if test -z "$hardcode_libdirs"; then
|
||||
@@ -7849,6 +7851,7 @@ EOF
|
||||
rpath=
|
||||
hardcode_libdirs=
|
||||
for libdir in $finalize_rpath; do
|
||||
+ case "$libdir" in /usr/lib|/usr/lib64|/usr/lib/../lib|/usr/lib/../lib64) continue;; esac
|
||||
if test -n "$hardcode_libdir_flag_spec"; then
|
||||
if test -n "$hardcode_libdir_separator"; then
|
||||
if test -z "$hardcode_libdirs"; then
|
||||
Only in binutils-2.37: ltmain.sh.orig
|
|
@ -0,0 +1,5 @@
|
|||
summary: CI Gating Plan
|
||||
discover:
|
||||
how: fmf
|
||||
execute:
|
||||
how: tmt
|
2
sources
2
sources
|
@ -1,2 +1,2 @@
|
|||
SHA512 (binutils-2.33.1.tar.xz) = b7a6767c6c7ca6b5cafa7080e6820b7bb3a53b7148348c438d99905defbdf0d30c9744a484ee01c9441a8153901808513366b15ba9533e20c9673c262ade36ac
|
||||
SHA512 (binutils-2.37.tar.xz) = 5c11aeef6935860a6819ed3a3c93371f052e52b4bdc5033da36037c1544d013b7f12cb8d561ec954fe7469a68f1b66f1a3cd53d5a3af7293635a90d69edd15e7
|
||||
SHA512 (binutils-2.19.50.0.1-output-format.sed) = 2f8686b0c8af13c98cda056824c2820416f6e2d003f70b78ccf5314525b9ee3684d421dfa83e638a2d42d06ea4d4bdaf5226b64d6ec26f7ff59c44ffb2a23dd2
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
|
||||
# Note - this is an rpm spec file, but it has been renamed in order to avoid
|
||||
# conflict with the real binutils.spec file.
|
||||
#
|
||||
# Its only use is to build a set of cross-binutils rpms by putting it into
|
||||
# the SPECS directory of an rpmbuild tree, installing the binutils source
|
||||
# rpm into the SOURCES directory and then running:
|
||||
#
|
||||
# rpmbuild -bb spec.binutils.cross
|
||||
|
||||
Summary: A meta collection of GNU binutils executables for cross builds
|
||||
Name: cross-binutils
|
||||
License: GPLv3+
|
||||
URL: https://sourceware.org/binutils
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
#
|
||||
# Configurable settings - adjust to match your needs:
|
||||
#
|
||||
|
||||
Version: 2.30
|
||||
Release: 89.el8
|
||||
|
||||
# The list of cross architectures to build.
|
||||
# Note: this list assumes that we are building on an x86_64-linux-gnu host.
|
||||
|
||||
%define arch_list aarch64-linux-gnu ppc64le-linux-gnu s390x-linux-gnu
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
%define binutils_source_rpm binutils-%{version}-%{release}.src.rpm
|
||||
|
||||
Source: %{binutils_source_rpm}
|
||||
|
||||
# Provides: bundled(libiberty)
|
||||
|
||||
BuildRequires: autoconf automake
|
||||
BuildRequires: perl, sed, coreutils
|
||||
BuildRequires: gcc, bison
|
||||
BuildRequires: gettext, flex, zlib-devel
|
||||
BuildRequires: findutils, texinfo
|
||||
BuildRequires: dejagnu, zlib-static, glibc-static, sharutils, bc
|
||||
# BuildRequires: elfutils-debuginfod-client-devel
|
||||
BuildRequires: rpm-build
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
%description
|
||||
Provides a collection of cross built binutils for the targets
|
||||
supported by RHEL (aarch64, ppc64le, s390x).
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
%build
|
||||
|
||||
# Install the binutils sources.
|
||||
rpm -ivh %{_sourcedir}/%{binutils_source_rpm}
|
||||
|
||||
# Build each set of cross binutils individually.
|
||||
for f in %{arch_list}; do
|
||||
rpmbuild -bb --define "binutils_target $f" %{_specdir}/binutils.spec --without testsuite --without gold
|
||||
done
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
%changelog
|
||||
* Wed Nov 11 2020 Nick Clifton <nickc@redhat.com> - 2.35.1-14
|
||||
- First release of cross binutils rpm.
|
|
@ -0,0 +1,2 @@
|
|||
The test's Makefiles are not used in Fedora CI infrastructure. But are kept here
|
||||
for backward compatibility with traditional beakerlib test harness in RHEL.
|
|
@ -0,0 +1,62 @@
|
|||
# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing
|
||||
# to use, modify, copy, or redistribute it subject to the terms
|
||||
# and conditions of the GNU General Public License version 2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
# PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# Testcases for this bugzilla were provided by Jakub Jelinek <jakub@redhat.com>
|
||||
# I've only wrapped them to RHTS
|
||||
|
||||
TOPLEVEL_NAMESPACE=/tools
|
||||
PACKAGE_NAME=binutils
|
||||
RELATIVE_PATH=bugzillas/241252
|
||||
|
||||
export TESTVERSION=1.0
|
||||
|
||||
export TEST=$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH)
|
||||
|
||||
.PHONY: all install download clean
|
||||
|
||||
FILES=$(METADATA) \
|
||||
runtest.sh \
|
||||
Makefile \
|
||||
x.i \
|
||||
y.i
|
||||
|
||||
run: $(FILES) #build
|
||||
./runtest.sh
|
||||
|
||||
build: $(BUILT_FILES)
|
||||
chmod a+x ./runtest.sh
|
||||
|
||||
clean:
|
||||
rm -f *~ $(BUILT_FILES)
|
||||
|
||||
include /usr/share/rhts/lib/rhts-make.include
|
||||
|
||||
$(METADATA): Makefile
|
||||
@touch $(METADATA)
|
||||
@echo "Owner: Michal Nowak <mnowak@redhat.com>" > $(METADATA)
|
||||
@echo "Name: $(TEST)" >> $(METADATA)
|
||||
@echo "Path: $(TEST_DIR)" >> $(METADATA)
|
||||
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
|
||||
@echo "Description: Regression test for bz241252." >> $(METADATA)
|
||||
@echo "TestTime: 3m" >> $(METADATA)
|
||||
@echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA)
|
||||
@echo "Requires: $(PACKAGE_NAME) gcc" >> $(METADATA)
|
||||
@echo "Priority: Normal" >> $(METADATA)
|
||||
@echo "Type: Regression" >> $(METADATA)
|
||||
@echo "Releases: -RHEL4" >> $(METADATA)
|
||||
@echo "License: GPLv2" >> $(METADATA)
|
||||
|
||||
rhts-lint $(METADATA)
|
|
@ -0,0 +1,12 @@
|
|||
summary: Regression test for bz241252.
|
||||
contact: Michal Nowak <mnowak@redhat.com>
|
||||
component:
|
||||
- binutils
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
recommend:
|
||||
- binutils
|
||||
- gcc
|
||||
duration: 3m
|
||||
extra-summary: /tools/binutils/bugzillas/241252
|
||||
extra-task: /tools/binutils/bugzillas/241252
|
|
@ -0,0 +1,62 @@
|
|||
#!/bin/bash
|
||||
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing
|
||||
# to use, modify, copy, or redistribute it subject to the terms
|
||||
# and conditions of the GNU General Public License version 2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
# PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# Include rhts environment
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
PACKAGE="binutils"
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup Setup
|
||||
rlAssertRpm $PACKAGE
|
||||
rlShowRunningKernel
|
||||
|
||||
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
|
||||
cp x.i y.i $TmpDir
|
||||
rlRun "pushd $TmpDir"
|
||||
|
||||
rlRun "gcc -c -O2 -fpic -o x.o x.i -g" 0 "Compile test case 'x'"
|
||||
rlRun "gcc -c -O2 -fpic -o y.o y.i -g" 0 "Compile test case 'y'"
|
||||
rlRun "gcc -Wl,--unique -o x [xy].o" 0 "Link 'x' and 'y'"
|
||||
|
||||
# Note: debug_ranges replaced by debug_rnglist (since DWARF 5 in Fedora 34)
|
||||
rlLogInfo 'x.o + y.o:'
|
||||
rlLogInfo "$( readelf -WS [xy].o | grep debug_rnglist | grep PROGBITS )"
|
||||
rlLogInfo 'x:'
|
||||
rlLogInfo "$( readelf -WS x | grep debug_rnglist )"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest Testing
|
||||
if [ $( readelf -WS [xy].o | grep debug_rnglist | grep PROGBITS | wc -l ) -eq 2 ] \
|
||||
&& [ $( readelf -WS x | grep debug_rnglist | wc -l ) -eq 1 ]; then
|
||||
rlPass "Debug ranges sections were merged"
|
||||
else
|
||||
rlFail "Debug ranges sections were not merged"
|
||||
fi
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup Cleanup
|
||||
rlRun "popd"
|
||||
rlRun "rm -r $TmpDir $rlRun_LOG" 0 "Removing tmp directory"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
|
@ -0,0 +1,62 @@
|
|||
extern void __assert_fail (const char *, const char *, unsigned int, const char *)
|
||||
__attribute__ ((__nothrow__, __noreturn__));
|
||||
|
||||
struct gst;
|
||||
struct gs;
|
||||
|
||||
extern void bar (void *) __attribute__ ((__nothrow__));
|
||||
|
||||
typedef int (*gf) (struct gst *, struct gs *,
|
||||
const unsigned char **, const unsigned char *,
|
||||
unsigned char **, unsigned long *, int, int);
|
||||
|
||||
struct gst
|
||||
{
|
||||
gf fct;
|
||||
int min_needed_from;
|
||||
};
|
||||
|
||||
struct gs
|
||||
{
|
||||
unsigned char *outbuf;
|
||||
unsigned char *outbufend;
|
||||
int flags;
|
||||
int invocation_counter;
|
||||
int internal_use;
|
||||
};
|
||||
|
||||
typedef struct gi
|
||||
{
|
||||
unsigned long nsteps;
|
||||
struct gst *steps;
|
||||
struct gs data [10];
|
||||
} *gt;
|
||||
|
||||
int
|
||||
foo (gt cd, const unsigned char **inbuf,
|
||||
const unsigned char *inbufend, unsigned char **outbuf,
|
||||
unsigned char *outbufend, unsigned long *irreversible)
|
||||
{
|
||||
unsigned long last_step;
|
||||
int result;
|
||||
last_step = cd->nsteps - 1;
|
||||
*irreversible = 0;
|
||||
cd->data[last_step].outbuf = outbuf != ((void *)0) ? *outbuf : ((void *)0);
|
||||
cd->data[last_step].outbufend = outbufend;
|
||||
gf fct = cd->steps->fct;
|
||||
if (inbuf == ((void *)0) || *inbuf == ((void *)0))
|
||||
result = (bar ((void *) (fct)), (*(fct)) (cd->steps, cd->data, ((void *)0), ((void *)0), ((void *)0), irreversible, cd->data[last_step].outbuf == ((void *)0) ? 2 : 1, 0));
|
||||
else
|
||||
{
|
||||
const unsigned char *last_start;
|
||||
((outbuf != ((void *)0) && *outbuf != ((void *)0)) ? (void) (0) : __assert_fail ("outbuf != ((void *)0) && *outbuf != ((void *)0)", "gconv.c", 67, "foo"));
|
||||
do
|
||||
{
|
||||
last_start = *inbuf;
|
||||
result = (bar ((void *) (fct)), (*(fct)) (cd->steps, cd->data, inbuf, inbufend, ((void *)0), irreversible, 0, 0));
|
||||
}
|
||||
while (result == 4 && last_start != *inbuf
|
||||
&& *inbuf + cd->steps->min_needed_from <= inbufend);
|
||||
}
|
||||
return result;
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
extern void __assert_fail (const char *, const char *, unsigned int, const char *)
|
||||
__attribute__ ((__nothrow__, __noreturn__));
|
||||
|
||||
struct gst;
|
||||
struct gs;
|
||||
|
||||
extern void bar (void *) __attribute__ ((__nothrow__));
|
||||
|
||||
void bar (void *x)
|
||||
{
|
||||
}
|
||||
|
||||
typedef int (*gf) (struct gst *, struct gs *,
|
||||
const unsigned char **, const unsigned char *,
|
||||
unsigned char **, unsigned long *, int, int);
|
||||
|
||||
struct gst
|
||||
{
|
||||
gf fct;
|
||||
int min_needed_from;
|
||||
};
|
||||
|
||||
struct gs
|
||||
{
|
||||
unsigned char *outbuf;
|
||||
unsigned char *outbufend;
|
||||
int flags;
|
||||
int invocation_counter;
|
||||
int internal_use;
|
||||
};
|
||||
|
||||
typedef struct gi
|
||||
{
|
||||
unsigned long nsteps;
|
||||
struct gst *steps;
|
||||
struct gs data [10];
|
||||
} *gt;
|
||||
|
||||
int
|
||||
baz (gt cd, const unsigned char **inbuf,
|
||||
const unsigned char *inbufend, unsigned char **outbuf,
|
||||
unsigned char *outbufend, unsigned long *irreversible)
|
||||
{
|
||||
unsigned long last_step;
|
||||
int result;
|
||||
last_step = cd->nsteps - 1;
|
||||
*irreversible = 0;
|
||||
cd->data[last_step].outbuf = outbuf != ((void *)0) ? *outbuf : ((void *)0);
|
||||
cd->data[last_step].outbufend = outbufend;
|
||||
gf fct = cd->steps->fct;
|
||||
if (inbuf == ((void *)0) || *inbuf == ((void *)0))
|
||||
result = (bar ((void *) (fct)), (*(fct)) (cd->steps, cd->data, ((void *)0), ((void *)0), ((void *)0), irreversible, cd->data[last_step].outbuf == ((void *)0) ? 2 : 1, 0));
|
||||
else
|
||||
{
|
||||
const unsigned char *last_start;
|
||||
((outbuf != ((void *)0) && *outbuf != ((void *)0)) ? (void) (0) : __assert_fail ("outbuf != ((void *)0) && *outbuf != ((void *)0)", "gconv.c", 67, "foo"));
|
||||
do
|
||||
{
|
||||
last_start = *inbuf;
|
||||
result = (bar ((void *) (fct)), (*(fct)) (cd->steps, cd->data, inbuf, inbufend, ((void *)0), irreversible, 0, 0));
|
||||
}
|
||||
while (result == 4 && last_start != *inbuf
|
||||
&& *inbuf + cd->steps->min_needed_from <= inbufend);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
#
|
||||
# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material
|
||||
# is made available to anyone wishing to use, modify, copy, or
|
||||
# redistribute it subject to the terms and conditions of the GNU General
|
||||
# Public License v.2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# Author: Michal Nowak <mnowak@redhat.com>
|
||||
|
||||
# The toplevel namespace within which the test lives.
|
||||
TOPLEVEL_NAMESPACE=tools
|
||||
|
||||
# The name of the package under test:
|
||||
PACKAGE_NAME=binutils
|
||||
|
||||
# The path of the test below the package:
|
||||
RELATIVE_PATH=Sanity/430856-libbfd.a-not-compiled-with-fPIC
|
||||
|
||||
# Version of the Test. Used with make tag.
|
||||
export TESTVERSION=1.1
|
||||
|
||||
# The combined namespace of the test.
|
||||
export TEST=/$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH)
|
||||
|
||||
|
||||
# A phony target is one that is not really the name of a file.
|
||||
# It is just a name for some commands to be executed when you
|
||||
# make an explicit request. There are two reasons to use a
|
||||
# phony target: to avoid a conflict with a file of the same
|
||||
# name, and to improve performance.
|
||||
.PHONY: all install download clean
|
||||
|
||||
# executables to be built should be added here, they will be generated on the system under test.
|
||||
BUILT_FILES=
|
||||
|
||||
# data files, .c files, scripts anything needed to either compile the test and/or run it.
|
||||
FILES=$(METADATA) runtest.sh Makefile PURPOSE bz430856.tar.gz
|
||||
|
||||
run: $(FILES) build
|
||||
./runtest.sh
|
||||
|
||||
build: $(BUILT_FILES)
|
||||
chmod a+x ./runtest.sh
|
||||
|
||||
clean:
|
||||
rm -f *~ *.rpm $(BUILT_FILES)
|
||||
|
||||
# You may need to add other targets e.g. to build executables from source code
|
||||
# Add them here:
|
||||
|
||||
|
||||
# Include Common Makefile
|
||||
include /usr/share/rhts/lib/rhts-make.include
|
||||
|
||||
# Generate the testinfo.desc here:
|
||||
$(METADATA): Makefile
|
||||
@touch $(METADATA)
|
||||
# Change to the test owner's name
|
||||
@echo "Owner: Michal Nowak <mnowak@redhat.com>" > $(METADATA)
|
||||
@echo "Name: $(TEST)" >> $(METADATA)
|
||||
@echo "Path: $(TEST_DIR)" >> $(METADATA)
|
||||
@echo "License: GPLv2" >> $(METADATA)
|
||||
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
|
||||
@echo "Description: libbfd.a not compiled with -fPIC">> $(METADATA)
|
||||
@echo "TestTime: 5m" >> $(METADATA)
|
||||
@echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA)
|
||||
# add any other packages for which your test ought to run here
|
||||
@echo "Requires: $(PACKAGE_NAME)" >> $(METADATA)
|
||||
@echo "Requires: $(PACKAGE_NAME)-devel" >> $(METADATA)
|
||||
@echo "Requires: gcc glibc-headers" >> $(METADATA)
|
||||
# add any other requirements for the script to run here
|
||||
|
||||
# You may need other fields here; see the documentation
|
||||
rhts-lint $(METADATA)
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
Would it be possible to have /usr/lib64/libbfd.a in binutils
|
||||
compiled with -fPIC? Otherwise, shared apps can't link against
|
||||
libbfd. In binutils.spec, libiberty.a is already recreated
|
||||
with -fPIC, is there some reason the same isn't done for
|
||||
libbfd?
|
||||
|
||||
From binutils.spec:
|
||||
|
||||
# Rebuild libiberty.a with -fPIC
|
||||
make -C libiberty clean
|
||||
make CFLAGS="-g -fPIC $RPM_OPT_FLAGS -D_FILE_OFFSET_BITS=64" -C libiberty
|
|
@ -0,0 +1,20 @@
|
|||
summary: libbfd.a not compiled with -fPIC
|
||||
description: "Would it be possible to have /usr/lib64/libbfd.a in binutils\ncompiled\
|
||||
\ with -fPIC? Otherwise, shared apps can't link against\nlibbfd. In binutils.spec,\
|
||||
\ libiberty.a is already recreated \nwith -fPIC, is there some reason the same\
|
||||
\ isn't done for \nlibbfd?\n\nFrom binutils.spec:\n\n # Rebuild libiberty.a with\
|
||||
\ -fPIC\n make -C libiberty clean\n make CFLAGS=\"-g -fPIC $RPM_OPT_FLAGS -D_FILE_OFFSET_BITS=64\"\
|
||||
\ -C libiberty\n"
|
||||
contact: Michal Nowak <mnowak@redhat.com>
|
||||
component:
|
||||
- binutils
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
recommend:
|
||||
- binutils
|
||||
- binutils-devel
|
||||
- gcc
|
||||
- glibc-headers
|
||||
duration: 5m
|
||||
extra-summary: /tools/binutils/Sanity/430856-libbfd.a-not-compiled-with-fPIC
|
||||
extra-task: /tools/binutils/Sanity/430856-libbfd.a-not-compiled-with-fPIC
|
|
@ -0,0 +1,21 @@
|
|||
CC=gcc
|
||||
CFLAGS=-g -Wall
|
||||
|
||||
all: test
|
||||
|
||||
libbfdtest.so bfdtest: Makefile
|
||||
|
||||
libbfdtest.so: libbfdtest.c libbfdtest.h
|
||||
$(CC) $(CFLAGS) -shared -o $@ -fPIC $< -lbfd -liberty
|
||||
|
||||
bfdtest: bfdtest.c libbfdtest.h libbfdtest.so
|
||||
$(CC) -o $@ $< -L. -Wl,-rpath,. -lbfdtest -ldl
|
||||
|
||||
.PHONY: test
|
||||
test: bfdtest
|
||||
./$<
|
||||
@echo OK
|
||||
|
||||
clean:
|
||||
$(RM) libbfdtest.so bfdtest
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#include "libbfdtest.h"
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
return libbfdtest () ? 0 : 1;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
#include <bfd.h>
|
||||
|
||||
#include "libbfdtest.h"
|
||||
|
||||
int
|
||||
libbfdtest (void)
|
||||
{
|
||||
bfd_set_error (bfd_error_no_error);
|
||||
return bfd_get_error () == bfd_error_no_error;
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
extern int libbfdtest (void);
|
|
@ -0,0 +1,49 @@
|
|||
#!/bin/bash
|
||||
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing
|
||||
# to use, modify, copy, or redistribute it subject to the terms
|
||||
# and conditions of the GNU General Public License version 2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
# PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# Include rhts environment
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
PACKAGE="binutils"
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlAssertRpm $PACKAGE
|
||||
rlShowPackageVersion $PACKAGE
|
||||
rlShowRunningKernel
|
||||
|
||||
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
|
||||
cp reproducer/* $TmpDir
|
||||
rlRun "pushd $TmpDir"
|
||||
rlRun "make clean" 0 "Make clean"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest
|
||||
rlRun "make" 0 "Build the files"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "popd"
|
||||
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
|
@ -0,0 +1,85 @@
|
|||
# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material
|
||||
# is made available to anyone wishing to use, modify, copy, or
|
||||
# redistribute it subject to the terms and conditions of the GNU General
|
||||
# Public License v.2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# Author: Michal Nowak <mnowak@redhat.com>
|
||||
|
||||
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
|
||||
# Example Makefile for RHTS #
|
||||
# This example is geared towards a test for a specific package #
|
||||
# It does most of the work for you, but may require further coding #
|
||||
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
|
||||
|
||||
# The toplevel namespace within which the test lives.
|
||||
TOPLEVEL_NAMESPACE=tools
|
||||
|
||||
# The name of the package under test:
|
||||
PACKAGE_NAME=binutils
|
||||
|
||||
# The path of the test below the package:
|
||||
RELATIVE_PATH=Sanity/435078-output-of-strings-0-n-is-incorrect
|
||||
|
||||
# Version of the Test. Used with make tag.
|
||||
export TESTVERSION=1.1
|
||||
|
||||
# The combined namespace of the test.
|
||||
export TEST=/$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH)
|
||||
|
||||
|
||||
# A phony target is one that is not really the name of a file.
|
||||
# It is just a name for some commands to be executed when you
|
||||
# make an explicit request. There are two reasons to use a
|
||||
# phony target: to avoid a conflict with a file of the same
|
||||
# name, and to improve performance.
|
||||
.PHONY: all install download clean
|
||||
|
||||
# executables to be built should be added here, they will be generated on the system under test.
|
||||
BUILT_FILES=
|
||||
|
||||
# data files, .c files, scripts anything needed to either compile the test and/or run it.
|
||||
FILES=$(METADATA) runtest.sh Makefile PURPOSE
|
||||
|
||||
run: $(FILES) build
|
||||
./runtest.sh
|
||||
|
||||
build: $(BUILT_FILES)
|
||||
chmod a+x ./runtest.sh
|
||||
|
||||
clean:
|
||||
rm -f *~ *.rpm $(BUILT_FILES)
|
||||
|
||||
# You may need to add other targets e.g. to build executables from source code
|
||||
# Add them here:
|
||||
|
||||
|
||||
# Include Common Makefile
|
||||
include /usr/share/rhts/lib/rhts-make.include
|
||||
|
||||
# Generate the testinfo.desc here:
|
||||
$(METADATA): Makefile
|
||||
@touch $(METADATA)
|
||||
# Change to the test owner's name
|
||||
@echo "Owner: Michal Nowak <mnowak@redhat.com>" > $(METADATA)
|
||||
@echo "Name: $(TEST)" >> $(METADATA)
|
||||
@echo "Path: $(TEST_DIR)" >> $(METADATA)
|
||||
@echo "License: GPLv2" >> $(METADATA)
|
||||
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
|
||||
@echo "Description: The output of "strings -0 file" is in loop and "-n 0xA" cannot be correctly recognized">> $(METADATA)
|
||||
@echo "TestTime: 5m" >> $(METADATA)
|
||||
@echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA)
|
||||
# add any other packages for which your test ought to run here
|
||||
@echo "Requires: $(PACKAGE_NAME)" >> $(METADATA)
|
||||
# add any other requirements for the script to run here
|
||||
|
||||
# You may need other fields here; see the documentation
|
||||
rhts-lint $(METADATA)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Use "strings -0 file", the output will be in loop.
|
||||
And "strings -n 0xA file" will report error as "invalid number 0xA"
|
|
@ -0,0 +1,14 @@
|
|||
summary: The output of strings -0 file is in loop and -n 0xA cannot be correctly recognized
|
||||
description: |
|
||||
Use "strings -0 file", the output will be in loop.
|
||||
And "strings -n 0xA file" will report error as "invalid number 0xA"
|
||||
contact: Michal Nowak <mnowak@redhat.com>
|
||||
component:
|
||||
- binutils
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
recommend:
|
||||
- binutils
|
||||
duration: 5m
|
||||
extra-summary: /tools/binutils/Sanity/435078-output-of-strings-0-n-is-incorrect
|
||||
extra-task: /tools/binutils/Sanity/435078-output-of-strings-0-n-is-incorrect
|
|
@ -0,0 +1,56 @@
|
|||
#!/bin/bash
|
||||
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing
|
||||
# to use, modify, copy, or redistribute it subject to the terms
|
||||
# and conditions of the GNU General Public License version 2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
# PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# Include rhts environment
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
PACKAGE="binutils"
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup Setup
|
||||
rlAssertRpm $PACKAGE
|
||||
rlShowPackageVersion $PACKAGE
|
||||
rlShowRunningKernel
|
||||
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
|
||||
rlRun "pushd $TmpDir"
|
||||
rlRun "echo -e \"asdjkhsd\nsdsdsdssd\n\nsdsd\n\" > tstfile" 0 "Generating test file tstfile"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest TestingOne
|
||||
rlRun "strings -0 tstfile > errorfile 2>&1 &"
|
||||
rlRun "sleep 5"
|
||||
rlRun "jobs"
|
||||
rlRun "kill -9 %1" 1 "strings in the loop"
|
||||
rlAssertGrep "minim" errorfile
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest TestingTwo
|
||||
rlRun "strings -n 0xA tstfile" 0 "echo \"PASS: tstfile processed.\""
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup Cleanup
|
||||
rlBundleLogs "binutils-outputs" errorfile tstfile
|
||||
rlRun "popd"
|
||||
rlRun "rm -r $TmpDir $rlRun_LOG" 0 "Removing tmp directory"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
|
@ -0,0 +1,60 @@
|
|||
# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Author: Michal Nowak <mnowak@redhat.com>
|
||||
|
||||
|
||||
TOPLEVEL_NAMESPACE=/tools
|
||||
PACKAGE_NAME=binutils
|
||||
RELATIVE_PATH=Sanity/480009-when-mistaking-argument-of-strings
|
||||
|
||||
export TEST=$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH)
|
||||
export TESTVERSION=1.0
|
||||
|
||||
BUILT_FILES=
|
||||
|
||||
FILES=$(METADATA) runtest.sh Makefile PURPOSE
|
||||
|
||||
.PHONY: all install download clean
|
||||
|
||||
run: $(FILES) build
|
||||
./runtest.sh
|
||||
|
||||
build: $(BUILT_FILES)
|
||||
chmod a+x ./runtest.sh
|
||||
|
||||
clean:
|
||||
rm -f *~ $(BUILT_FILES)
|
||||
|
||||
|
||||
include /usr/share/rhts/lib/rhts-make.include
|
||||
|
||||
|
||||
$(METADATA): Makefile
|
||||
@touch $(METADATA)
|
||||
@echo "Owner: Michal Nowak <mnowak@redhat.com>" > $(METADATA)
|
||||
@echo "Name: $(TEST)" >> $(METADATA)
|
||||
@echo "Path: $(TEST_DIR)" >> $(METADATA)
|
||||
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
|
||||
@echo "Description: When mistaking the argument of strings command , the same error message is output." >> $(METADATA)
|
||||
@echo "Bug: 480009" >> $(METADATA)
|
||||
@echo "Type: Sanity" >> $(METADATA)
|
||||
@echo "TestTime: 5m" >> $(METADATA)
|
||||
@echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA)
|
||||
@echo "Requires: $(PACKAGE_NAME)" >> $(METADATA)
|
||||
@echo "License: GPLv3+" >> $(METADATA)
|
||||
@echo "Releases: -RHEL4 -RHEL5" >> $(METADATA)
|
||||
|
||||
rhts-lint $(METADATA)
|
|
@ -0,0 +1,27 @@
|
|||
[RHEL5.2]
|
||||
# strings -n file1
|
||||
strings: invalid integer argument file1
|
||||
|
||||
# strings --bytes file1
|
||||
strings: invalid integer argument file1
|
||||
|
||||
# strings -n 0
|
||||
strings: invalid number 0
|
||||
|
||||
# strings --bytes 0
|
||||
strings: invalid number 0
|
||||
|
||||
|
||||
[RHEL5.3]
|
||||
# strings -n file1
|
||||
strings: invalid minimum string length 0
|
||||
|
||||
# strings --bytes file1
|
||||
strings: invalid minimum string length 0
|
||||
|
||||
# strings -n 0
|
||||
strings: invalid minimum string length 0
|
||||
|
||||
# strings --bytes 0
|
||||
strings: invalid minimum string length 0
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
summary: When mistaking the argument of strings command , the same error message is
|
||||
output.
|
||||
description: |+
|
||||
[RHEL5.2]
|
||||
# strings -n file1
|
||||
strings: invalid integer argument file1
|
||||
|
||||
# strings --bytes file1
|
||||
strings: invalid integer argument file1
|
||||
|
||||
# strings -n 0
|
||||
strings: invalid number 0
|
||||
|
||||
# strings --bytes 0
|
||||
strings: invalid number 0
|
||||
|
||||
|
||||
[RHEL5.3]
|
||||
# strings -n file1
|
||||
strings: invalid minimum string length 0
|
||||
|
||||
# strings --bytes file1
|
||||
strings: invalid minimum string length 0
|
||||
|
||||
# strings -n 0
|
||||
strings: invalid minimum string length 0
|
||||
|
||||
# strings --bytes 0
|
||||
strings: invalid minimum string length 0
|
||||
|
||||
contact: Michal Nowak <mnowak@redhat.com>
|
||||
component:
|
||||
- binutils
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
recommend:
|
||||
- binutils
|
||||
duration: 5m
|
||||
link:
|
||||
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=480009
|
||||
extra-summary: /tools/binutils/Sanity/480009-when-mistaking-argument-of-strings
|
||||
extra-task: /tools/binutils/Sanity/480009-when-mistaking-argument-of-strings
|
|
@ -0,0 +1,49 @@
|
|||
#!/bin/bash
|
||||
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
#
|
||||
# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Author: Michal Nowak <mnowak@redhat.com>
|
||||
|
||||
# source the test script helpers
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
PACKAGE=binutils
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlShowPackageVersion $PACKAGE
|
||||
rlShowRunningKernel
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "#1: strings -n file1"
|
||||
rlRun "strings -n file1 2>&1 | grep 'invalid integer argument file1'" 0 "Produced expected error msg: 'strings: invalid integer argument file1'"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "#2: strings --bytes file1"
|
||||
rlRun "strings --bytes file1 2>&1 | grep 'invalid integer argument file1'" 0 "Produced expected error msg: 'strings: invalid integer argument file1'"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "#3: strings -n 0"
|
||||
rlRun "strings -n 0 2>&1 | grep 'invalid minimum string length 0'" 0 "Produced expected error msg: 'strings: invalid minimum string length 0'"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "#4: strings --bytes 0"
|
||||
rlRun "strings --bytes 0 2>&1 | grep 'invalid minimum string length 0'" 0 "Produced expected error msg: 'strings: invalid minimum string length 0'"
|
||||
rlPhaseEnd
|
||||
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
|
@ -0,0 +1,59 @@
|
|||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing
|
||||
# to use, modify, copy, or redistribute it subject to the terms
|
||||
# and conditions of the GNU General Public License version 2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
# PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
export TEST=/tools/binutils/Regressions/readelf/509124-holes-in-debuginfo
|
||||
export TESTVERSION=1.0
|
||||
|
||||
BUILT_FILES=
|
||||
|
||||
FILES=$(METADATA) runtest.sh Makefile PURPOSE ascend.C test.c
|
||||
|
||||
.PHONY: all install download clean
|
||||
|
||||
run: $(FILES) build
|
||||
./runtest.sh
|
||||
|
||||
build: $(BUILT_FILES)
|
||||
chmod a+x ./runtest.sh
|
||||
|
||||
clean:
|
||||
rm -f *~ $(BUILT_FILES)
|
||||
|
||||
|
||||
include /usr/share/rhts/lib/rhts-make.include
|
||||
|
||||
$(METADATA): Makefile
|
||||
@echo "Owner: Michal Nowak <mnowak@redhat.com>" > $(METADATA)
|
||||
@echo "Name: $(TEST)" >> $(METADATA)
|
||||
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
|
||||
@echo "Path: $(TEST_DIR)" >> $(METADATA)
|
||||
@echo "Description: holes in debuginfo" >> $(METADATA)
|
||||
@echo "Type: Regression" >> $(METADATA)
|
||||
@echo "TestTime: 15m" >> $(METADATA)
|
||||
@echo "RunFor: binutils" >> $(METADATA)
|
||||
@echo "Requires: binutils gcc44 gcc gcc44-c++ gcc-c++" >> $(METADATA)
|
||||
@echo "Priority: Normal" >> $(METADATA)
|
||||
@echo "License: GPLv2" >> $(METADATA)
|
||||
@echo "Confidential: no" >> $(METADATA)
|
||||
@echo "Destructive: no" >> $(METADATA)
|
||||
@echo "Bug: 509124 499164" >> $(METADATA)
|
||||
@echo "Releases: -RHEL4 -RHEL5" >> $(METADATA)
|
||||
|
||||
rhts-lint $(METADATA)
|
|
@ -0,0 +1,14 @@
|
|||
(1) readelf fix now posted upstream:
|
||||
http://sourceware.org/ml/binutils/2009-07/msg00123.html
|
||||
QA: New testcase: binutils-all/testranges.s
|
||||
|
||||
(2) gcc has been fixed based on this bugreport by Jakub upstream:
|
||||
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40713
|
||||
gcc44 backport request for RHEL-5.5 is: Bug 510958
|
||||
|
||||
(3) Going to be backported for RHEL-5.5 readelf.
|
||||
It has been already fixed by Nick Clifton upstream:
|
||||
http://sourceware.org/ml/binutils/2009-06/msg00418.html
|
||||
http://sourceware.org/ml/binutils-cvs/2009-06/msg00158.html
|
||||
QA: RHEL-only new testcase: binutils-all/testloc.S
|
||||
as a part of binutils-all/readelf.exp (not shown when PASSing)
|
|
@ -0,0 +1,15 @@
|
|||
class A {
|
||||
public:
|
||||
A();
|
||||
void f(){}
|
||||
};
|
||||
|
||||
class C {
|
||||
C();
|
||||
};
|
||||
|
||||
C::C() {
|
||||
A* p = new A;
|
||||
p->f();
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
summary: holes in debuginfo
|
||||
description: "(1) readelf fix now posted upstream:\n http://sourceware.org/ml/binutils/2009-07/msg00123.html\n\
|
||||
QA: New testcase: binutils-all/testranges.s\n\n(2) gcc has been fixed based on\
|
||||
\ this bugreport by Jakub upstream:\n http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40713\n\
|
||||
\ gcc44 backport request for RHEL-5.5 is: Bug 510958\n\n(3) Going to be backported\
|
||||
\ for RHEL-5.5 readelf.\n It has been already fixed by Nick Clifton upstream:\n\
|
||||
\ http://sourceware.org/ml/binutils/2009-06/msg00418.html\n http://sourceware.org/ml/binutils-cvs/2009-06/msg00158.html\n\
|
||||
QA: RHEL-only new testcase: binutils-all/testloc.S\n as a part of binutils-all/readelf.exp\
|
||||
\ (not shown when PASSing) \n"
|
||||
contact: Michal Nowak <mnowak@redhat.com>
|
||||
component:
|
||||
- binutils
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
recommend:
|
||||
- binutils
|
||||
- gcc44
|
||||
- gcc
|
||||
- gcc44-c++
|
||||
- gcc-c++
|
||||
duration: 15m
|
||||
link:
|
||||
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=509124
|
||||
extra-summary: /tools/binutils/Regressions/readelf/509124-holes-in-debuginfo
|
||||
extra-task: /tools/binutils/Regressions/readelf/509124-holes-in-debuginfo
|
|
@ -0,0 +1,73 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing
|
||||
# to use, modify, copy, or redistribute it subject to the terms
|
||||
# and conditions of the GNU General Public License version 2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
# PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# Author: Michal Nowak <mnowak@redhat.com>
|
||||
#
|
||||
# Include rhts environment
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
PACKAGE="binutils"
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup Setup
|
||||
rlAssertRpm $PACKAGE
|
||||
rlShowPackageVersion $PACKAGE
|
||||
rlShowRunningKernel
|
||||
|
||||
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
|
||||
cp ascend.C test.c $TmpDir
|
||||
rlRun "pushd $TmpDir"
|
||||
rlPhaseEnd
|
||||
|
||||
for gcc in $( ls /usr/bin/gcc{,44} 2> /dev/null ); do
|
||||
for opt in s $( seq 0 3 ); do
|
||||
rlPhaseStartTest "ascend.C: gcc=$gcc opt=$opt"
|
||||
rlRun "$gcc -O${opt} ascend.C -c -g"
|
||||
rlAssertExists "ascend.o"
|
||||
# kinda weird running readelf on .o file, but...
|
||||
rlRun "readelf -a -w -W ./ascend.o > /dev/less 2> readelf.errout.g++" 0 "[gcc] Generating readelf output"
|
||||
rlLog "$( cat readelf.errout.g++ )"
|
||||
rlAssertNotGrep "readelf" readelf.errout.g++
|
||||
rm -f ./ascend.o
|
||||
rlPhaseEnd
|
||||
done
|
||||
done
|
||||
|
||||
for gcc in $( ls /usr/bin/gcc{,44} 2> /dev/null ); do
|
||||
for opt in s $( seq 0 3 ); do
|
||||
rlPhaseStartTest "test.c: gcc=$gcc opt=$opt"
|
||||
rlRun "$gcc -O${opt} test.c -c -g"
|
||||
rlAssertExists "test.o"
|
||||
# kinda weird running readelf on .o file, but...
|
||||
rlRun "readelf -a -w -W ./test.o > /dev/less 2> readelf.errout.g++" 0 "[gcc] Generating readelf output"
|
||||
rlLog "$( cat readelf.errout.g++ )"
|
||||
rlAssertNotGrep "readelf" readelf.errout.g++
|
||||
rm -f ./test.o
|
||||
rlPhaseEnd
|
||||
done
|
||||
done
|
||||
|
||||
rlPhaseStartCleanup Cleanup
|
||||
rlRun "popd"
|
||||
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
|
@ -0,0 +1,14 @@
|
|||
void f(int i) {
|
||||
k(i);
|
||||
}
|
||||
|
||||
void g(int i) {
|
||||
int j[65537];
|
||||
l(i,j);
|
||||
}
|
||||
|
||||
struct s {
|
||||
void (*m)(int i);
|
||||
void (*n)(int i);
|
||||
} t={f,g};
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing
|
||||
# to use, modify, copy, or redistribute it subject to the terms
|
||||
# and conditions of the GNU General Public License version 2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
# PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
export TEST=/tools/binutils/Regressions/ld/531269-ld-fails-to-merge-different-visibility-for-the-same-symbol
|
||||
export TESTVERSION=1.0
|
||||
|
||||
BUILT_FILES=
|
||||
|
||||
FILES=$(METADATA) runtest.sh Makefile PURPOSE bar.c foo.c
|
||||
|
||||
.PHONY: all install download clean
|
||||
|
||||
run: $(FILES) build
|
||||
./runtest.sh
|
||||
|
||||
build: $(BUILT_FILES)
|
||||
chmod a+x ./runtest.sh
|
||||
|
||||
clean:
|
||||
rm -f *~ $(BUILT_FILES)
|
||||
|
||||
|
||||
include /usr/share/rhts/lib/rhts-make.include
|
||||
|
||||
$(METADATA): Makefile
|
||||
@echo "Owner: Michal Nowak <mnowak@redhat.com>" > $(METADATA)
|
||||
@echo "Name: $(TEST)" >> $(METADATA)
|
||||
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
|
||||
@echo "Path: $(TEST_DIR)" >> $(METADATA)
|
||||
@echo "Description: ld fails to merge different visibility for the same symbol in distinct object files" >> $(METADATA)
|
||||
@echo "Type: Regression" >> $(METADATA)
|
||||
@echo "TestTime: 5m" >> $(METADATA)
|
||||
@echo "RunFor: binutils binutils220" >> $(METADATA)
|
||||
@echo "Requires: binutils binutils220 gcc44 gcc" >> $(METADATA)
|
||||
@echo "Priority: Normal" >> $(METADATA)
|
||||
@echo "License: GPLv2" >> $(METADATA)
|
||||
@echo "Confidential: no" >> $(METADATA)
|
||||
@echo "Destructive: no" >> $(METADATA)
|
||||
@echo "Bug: 531269" >> $(METADATA)
|
||||
@echo "Architectures: i386 x86_64" >> $(METADATA)
|
||||
|
||||
rhts-lint $(METADATA)
|
|
@ -0,0 +1,19 @@
|
|||
int foo __attribute__ ((section (".gnu.linkonce.d.1"),
|
||||
visibility ("hidden"))) = 1;
|
||||
int
|
||||
__attribute__ ((section (".gnu.linkonce.t.1"), visibility ("hidden")))
|
||||
bar ()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
int
|
||||
get_foo ()
|
||||
{
|
||||
return foo;
|
||||
}
|
||||
int
|
||||
get_bar ()
|
||||
{
|
||||
return bar ();
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
int foo __attribute__ ((section (".gnu.linkonce.d.1"))) = 1;
|
||||
int
|
||||
__attribute__ ((section (".gnu.linkonce.t.1")))
|
||||
bar ()
|
||||
{
|
||||
return 1;
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
summary: ld fails to merge different visibility for the same symbol in distinct object
|
||||
files
|
||||
description: ''
|
||||
contact: Michal Nowak <mnowak@redhat.com>
|
||||
component:
|
||||
- binutils
|
||||
- binutils220
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
recommend:
|
||||
- binutils
|
||||
- binutils220
|
||||
- gcc44
|
||||
- gcc
|
||||
duration: 5m
|
||||
link:
|
||||
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=531269
|
||||
extra-summary: /tools/binutils/Regressions/ld/531269-ld-fails-to-merge-different-visibility-for-the-same-symbol
|
||||
extra-task: /tools/binutils/Regressions/ld/531269-ld-fails-to-merge-different-visibility-for-the-same-symbol
|
|
@ -0,0 +1,57 @@
|
|||
#!/bin/bash
|
||||
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing
|
||||
# to use, modify, copy, or redistribute it subject to the terms
|
||||
# and conditions of the GNU General Public License version 2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
# PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# Author: Michal Nowak <mnowak@redhat.com>
|
||||
#
|
||||
# Include rhts environment
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
PACKAGE="binutils"
|
||||
|
||||
# Choose the compiler.
|
||||
GCC=${GCC:-gcc}
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlAssertRpm $PACKAGE
|
||||
rlShowPackageVersion $PACKAGE
|
||||
rlShowRunningKernel
|
||||
|
||||
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
|
||||
cp foo.c bar.c $TmpDir
|
||||
rlRun "pushd $TmpDir"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "gcc=$GCC Testing"
|
||||
rlRun "$GCC -fPIC -c -o foo.o foo.c" 0 "Compile foo.c => foo.o"
|
||||
rlRun "$GCC -fPIC -c -o bar.o bar.c" 0 "Compile bar.c => bar.o"
|
||||
rlRun "ld -shared -o foobar.so foo.o bar.o" 0 "Link foo.o & bar.o => foobar.so"
|
||||
rlAssertExists foobar.so
|
||||
rm foobar.so foo.o bar.o
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup Cleanup
|
||||
rlRun "popd"
|
||||
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
|
@ -0,0 +1,63 @@
|
|||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Makefile of /tools/binutils/Regression/RELRO-protection-effective
|
||||
# Description: bz1174826
|
||||
# Author: Martin Cermak <mcermak@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2014 Red Hat, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation, either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
# PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see http://www.gnu.org/licenses/.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
export TEST=/tools/binutils/Regression/RELRO-protection-effective
|
||||
export TESTVERSION=1.0
|
||||
|
||||
BUILT_FILES=
|
||||
|
||||
FILES=$(METADATA) runtest.sh Makefile PURPOSE
|
||||
|
||||
.PHONY: all install download clean
|
||||
|
||||
run: $(FILES) build
|
||||
./runtest.sh
|
||||
|
||||
build: $(BUILT_FILES)
|
||||
test -x runtest.sh || chmod a+x runtest.sh
|
||||
|
||||
clean:
|
||||
rm -f *~ $(BUILT_FILES)
|
||||
|
||||
|
||||
include /usr/share/rhts/lib/rhts-make.include
|
||||
|
||||
$(METADATA): Makefile
|
||||
@echo "Owner: Martin Cermak <mcermak@redhat.com>" > $(METADATA)
|
||||
@echo "Name: $(TEST)" >> $(METADATA)
|
||||
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
|
||||
@echo "Path: $(TEST_DIR)" >> $(METADATA)
|
||||
@echo "Description: bz1174826" >> $(METADATA)
|
||||
@echo "Type: Regression" >> $(METADATA)
|
||||
@echo "TestTime: 5m" >> $(METADATA)
|
||||
@echo "RunFor: binutils" >> $(METADATA)
|
||||
@echo "Requires: binutils gcc" >> $(METADATA)
|
||||
@echo "Priority: Normal" >> $(METADATA)
|
||||
@echo "License: GPLv2+" >> $(METADATA)
|
||||
@echo "Confidential: no" >> $(METADATA)
|
||||
@echo "Destructive: no" >> $(METADATA)
|
||||
@echo "Bug: 1174826" >> $(METADATA)
|
||||
|
||||
rhts-lint $(METADATA)
|
|
@ -0,0 +1,34 @@
|
|||
PURPOSE of /tools/binutils/Regression/RELRO-protection-effective
|
||||
Description: bz1174826
|
||||
Author: Martin Cermak <mcermak@redhat.com>
|
||||
Bug summary: RELRO is not read-only on PowerLE
|
||||
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1174826
|
||||
|
||||
/*
|
||||
* Test to exercise PIE and RELRO provided by Roland McGrath <roland@redhat.com>.
|
||||
*
|
||||
* Description:
|
||||
* Simple test for RELRO, which happens to be a PIE too, but that's only
|
||||
* because this kind of example has to be in PIC code to make RELRO relevant,
|
||||
* and PIE makes it simpler to write a standalone one-file test than writing
|
||||
* a DSO.
|
||||
*
|
||||
* The "const" makes "foo" .rodata material, and the init to an external symbol
|
||||
* reference makes it require a data relocation. Enabling -z relro for this
|
||||
* link puts that .rodata into a RELRO area. This program will crash because
|
||||
* the page containing "foo" has been made read-only when "main" runs.
|
||||
* Without RELRO, it would let you modify "foo" even though it's supposed to
|
||||
* be const.
|
||||
*
|
||||
* Test with RELRO should fail:
|
||||
* $ gcc -pie -fPIE -g -Wl,-z,relro -o relro relro.c
|
||||
* $ ./relro
|
||||
* Segmentation fault (core dumped)
|
||||
*
|
||||
* Test without RELRO should pass:
|
||||
* $ gcc -pie -fPIE -g -Wl,-z,norelro -o no-relro relro.c
|
||||
* $ ./no-relro
|
||||
*
|
||||
**/
|
||||
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
summary: bz1174826
|
||||
description: "Bug summary: RELRO is not read-only on PowerLE\nBugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1174826\n\
|
||||
\n/* \
|
||||
\ \n * Test to exercise PIE and RELRO provided by Roland McGrath <roland@redhat.com>.\n\
|
||||
\ * \
|
||||
\ \n * Description: \
|
||||
\ \n * Simple test for RELRO, which happens to be a PIE too,\
|
||||
\ but that's only \n * because this kind of example has to be in PIC\
|
||||
\ code to make RELRO relevant, \n * and PIE makes it simpler to write a standalone\
|
||||
\ one-file test than writing \n * a DSO. \
|
||||
\ \n * \
|
||||
\ \n * The \"const\" makes \"\
|
||||
foo\" .rodata material, and the init to an external symbol\n * reference makes\
|
||||
\ it require a data relocation. Enabling -z relro for this \n * link puts\
|
||||
\ that .rodata into a RELRO area. This program will crash because \n * the\
|
||||
\ page containing \"foo\" has been made read-only when \"main\" runs. \
|
||||
\ \n * Without RELRO, it would let you modify \"foo\" even though it's supposed\
|
||||
\ to \n * be const. \
|
||||
\ \n * \
|
||||
\ \n * Test with RELRO should fail: \
|
||||
\ \n * $ gcc -pie -fPIE -g -Wl,-z,relro -o relro\
|
||||
\ relro.c \n * $ ./relro \
|
||||
\ \n * Segmentation fault (core\
|
||||
\ dumped) \n * \
|
||||
\ \n * Test without\
|
||||
\ RELRO should pass: \n * $\
|
||||
\ gcc -pie -fPIE -g -Wl,-z,norelro -o no-relro relro.c \
|
||||
\ \n * $ ./no-relro \
|
||||
\ \n * \
|
||||
\ \n**/\n\n\n"
|
||||
contact: Martin Cermak <mcermak@redhat.com>
|
||||
component:
|
||||
- binutils
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
recommend:
|
||||
- binutils
|
||||
- gcc
|
||||
duration: 5m
|
||||
link:
|
||||
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1174826
|
||||
extra-summary: /tools/binutils/Regression/RELRO-protection-effective
|
||||
extra-task: /tools/binutils/Regression/RELRO-protection-effective
|
|
@ -0,0 +1,65 @@
|
|||
#!/bin/bash
|
||||
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# runtest.sh of /tools/binutils/Regression/RELRO-protection-effective
|
||||
# Description: bz1174826
|
||||
# Author: Martin Cermak <mcermak@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2014 Red Hat, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation, either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
# PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see http://www.gnu.org/licenses/.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# Include Beaker environment
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
PACKAGE="binutils"
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlAssertRpm $PACKAGE
|
||||
touch /tmp/disable-qe-abrt
|
||||
rlRun "TMPD=\$(mktemp -d)"
|
||||
rlRun "pushd $TMPD"
|
||||
cat > relro.c <<-EOF
|
||||
#include <stdio.h>
|
||||
|
||||
void *const foo = &stdout;
|
||||
|
||||
int main (void)
|
||||
{
|
||||
*(void **) &foo = &stderr;
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
rlRun "gcc -pie -fPIE -g -Wl,-z,relro -o relro relro.c"
|
||||
rlRun "gcc -pie -fPIE -g -Wl,-z,norelro -o no-relro relro.c"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest
|
||||
rlRun "./relro" 139
|
||||
rlRun "./no-relro"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "popd"
|
||||
rlRun "rm -r $TMPD"
|
||||
rm -f /tmp/disable-qe-abrt
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
|
@ -0,0 +1,63 @@
|
|||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Makefile of /tools/binutils/Regression/bz1080077-RFE-Please-configure-ld-bfd-to-allow-sysroot
|
||||
# Description: Test for BZ#1080077 ([RFE] - Please configure ld.bfd to allow --sysroot)
|
||||
# Author: Martin Cermak <mcermak@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2014 Red Hat, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation, either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
# PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see http://www.gnu.org/licenses/.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
export TEST=/tools/binutils/Regression/bz1080077-RFE-Please-configure-ld-bfd-to-allow-sysroot
|
||||
export TESTVERSION=1.0
|
||||
|
||||
BUILT_FILES=
|
||||
|
||||
FILES=$(METADATA) runtest.sh Makefile PURPOSE
|
||||
|
||||
.PHONY: all install download clean
|
||||
|
||||
run: $(FILES) build
|
||||
./runtest.sh
|
||||
|
||||
build: $(BUILT_FILES)
|
||||
test -x runtest.sh || chmod a+x runtest.sh
|
||||
|
||||
clean:
|
||||
rm -f *~ $(BUILT_FILES)
|
||||
|
||||
|
||||
include /usr/share/rhts/lib/rhts-make.include
|
||||
|
||||
$(METADATA): Makefile
|
||||
@echo "Owner: Martin Cermak <mcermak@redhat.com>" > $(METADATA)
|
||||
@echo "Name: $(TEST)" >> $(METADATA)
|
||||
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
|
||||
@echo "Path: $(TEST_DIR)" >> $(METADATA)
|
||||
@echo "Description: Test for BZ#1080077 ([RFE] - Please configure ld.bfd to allow --sysroot)" >> $(METADATA)
|
||||
@echo "Type: Regression" >> $(METADATA)
|
||||
@echo "TestTime: 5m" >> $(METADATA)
|
||||
@echo "RunFor: binutils" >> $(METADATA)
|
||||
@echo "Requires: binutils" >> $(METADATA)
|
||||
@echo "Priority: Normal" >> $(METADATA)
|
||||
@echo "License: GPLv2+" >> $(METADATA)
|
||||
@echo "Confidential: no" >> $(METADATA)
|
||||
@echo "Destructive: no" >> $(METADATA)
|
||||
@echo "Bug: 1080077" >> $(METADATA)
|
||||
|
||||
rhts-lint $(METADATA)
|
|
@ -0,0 +1,5 @@
|
|||
PURPOSE of /tools/binutils/Regression/bz1080077-RFE-Please-configure-ld-bfd-to-allow-sysroot
|
||||
Description: Test for BZ#1080077 ([RFE] - Please configure ld.bfd to allow --sysroot)
|
||||
Author: Martin Cermak <mcermak@redhat.com>
|
||||
Bug summary: [RFE] - Please configure ld.bfd to allow --sysroot
|
||||
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1080077
|
|
@ -0,0 +1,16 @@
|
|||
summary: Test for BZ#1080077 ([RFE] - Please configure ld.bfd to allow --sysroot)
|
||||
description: |
|
||||
Bug summary: [RFE] - Please configure ld.bfd to allow --sysroot
|
||||
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1080077
|
||||
contact: Martin Cermak <mcermak@redhat.com>
|
||||
component:
|
||||
- binutils
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
recommend:
|
||||
- binutils
|
||||
duration: 5m
|
||||
link:
|
||||
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1080077
|
||||
extra-summary: /tools/binutils/Regression/bz1080077-RFE-Please-configure-ld-bfd-to-allow-sysroot
|
||||
extra-task: /tools/binutils/Regression/bz1080077-RFE-Please-configure-ld-bfd-to-allow-sysroot
|
|
@ -0,0 +1,39 @@
|
|||
#!/bin/bash
|
||||
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# runtest.sh of /tools/binutils/Regression/bz1080077-RFE-Please-configure-ld-bfd-to-allow-sysroot
|
||||
# Description: Test for BZ#1080077 ([RFE] - Please configure ld.bfd to allow --sysroot)
|
||||
# Author: Martin Cermak <mcermak@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2014 Red Hat, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation, either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
# PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see http://www.gnu.org/licenses/.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# Include Beaker environment
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartTest
|
||||
LD_BDF=$(which ld.bfd)
|
||||
RPM=$(rpm -qf $LD_BDF)
|
||||
rlLogInfo "ld.bfd is $LD_BDF of $RPM"
|
||||
rlRun "ld.bfd --sysroot=/tmp |& grep 'not configured to use sysroots'" 1
|
||||
rlRun "ld.bfd --sysroot=/tmp |& grep 'no input files'"
|
||||
rlPhaseEnd
|
||||
rlJournalEnd
|
|
@ -0,0 +1,65 @@
|
|||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Makefile of /tools/binutils/Regression/bz1117458-ld-from-devtoolset-copies-SONAME-to-DT-NEEDED
|
||||
# Description: Test for BZ#1117458 (ld from devtoolset copies SONAME to DT_NEEDED)
|
||||
# Author: Milos Prchlik <mprchlik@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2014 Red Hat, Inc.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing
|
||||
# to use, modify, copy, or redistribute it subject to the terms
|
||||
# and conditions of the GNU General Public License version 2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
# PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
export TEST=/tools/binutils/Regression/bz1117458-ld-from-devtoolset-copies-SONAME-to-DT-NEEDED
|
||||
export TESTVERSION=1.0
|
||||
|
||||
BUILT_FILES=
|
||||
|
||||
FILES=$(METADATA) runtest.sh Makefile PURPOSE libtest.tar.gz
|
||||
|
||||
.PHONY: all install download clean
|
||||
|
||||
run: $(FILES) build
|
||||
./runtest.sh
|
||||
|
||||
build: $(BUILT_FILES)
|
||||
test -x runtest.sh || chmod a+x runtest.sh
|
||||
|
||||
clean:
|
||||
rm -f *~ $(BUILT_FILES)
|
||||
|
||||
|
||||
include /usr/share/rhts/lib/rhts-make.include
|
||||
|
||||
$(METADATA): Makefile
|
||||
@echo "Owner: Milos Prchlik <mprchlik@redhat.com>" > $(METADATA)
|
||||
@echo "Name: $(TEST)" >> $(METADATA)
|
||||
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
|
||||
@echo "Path: $(TEST_DIR)" >> $(METADATA)
|
||||
@echo "Description: Test for BZ#1117458 (ld from devtoolset copies SONAME to DT_NEEDED)" >> $(METADATA)
|
||||
@echo "Type: Regression" >> $(METADATA)
|
||||
@echo "TestTime: 5m" >> $(METADATA)
|
||||
@echo "RunFor: binutils" >> $(METADATA)
|
||||
@echo "Requires: binutils" >> $(METADATA)
|
||||
@echo "Requires: devtoolset-3.0-tools-devtoolset-3.0-Install-latest" >> $(METADATA)
|
||||
@echo "Priority: Normal" >> $(METADATA)
|
||||
@echo "License: GPLv2" >> $(METADATA)
|
||||
@echo "Confidential: yes" >> $(METADATA)
|
||||
@echo "Destructive: no" >> $(METADATA)
|
||||
@echo "Bug: 1117458" >> $(METADATA)
|
||||
|
||||
rhts-lint $(METADATA)
|
|
@ -0,0 +1,5 @@
|
|||
PURPOSE of /tools/binutils/Regression/bz1117458-ld-from-devtoolset-copies-SONAME-to-DT-NEEDED
|
||||
Description: Test for BZ#1117458 (ld from devtoolset copies SONAME to DT_NEEDED)
|
||||
Author: Milos Prchlik <mprchlik@redhat.com>
|
||||
Bug summary: ld from devtoolset copies SONAME to DT_NEEDED without checking if it’s empty
|
||||
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1117458
|
|
@ -0,0 +1,3 @@
|
|||
int foo(void) {
|
||||
return 10;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
summary: Test for BZ#1117458 (ld from devtoolset copies SONAME to DT_NEEDED)
|
||||
description: |
|
||||
Bug summary: ld from devtoolset copies SONAME to DT_NEEDED without checking if it’s empty
|
||||
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1117458
|
||||
contact: Milos Prchlik <mprchlik@redhat.com>
|
||||
component:
|
||||
- binutils
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
recommend:
|
||||
- binutils
|
||||
- gcc
|
||||
duration: 5m
|
||||
link:
|
||||
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1117458
|
||||
extra-summary: /tools/binutils/Regression/bz1117458-ld-from-devtoolset-copies-SONAME-to-DT-NEEDED
|
||||
extra-task: /tools/binutils/Regression/bz1117458-ld-from-devtoolset-copies-SONAME-to-DT-NEEDED
|
|
@ -0,0 +1,63 @@
|
|||
#!/bin/bash
|
||||
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# runtest.sh of /tools/binutils/Regression/bz1117458-ld-from-devtoolset-copies-SONAME-to-DT-NEEDED
|
||||
# Description: Test for BZ#1117458 (ld from devtoolset copies SONAME to DT_NEEDED)
|
||||
# Author: Milos Prchlik <mprchlik@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2014 Red Hat, Inc.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing
|
||||
# to use, modify, copy, or redistribute it subject to the terms
|
||||
# and conditions of the GNU General Public License version 2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
# PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# Include Beaker environment
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
PACKAGE="binutils"
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlAssertRpm $PACKAGE
|
||||
|
||||
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
|
||||
rlRun "cp user.c libfoo.c $TmpDir/"
|
||||
rlRun "pushd $TmpDir"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest
|
||||
rlRun "gcc -fPIC -g -c libfoo.c"
|
||||
rlAssertExists "libfoo.o"
|
||||
rlRun "gcc -shared -Wl,-soname, -o libfoo.so -lc libfoo.o 2>&1 | tee out" 0
|
||||
rlAssertExists "libfoo.so"
|
||||
rlLogInfo "gcc output:"
|
||||
rlLogInfo "$(cat out)"
|
||||
rlAssertGrep "SONAME must not be empty string; ignored" out
|
||||
rlRun "objdump -p libfoo.so | grep SONAME | awk '{print \$2}' > soname"
|
||||
if [ "`stat -c '%s' soname`" != "0" ]; then
|
||||
rlLogInfo "SONAME='$(cat soname)'"
|
||||
rlFail "Detected SONAME is empty"
|
||||
fi
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "popd" # $TmpDir
|
||||
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
|
@ -0,0 +1,9 @@
|
|||
#include <stdio.h>
|
||||
|
||||
extern int foo(void);
|
||||
|
||||
int main(void) {
|
||||
int a = foo();
|
||||
printf("a is %d\n", a);
|
||||
return 0;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue