diff options
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/ChangeLog | 25 | ||||
-rw-r--r-- | binutils/NEWS | 3 | ||||
-rw-r--r-- | binutils/README-how-to-make-a-release | 87 | ||||
-rw-r--r-- | binutils/bucomm.h | 6 | ||||
-rwxr-xr-x | binutils/configure | 262 | ||||
-rw-r--r-- | binutils/configure.ac | 248 | ||||
-rw-r--r-- | binutils/doc/binutils.texi | 20 | ||||
-rw-r--r-- | binutils/objcopy.c | 108 | ||||
-rw-r--r-- | binutils/od-elf32_avr.c | 19 | ||||
-rw-r--r-- | binutils/od-macho.c | 1 | ||||
-rw-r--r-- | binutils/od-xcoff.c | 1 | ||||
-rw-r--r-- | binutils/po/binutils.pot | 2 | ||||
-rw-r--r-- | binutils/readelf.c | 36 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/objcopy.exp | 7 |
14 files changed, 466 insertions, 359 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 01406cf..65cff80 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,7 +1,26 @@ -2023-07-30 Nick Clifton <nickc@redhat.com> +2023-07-30 Jose E. Marchesi <jose.marchesi@oracle.com> - This is the 2.41 release. - * configure: Regenerate. + * readelf.c (get_machine_flags): Recognize and pretty print BPF + machine flags. + +2023-07-24 Johannes Schauer Marin Rodrigues <josch@debian.org> + + * doc/binutils.texi (objcopy): Document change in behaviour of + objcopy's --preserve-dates command line option. + +2023-07-09 Fangrui Song <maskray@google.com> + + PR 30592 + * NEWS: Mention the new feature for objcopy. + * doc/binutils.texi: Mention "large". + * objcopy.c (parse_flags): Parse "large". + (check_new_section_flags): Error if "large" is used with a + non-x86-64 ELF target. + * testsuite/binutils-all/x86-64/large-sections.d: New. + * testsuite/binutils-all/x86-64/large-sections.s: New. + * testsuite/binutils-all/x86-64/large-sections-i386.d: New. + * testsuite/binutils-all/x86-64/large-sections-2.d: New. + * testsuite/binutils-all/x86-64/large-sections-2-x32.d: New. 2023-07-03 Nick Clifton <nickc@redhat.com> diff --git a/binutils/NEWS b/binutils/NEWS index 563062c..d64cae0 100644 --- a/binutils/NEWS +++ b/binutils/NEWS @@ -1,5 +1,8 @@ -*- text -*- +* objcopy --set-section-flags now supports "large" to set SHF_X86_64_LARGE + for ELF x86-64 objects. + Changes in 2.41: * The MIPS port now supports the Sony Interactive Entertainment Allegrex diff --git a/binutils/README-how-to-make-a-release b/binutils/README-how-to-make-a-release index a991792..aaf7704 100644 --- a/binutils/README-how-to-make-a-release +++ b/binutils/README-how-to-make-a-release @@ -34,6 +34,10 @@ How to perform a release. directories and the top level Makefile and configure files. Also consider updating the toplevel libtool files. +------------------------------------------------- +How to create the release branch. +------------------------------------------------- + Approx time to complete from here: 2 hours .... 2.5 If you have not built from the sources recently then now is the @@ -52,8 +56,8 @@ Approx time to complete from here: 2 hours .... 4. Create the release branch using: - git branch binutils-2_41-branch - git push origin binutils-2_41-branch + git branch binutils-2_42-branch + git push origin binutils-2_42-branch If you get a message like: @@ -85,8 +89,8 @@ Approx time to complete from here: 2 hours .... ask Joel Brobecker <brobecker AT adacore DOT com>. 7. Rename the current HEAD version entry in Bugzilla, and create a - new one. E.g. rename "2.41 (HEAD)" to 2.41, and create - "2.42 (HEAD)": + new one. E.g. rename "2.42 (HEAD)" to 2.42, and create + "2.43 (HEAD)": https://sourceware.org/bugzilla/editversions.cgi?product=binutils @@ -99,13 +103,13 @@ Approx time to complete from here: 2 hours .... and the version number on the MAINLINE should be set to 2.41.50 - ie half way to 2.42 release. - So the branch bfd/version.m4 has: + So the BRANCH bfd/version.m4 has: - m4_define([BFD_VERSION], [2.40.90]) + m4_define([BFD_VERSION], [2.41.90]) - and the mainline has: + and the MAINLINE has: - m4_define([BFD_VERSION], [2.41.50]) + m4_define([BFD_VERSION], [2.42.50]) Regenerate various files on both branch and HEAD by configuring with "--enable-maintainer-mode --enable-gold --enable-shared" and then building @@ -137,21 +141,21 @@ Approx time to complete from here: 2 hours .... xz -9 binutils-<release>.tar eg: - touch -d 2023-06-01 binutils-2.40.90/gas/doc/.dirstamp - tar rvf binutils-2.40.90.tar binutils-2.40.90/gas/doc/.ditstamp - rm binutils-2.40.90.tar.xz - xz -9 binutils-2.40.90.tar + touch -d 2024-01-01 binutils-2.41.90/gas/doc/.dirstamp + tar rvf binutils-2.41.90.tar binutils-2.41.90/gas/doc/.dirstamp + rm binutils-2.41.90.tar.xz + xz -9 binutils-2.41.90.tar ...END OF FIXME c. Build a test target using this tarball. - cp binutils-2.40.90.tar.xz /dev/shm + cp binutils-2.41.90.tar.xz /dev/shm pushd /dev/shm - tar xvf binutils-2.40.90.tar.xz + tar xvf binutils-2.41.90.tar.xz mkdir build cd build - ../binutils-2.40.90/configure --quiet --enable-gold + ../binutils-2.41.90/configure --quiet --enable-gold make popd @@ -173,11 +177,11 @@ Approx time to complete from here: 2 hours .... ------------------------------------------------------------------------ Dear Translation Project - The 2.40 release branch has been created for the GNU Binutils project. + The 2.42 release branch has been created for the GNU Binutils project. A snapshot of the branch sources can be found here: - https://sourceware.org/pub/binutils/snapshots/binutils-2.39.90.tar.xz + https://sourceware.org/pub/binutils/snapshots/binutils-2.41.90.tar.xz We hope to make the official release of the sources on the <DATE> although that could change if there are important bugs that need to @@ -188,7 +192,7 @@ Dear Translation Project binutils mailing list. Set a date for when the release will actually happen. Something like: ------------------------------------------------------------------------- + Hi Everyone, The <NEW_VERSION> branch has now been created: @@ -219,25 +223,39 @@ Hi Everyone, architectures... ============================================================================== +============================================================================== -When the time comes to actually make the release.... +For the next few weeks, monitor the mailing list for new translations +and respond to any requests to have patches applied to the branch. +============================================================================== +============================================================================== + +Then, a couple of weeks later ... + +------------------------------------------------- +How to create the release. +------------------------------------------------- 20. Make sure that the branch sources still build, test and install correctly. Make sure that the sources are clean, without any patch files (.reg .orig *~) left over. cd <branch> + git pull git clean -fdx + cd <builds> + make 21. a. Update the release number in bfd/version.m4 on the release branch to a whole new minor version number, without a point - value. Eg "2.40.90" becomes "2.41". NB/ Not: "2.41.00" + value. Eg "2.41.90" becomes "2.42". NB/ Not: "2.42.00" b. Change bfd/development.sh to set all values to "false". c. Regenerate the configure and makefiles. And *info* files. + cd <build-configured-with-enable-maintainer-mode> make all-gas all-ld all-binutils all-gprof all-gold all-gprofng all-libctf make info @@ -259,7 +277,7 @@ When the time comes to actually make the release.... need to agree to have it there. e. Add ChangeLog entries for all of the updates and add a - "this-is-the-2.41-release" comment and commit. + "this-is-the-2.42-release" comment and commit. git add . git commit @@ -281,7 +299,11 @@ When the time comes to actually make the release.... DEVO_SUPPORT variable in the src-release.sh script. If they are needed then add them. - Create the release tarballs: + PARANOIA: Check that there are no pending commits: + + git status + + Then create the release tarballs: ./src-release.sh -b -g -l -x binutils @@ -326,14 +348,15 @@ When the time comes to actually make the release.... [optional: add "-u XXXXX" to sign with a gpg key] enter a tag message such as: "Official GNU Binutils 2.4x release" - git tag -a binutils-2_41 -u DD9E3C4F <=== Be careful to get the tag right + git tag -a <TAG> -u <Your Key> + git tag -a binutils-2_42 -u DD9E3C4F <=== Be careful to get the tag right NB/ If you do sign the binaries make sure to use a key that has been published with the FSF. Then push the release: - git push origin binutils-2_41 + git push origin binutils-2_42 If you get an error message along the lines of: "Invalid revision range ..." @@ -341,7 +364,7 @@ When the time comes to actually make the release.... 27. Upload the tarballs to ftp.gnu.org. - for A in bz2 gz lz xz ; do gnupload --to ftp.gnu.org:binutils binutils-2.41.tar.$A ; done + gnupload --to ftp.gnu.org:binutils binutils-2.42.tar.* Be prepared to provide the password for the key, if you signed the binaries. @@ -369,7 +392,7 @@ When the time comes to actually make the release.... 29. Update web pages. For sourceware.org: Create a new documentation folder on the sourceware.org web - pages as /sourceware/www/sourceware/htdocs/binutils/docs-2.3x. + pages as /sourceware/www/sourceware/htdocs/binutils/docs-2.4x. sftp sourceware.org cd /sourceware/www/sourceware/htdocs/binutils @@ -378,9 +401,9 @@ When the time comes to actually make the release.... mkdir as mkdir bfd mkdir binutils - mkdir gprof + mkdir gprof [NB/ gprofng is not needed] mkdir ld - cd ../docs-2.3(x-1) + cd ../docs-2.4(x-1) get index.html Update the (local copy of the) index.html file to point to the @@ -412,7 +435,7 @@ When the time comes to actually make the release.... put bfd.pdf cd binutils - lcd ../../binutils/binutils <=== NB/ Path not like others + lcd ../../binutils/binutils_html <=== NB/ Path not like others put * cd .. lcd ../doc <=== Also not like the others @@ -473,7 +496,7 @@ Hi FSF Webmasters, https://www.gnu.org/software/binutils/binutils.html be updated to indicate that there is now a newer version available - (2.3x). I have already updated the related page on the sourceware + (2.4x). I have already updated the related page on the sourceware website so this might be useful as a template: https://sourceware.org/binutils/ @@ -536,7 +559,7 @@ Cheers date suffix keeps the version lower than the trunk version. Regenerate files. Commit these changes. - 33. Email the binutils list telling everyone that the 2.34 branch + 33. Email the binutils list telling everyone that the 2.4x branch is now open for business as usual and that patches no longer need special approval. @@ -544,7 +567,7 @@ Cheers any pending obsolete targets into the definitely obsolete section. Create a changelog entry and commit. - + Sit back and relax, you are all done. -------------------------------------------------------------------------- How to perform a POINT release. -------------------------------------------------------------------------- diff --git a/binutils/bucomm.h b/binutils/bucomm.h index 0c11c0b..b708790 100644 --- a/binutils/bucomm.h +++ b/binutils/bucomm.h @@ -76,12 +76,6 @@ extern void set_times (const char *, const struct stat *); extern int smart_rename (const char *, const char *, int, struct stat *, bool); - -/* In libiberty. */ -void *xmalloc (size_t); - -void *xrealloc (void *, size_t); - #if __GNUC__ >= 7 #define _mul_overflow(a, b, res) __builtin_mul_overflow (a, b, res) #else diff --git a/binutils/configure b/binutils/configure index e0bf7f1..2b7462b 100755 --- a/binutils/configure +++ b/binutils/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for binutils 2.41. +# Generated by GNU Autoconf 2.69 for binutils 2.41.50. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -587,8 +587,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='binutils' PACKAGE_TARNAME='binutils' -PACKAGE_VERSION='2.41' -PACKAGE_STRING='binutils 2.41' +PACKAGE_VERSION='2.41.50' +PACKAGE_STRING='binutils 2.41.50' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1401,7 +1401,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures binutils 2.41 to adapt to many kinds of systems. +\`configure' configures binutils 2.41.50 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1472,7 +1472,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of binutils 2.41:";; + short | recursive ) echo "Configuration of binutils 2.41.50:";; esac cat <<\_ACEOF @@ -1631,7 +1631,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -binutils configure 2.41 +binutils configure 2.41.50 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2099,7 +2099,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by binutils $as_me 2.41, which was +It was created by binutils $as_me 2.41.50, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3081,7 +3081,7 @@ fi # Define the identity of the package. PACKAGE='binutils' - VERSION='2.41' + VERSION='2.41.50' cat >>confdefs.h <<_ACEOF @@ -14542,7 +14542,6 @@ _ACEOF fi -all_targets=false BUILD_SRCONV= BUILD_DLLTOOL= DLLTOOL_DEFS= @@ -14559,140 +14558,137 @@ od_vectors= for targ in $target $canon_targets do - if test "x$targ" = "xall"; then - all_targets=true + case $targ in + all | *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' - BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)' - BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' - BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' + ;; + esac + + case $targ in + all | spu-*-*) + BUILD_MISC='bin2c$(EXEEXT_FOR_BUILD)' + ;; + esac + + case $targ in + powerpc*-*-linux* | powerpc*-*-elf* | powerpc*-*-eabi*) + BUILD_INSTALL_MISC=embedspu + ;; + esac + + case $targ in + mep-*) + OBJDUMP_DEFS="-DSKIP_ZEROES=256 -DSKIP_ZEROES_AT_END=0" + ;; + powerpc*-aix5.[01]) + ;; + powerpc*-aix[5-9].*) + OBJDUMP_DEFS="-DAIX_WEAK_SUPPORT" + ;; + esac + + case $targ in + aarch64-*-mingw*) BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' if test -z "$DLLTOOL_DEFAULT"; then - DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386" + DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_AARCH64" fi - DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386" + DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_AARCH64" + BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' + BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)' - od_vectors="$od_vectors objdump_private_desc_xcoff objdump_private_desc_pe" - else - case $targ in - *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;; - esac - - case $targ in - aarch64-*-mingw*) - BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' - if test -z "$DLLTOOL_DEFAULT"; then - DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_AARCH64" - fi - DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_AARCH64" - BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' - BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' - BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)' - ;; - arm-wince-pe* | arm-*-wince | arm*-*-cegcc* | arm*-*-mingw32ce*) - BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' - if test -z "$DLLTOOL_DEFAULT"; then + ;; + arm-wince-pe* | arm-*-wince | arm*-*-cegcc* | arm*-*-mingw32ce*) + BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' + if test -z "$DLLTOOL_DEFAULT"; then DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM_WINCE" - fi - DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_WINCE -DDLLTOOL_ARM" - BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' - BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' - ;; - arm-*-pe*) - BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' - if test -z "$DLLTOOL_DEFAULT"; then + fi + DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_WINCE -DDLLTOOL_ARM" + BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' + BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' + ;; + arm-*-pe*) + BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' + if test -z "$DLLTOOL_DEFAULT"; then DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM" - fi - DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM" - BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' - BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' - ;; - x86_64-*-mingw* | x86_64-*-cygwin*) - BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' - if test -z "$DLLTOOL_DEFAULT"; then - DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MX86_64" - fi - DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MX86_64" - BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' - BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' - BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)' - ;; - i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32**) - BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' - if test -z "$DLLTOOL_DEFAULT"; then + fi + DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM" + BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' + BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' + ;; + i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32** | all) + BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' + if test -z "$DLLTOOL_DEFAULT"; then DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386" - fi - DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386" - BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' - BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' - BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)' - ;; - i[3-7]86-*-interix) - BUILD_DLLTOOL='$(DLLTOOL_PROG)' - if test -z "$DLLTOOL_DEFAULT"; then + fi + DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386" + BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' + BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' + BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)' + ;; + i[3-7]86-*-interix) + BUILD_DLLTOOL='$(DLLTOOL_PROG)' + if test -z "$DLLTOOL_DEFAULT"; then DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386" - fi - DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386" - ;; - powerpc*-aix5.[01]) - ;; - powerpc*-aix[5-9].*) - OBJDUMP_DEFS="-DAIX_WEAK_SUPPORT" - ;; - powerpc*-*-linux* | powerpc*-*-elf* | powerpc*-*-eabi*) - case "$BUILD_INSTALL_MISC" in - *embedspu*) ;; - *) BUILD_INSTALL_MISC="${BUILD_INSTALL_MISC} embedspu" - esac - ;; - sh*-*-pe) - BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' - if test -z "$DLLTOOL_DEFAULT"; then - DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_SH" - fi - DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH" - BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' - BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' - ;; - spu-*-*) - BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)' - ;; - mcore-*-pe) - BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' - if test -z "$DLLTOOL_DEFAULT"; then + fi + DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386" + ;; + mcore-*-pe) + BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' + if test -z "$DLLTOOL_DEFAULT"; then DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE" - fi - DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE" - BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' - BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' - ;; - mcore-*-elf) - BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' - if test -z "$DLLTOOL_DEFAULT"; then + fi + DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE" + BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' + BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' + ;; + mcore-*-elf) + BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' + if test -z "$DLLTOOL_DEFAULT"; then DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE_ELF" - fi - DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF" - ;; - mep-*) - OBJDUMP_DEFS="-DSKIP_ZEROES=256 -DSKIP_ZEROES_AT_END=0" - ;; - esac + fi + DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF" + ;; + sh*-*-pe) + BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' + if test -z "$DLLTOOL_DEFAULT"; then + DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_SH" + fi + DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH" + BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' + BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' + ;; + x86_64-*-mingw* | x86_64-*-cygwin*) + BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' + if test -z "$DLLTOOL_DEFAULT"; then + DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MX86_64" + fi + DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MX86_64" + BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' + BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' + BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)' + ;; + esac - # Add objdump private vectors. - case $targ in - avr-*-*) - od_vectors="$od_vectors objdump_private_desc_elf32_avr" - ;; - powerpc*-*-aix* | rs6000-*-aix*) - od_vectors="$od_vectors objdump_private_desc_xcoff" - ;; - *-*-pe* | *-*-cygwin* | *-*-mingw*) - od_vectors="$od_vectors objdump_private_desc_pe" - ;; - *-*-darwin*) - od_vectors="$od_vectors objdump_private_desc_mach_o" - ;; - esac - fi + # Add objdump private vectors. + case $targ in + all) + od_vectors="objdump_private_desc_elf32_avr objdump_private_desc_xcoff\ + objdump_private_desc_pe objdump_private_desc_mach_o" + ;; + avr-*-*) + od_vectors="$od_vectors objdump_private_desc_elf32_avr" + ;; + powerpc*-*-aix* | rs6000-*-aix*) + od_vectors="$od_vectors objdump_private_desc_xcoff" + ;; + *-*-pe* | *-*-cygwin* | *-*-mingw*) + od_vectors="$od_vectors objdump_private_desc_pe" + ;; + *-*-darwin*) + od_vectors="$od_vectors objdump_private_desc_mach_o" + ;; + esac done # Uniq objdump private vector, build objdump target ofiles. @@ -15332,7 +15328,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by binutils $as_me 2.41, which was +This file was extended by binutils $as_me 2.41.50, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15398,7 +15394,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -binutils config.status 2.41 +binutils config.status 2.41.50 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/binutils/configure.ac b/binutils/configure.ac index b5798bf..30cd7b9 100644 --- a/binutils/configure.ac +++ b/binutils/configure.ac @@ -319,7 +319,6 @@ fi AC_CHECK_HEADER(iconv.h) AM_ICONV -all_targets=false BUILD_SRCONV= BUILD_DLLTOOL= DLLTOOL_DEFS= @@ -336,148 +335,143 @@ od_vectors= for targ in $target $canon_targets do - if test "x$targ" = "xall"; then - all_targets=true + case $targ in + all | *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' - BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)' - BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' - BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' + ;; + esac + + case $targ in + all | spu-*-*) + BUILD_MISC='bin2c$(EXEEXT_FOR_BUILD)' + ;; + esac + + case $targ in + powerpc*-*-linux* | powerpc*-*-elf* | powerpc*-*-eabi*) + BUILD_INSTALL_MISC=embedspu + ;; + esac + + case $targ in + mep-*) + OBJDUMP_DEFS="-DSKIP_ZEROES=256 -DSKIP_ZEROES_AT_END=0" + ;; +changequote(,)dnl + powerpc*-aix5.[01]) + ;; + powerpc*-aix[5-9].*) +changequote([,])dnl + OBJDUMP_DEFS="-DAIX_WEAK_SUPPORT" + ;; + esac + + case $targ in + aarch64-*-mingw*) BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' if test -z "$DLLTOOL_DEFAULT"; then - DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386" + DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_AARCH64" fi - DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386" + DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_AARCH64" + BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' + BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)' - od_vectors="$od_vectors objdump_private_desc_xcoff objdump_private_desc_pe" - else - case $targ in - *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;; - esac - - case $targ in - aarch64-*-mingw*) - BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' - if test -z "$DLLTOOL_DEFAULT"; then - DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_AARCH64" - fi - DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_AARCH64" - BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' - BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' - BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)' - ;; - arm-wince-pe* | arm-*-wince | arm*-*-cegcc* | arm*-*-mingw32ce*) - BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' - if test -z "$DLLTOOL_DEFAULT"; then + ;; + arm-wince-pe* | arm-*-wince | arm*-*-cegcc* | arm*-*-mingw32ce*) + BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' + if test -z "$DLLTOOL_DEFAULT"; then DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM_WINCE" - fi - DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_WINCE -DDLLTOOL_ARM" - BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' - BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' - ;; - arm-*-pe*) - BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' - if test -z "$DLLTOOL_DEFAULT"; then + fi + DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_WINCE -DDLLTOOL_ARM" + BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' + BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' + ;; + arm-*-pe*) + BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' + if test -z "$DLLTOOL_DEFAULT"; then DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM" - fi - DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM" - BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' - BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' - ;; - x86_64-*-mingw* | x86_64-*-cygwin*) - BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' - if test -z "$DLLTOOL_DEFAULT"; then - DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MX86_64" - fi - DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MX86_64" - BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' - BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' - BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)' - ;; + fi + DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM" + BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' + BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' + ;; changequote(,)dnl - i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32**) + i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32** | all) changequote([,])dnl - BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' - if test -z "$DLLTOOL_DEFAULT"; then + BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' + if test -z "$DLLTOOL_DEFAULT"; then DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386" - fi - DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386" - BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' - BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' - BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)' - ;; + fi + DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386" + BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' + BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' + BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)' + ;; changequote(,)dnl - i[3-7]86-*-interix) + i[3-7]86-*-interix) changequote([,])dnl - BUILD_DLLTOOL='$(DLLTOOL_PROG)' - if test -z "$DLLTOOL_DEFAULT"; then + BUILD_DLLTOOL='$(DLLTOOL_PROG)' + if test -z "$DLLTOOL_DEFAULT"; then DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386" - fi - DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386" - ;; -changequote(,)dnl - powerpc*-aix5.[01]) -changequote([,])dnl - ;; -changequote(,)dnl - powerpc*-aix[5-9].*) -changequote([,])dnl - OBJDUMP_DEFS="-DAIX_WEAK_SUPPORT" - ;; - powerpc*-*-linux* | powerpc*-*-elf* | powerpc*-*-eabi*) - case "$BUILD_INSTALL_MISC" in - *embedspu*) ;; - *) BUILD_INSTALL_MISC="${BUILD_INSTALL_MISC} embedspu" - esac - ;; - sh*-*-pe) - BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' - if test -z "$DLLTOOL_DEFAULT"; then - DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_SH" - fi - DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH" - BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' - BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' - ;; - spu-*-*) - BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)' - ;; - mcore-*-pe) - BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' - if test -z "$DLLTOOL_DEFAULT"; then + fi + DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386" + ;; + mcore-*-pe) + BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' + if test -z "$DLLTOOL_DEFAULT"; then DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE" - fi - DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE" - BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' - BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' - ;; - mcore-*-elf) - BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' - if test -z "$DLLTOOL_DEFAULT"; then + fi + DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE" + BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' + BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' + ;; + mcore-*-elf) + BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' + if test -z "$DLLTOOL_DEFAULT"; then DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE_ELF" - fi - DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF" - ;; - mep-*) - OBJDUMP_DEFS="-DSKIP_ZEROES=256 -DSKIP_ZEROES_AT_END=0" - ;; - esac + fi + DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF" + ;; + sh*-*-pe) + BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' + if test -z "$DLLTOOL_DEFAULT"; then + DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_SH" + fi + DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH" + BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' + BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' + ;; + x86_64-*-mingw* | x86_64-*-cygwin*) + BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' + if test -z "$DLLTOOL_DEFAULT"; then + DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MX86_64" + fi + DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MX86_64" + BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' + BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)' + BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)' + ;; + esac - # Add objdump private vectors. - case $targ in - avr-*-*) - od_vectors="$od_vectors objdump_private_desc_elf32_avr" - ;; - powerpc*-*-aix* | rs6000-*-aix*) - od_vectors="$od_vectors objdump_private_desc_xcoff" - ;; - *-*-pe* | *-*-cygwin* | *-*-mingw*) - od_vectors="$od_vectors objdump_private_desc_pe" - ;; - *-*-darwin*) - od_vectors="$od_vectors objdump_private_desc_mach_o" - ;; - esac - fi + # Add objdump private vectors. + case $targ in + all) + od_vectors="objdump_private_desc_elf32_avr objdump_private_desc_xcoff\ + objdump_private_desc_pe objdump_private_desc_mach_o" + ;; + avr-*-*) + od_vectors="$od_vectors objdump_private_desc_elf32_avr" + ;; + powerpc*-*-aix* | rs6000-*-aix*) + od_vectors="$od_vectors objdump_private_desc_xcoff" + ;; + *-*-pe* | *-*-cygwin* | *-*-mingw*) + od_vectors="$od_vectors objdump_private_desc_pe" + ;; + *-*-darwin*) + od_vectors="$od_vectors objdump_private_desc_mach_o" + ;; + esac done # Uniq objdump private vector, build objdump target ofiles. diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi index 8314cb5..9f80f39 100644 --- a/binutils/doc/binutils.texi +++ b/binutils/doc/binutils.texi @@ -1626,6 +1626,11 @@ commands. If the input was '12345678' then the outputs would be Set the access and modification dates of the output file to be the same as those of the input file. +This option also copies the date stored in a PE format file's header, +unless the SOURCE_DATE_EPOCH environment variable is defined. If it +is defined then this variable will be used as the date stored in the +header, interpreted as the number of seconds since the Unix epoch. + @item -D @itemx --enable-deterministic-archives @cindex deterministic archives @@ -1745,13 +1750,14 @@ Set the flags for any sections matching @var{sectionpattern}. The @var{flags} argument is a comma separated string of flag names. The recognized names are @samp{alloc}, @samp{contents}, @samp{load}, @samp{noload}, @samp{readonly}, @samp{code}, @samp{data}, @samp{rom}, -@samp{exclude}, @samp{share}, and @samp{debug}. You can set the -@samp{contents} flag for a section which does not have contents, but it -is not meaningful to clear the @samp{contents} flag of a section which -does have contents--just remove the section instead. Not all flags are -meaningful for all object file formats. In particular the -@samp{share} flag is only meaningful for COFF format files and not for -ELF format files. +@samp{exclude}, @samp{share}, @samp{debug}, and @samp{large}. +You can set the @samp{contents} flag for a section which does not have +contents, but it is not meaningful to clear the @samp{contents} flag of a +section which does have contents--just remove the section instead. Not all +flags are meaningful for all object file formats. In particular the +@samp{share} flag is only meaningful for COFF format files and not for ELF +format files. The ELF x86-64 specific flag @samp{large} corresponds to +SHF_X86_64_LARGE. @item --set-section-alignment @var{sectionpattern}=@var{align} Set the alignment for any sections matching @var{sectionpattern}. diff --git a/binutils/objcopy.c b/binutils/objcopy.c index 3569b89..b2b7ab6 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -803,6 +803,7 @@ parse_flags (const char *s) PARSE_FLAG ("contents", SEC_HAS_CONTENTS); PARSE_FLAG ("merge", SEC_MERGE); PARSE_FLAG ("strings", SEC_STRINGS); + PARSE_FLAG ("large", SEC_ELF_LARGE); #undef PARSE_FLAG else { @@ -812,8 +813,10 @@ parse_flags (const char *s) strncpy (copy, s, len); copy[len] = '\0'; non_fatal (_("unrecognized section flag `%s'"), copy); - fatal (_("supported flags: %s"), - "alloc, load, noload, readonly, debug, code, data, rom, exclude, share, contents, merge, strings"); + fatal (_ ("supported flags: %s"), + "alloc, load, noload, readonly, debug, code, data, rom, " + "exclude, contents, merge, strings, (COFF specific) share, " + "(ELF x86-64 specific) large"); } s = snext; @@ -2618,7 +2621,7 @@ merge_gnu_build_notes (bfd * abfd, } static flagword -check_new_section_flags (flagword flags, bfd * abfd, const char * secname) +check_new_section_flags (flagword flags, bfd *abfd, const char * secname) { /* Only set the SEC_COFF_SHARED flag on COFF files. The same bit value is used by ELF targets to indicate @@ -2631,6 +2634,19 @@ check_new_section_flags (flagword flags, bfd * abfd, const char * secname) bfd_get_filename (abfd), secname); flags &= ~ SEC_COFF_SHARED; } + + /* Report a fatal error if 'large' is used with a non-x86-64 ELF target. + Suppress the error for non-ELF targets to allow -O binary and formats that + use the bit value SEC_ELF_LARGE for other purposes. */ + if ((flags & SEC_ELF_LARGE) != 0 + && bfd_get_flavour (abfd) == bfd_target_elf_flavour + && get_elf_backend_data (abfd)->elf_machine_code != EM_X86_64) + { + fatal (_ ("%s[%s]: 'large' flag is ELF x86-64 specific"), + bfd_get_filename (abfd), secname); + flags &= ~SEC_ELF_LARGE; + } + return flags; } @@ -3599,9 +3615,11 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target, } *list, *l; bfd **ptr = &obfd->archive_head; bfd *this_element; - char *dir; + char *dir = NULL; char *filename; + list = NULL; + /* PR 24281: It is not clear what should happen when copying a thin archive. One part is straight forward - if the output archive is in a different directory from the input archive then any relative paths in the library @@ -3620,7 +3638,7 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target, bfd_set_error (bfd_error_invalid_operation); bfd_nonfatal_message (NULL, ibfd, NULL, _("sorry: copying thin archives is not currently supported")); - return; + goto cleanup_and_exit; } /* Make a temp directory to hold the contents. */ @@ -3638,8 +3656,6 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target, if (deterministic) obfd->flags |= BFD_DETERMINISTIC_OUTPUT; - list = NULL; - this_element = bfd_openr_next_archived_file (ibfd, NULL); if (!bfd_set_format (obfd, bfd_get_format (ibfd))) @@ -3781,44 +3797,46 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target, } *ptr = NULL; + cleanup_and_exit: filename = xstrdup (bfd_get_filename (obfd)); if (!(status == 0 ? bfd_close : bfd_close_all_done) (obfd)) { + if (!status) + bfd_nonfatal_message (filename, NULL, NULL, NULL); status = 1; - bfd_nonfatal_message (filename, NULL, NULL, NULL); } free (filename); filename = xstrdup (bfd_get_filename (ibfd)); if (!bfd_close (ibfd)) { + if (!status) + bfd_nonfatal_message (filename, NULL, NULL, NULL); status = 1; - bfd_nonfatal_message (filename, NULL, NULL, NULL); } free (filename); - cleanup_and_exit: /* Delete all the files that we opened. */ - { - struct name_list * next; - - for (l = list; l != NULL; l = next) - { - if (l->obfd == NULL) - rmdir (l->name); - else - { - bfd_close (l->obfd); - unlink (l->name); - } - free ((char *) l->name); - next = l->next; - free (l); - } - } + struct name_list *next; + for (l = list; l != NULL; l = next) + { + if (l->obfd == NULL) + rmdir (l->name); + else + { + bfd_close (l->obfd); + unlink (l->name); + } + free ((char *) l->name); + next = l->next; + free (l); + } - rmdir (dir); - free (dir); + if (dir) + { + rmdir (dir); + free (dir); + } } /* The top-level control. */ @@ -3917,7 +3935,8 @@ copy_file (const char *input_filename, const char *output_filename, int ofd, if (obfd == NULL) { - close (ofd); + if (ofd >= 0) + close (ofd); bfd_nonfatal_message (output_filename, NULL, NULL, NULL); bfd_close (ibfd); status = 1; @@ -3950,7 +3969,8 @@ copy_file (const char *input_filename, const char *output_filename, int ofd, if (obfd == NULL) { - close (ofd); + if (ofd >= 0) + close (ofd); bfd_nonfatal_message (output_filename, NULL, NULL, NULL); bfd_close (ibfd); status = 1; @@ -4141,13 +4161,25 @@ setup_section (bfd *ibfd, sec_ptr isection, void *obfdarg) flags = p->flags | (flags & (SEC_HAS_CONTENTS | SEC_RELOC)); flags = check_new_section_flags (flags, obfd, bfd_section_name (isection)); } - else if (strip_symbols == STRIP_NONDEBUG - && (flags & (SEC_ALLOC | SEC_GROUP)) != 0 - && !is_nondebug_keep_contents_section (ibfd, isection)) + else { - flagword clr = SEC_HAS_CONTENTS | SEC_LOAD | SEC_GROUP; - - if (bfd_get_flavour (obfd) == bfd_target_elf_flavour) + flagword clr = 0; + + /* For --extract-symbols where section sizes are zeroed, clear + SEC_LOAD to indicate to coff_compute_section_file_positions that + section sizes should not be adjusted for ALIGN_SECTIONS_IN_FILE. + We don't want to clear SEC_HAS_CONTENTS as that will result + in symbols being classified as 'B' by nm. */ + if (extract_symbol) + clr = SEC_LOAD; + /* If only keeping debug sections then we'll be keeping section + sizes in headers but making the sections have no contents. */ + else if (strip_symbols == STRIP_NONDEBUG + && (flags & (SEC_ALLOC | SEC_GROUP)) != 0 + && !is_nondebug_keep_contents_section (ibfd, isection)) + clr = SEC_HAS_CONTENTS | SEC_LOAD | SEC_GROUP; + + if (clr && bfd_get_flavour (obfd) == bfd_target_elf_flavour) { /* PR 29532: Copy group sections intact as otherwise we end up with empty groups. This prevents separate debug info files from @@ -4155,7 +4187,7 @@ setup_section (bfd *ibfd, sec_ptr isection, void *obfdarg) originally contained groups. */ if (flags & SEC_GROUP) clr = SEC_LOAD; - else + if ((clr & SEC_HAS_CONTENTS) != 0) make_nobits = true; /* Twiddle the input section flags so that it seems to diff --git a/binutils/od-elf32_avr.c b/binutils/od-elf32_avr.c index cc24919..19da74a 100644 --- a/binutils/od-elf32_avr.c +++ b/binutils/od-elf32_avr.c @@ -270,25 +270,26 @@ elf32_avr_dump_mem_usage (bfd *abfd) "Device: %s\n\n", device.name); /* Text size */ - printf ("Program:%8lu bytes", text_usage); + printf ("Program:%8" PRIu64 " bytes", (uint64_t) text_usage); if (device.flash_size > 0) - printf (" (%2.1f%% Full)", ((float) text_usage / device.flash_size) * 100); + printf (" (%2.1f%% Full)", (double) text_usage / device.flash_size * 100); printf ("\n(.text + .data + .bootloader)\n\n"); /* Data size */ - printf ("Data: %8lu bytes", data_usage); + printf ("Data: %8" PRIu64 " bytes", (uint64_t) data_usage); if (device.ram_size > 0) - printf (" (%2.1f%% Full)", ((float) data_usage / device.ram_size) * 100); + printf (" (%2.1f%% Full)", (double) data_usage / device.ram_size * 100); printf ("\n(.data + .bss + .noinit)\n\n"); /* EEPROM size */ if (eeprom_usage > 0) { - printf ("EEPROM: %8lu bytes", eeprom_usage); + printf ("EEPROM: %8" PRIu64 " bytes", (uint64_t) eeprom_usage); if (device.eeprom_size > 0) - printf (" (%2.1f%% Full)", ((float) eeprom_usage / device.eeprom_size) * 100); + printf (" (%2.1f%% Full)", + (double) eeprom_usage / device.eeprom_size * 100); printf ("\n(.eeprom)\n\n"); } @@ -315,12 +316,12 @@ elf32_avr_dump_avr_prop (bfd *abfd) for (i = 0; i < r_list->record_count; ++i) { - printf (" %d %s @ %s + %#08lx (%#08lx)\n", + printf (" %d %s @ %s + %#08" PRIx64" (%#08" PRIx64 ")\n", i, avr_elf32_property_record_name (&r_list->records [i]), r_list->records [i].section->name, - r_list->records [i].offset, - (bfd_section_vma (r_list->records [i].section) + (uint64_t) r_list->records [i].offset, + ((uint64_t) bfd_section_vma (r_list->records [i].section) + r_list->records [i].offset)); switch (r_list->records [i].type) { diff --git a/binutils/od-macho.c b/binutils/od-macho.c index 17253d4..c2bd7d3 100644 --- a/binutils/od-macho.c +++ b/binutils/od-macho.c @@ -23,6 +23,7 @@ #include <stddef.h> #include <time.h> #include "safe-ctype.h" +#include "libiberty.h" #include "bfd.h" #include "objdump.h" #include "bucomm.h" diff --git a/binutils/od-xcoff.c b/binutils/od-xcoff.c index 92d17e9..e6b2f08 100644 --- a/binutils/od-xcoff.c +++ b/binutils/od-xcoff.c @@ -23,6 +23,7 @@ #include <stddef.h> #include <time.h> #include "safe-ctype.h" +#include "libiberty.h" #include "bfd.h" #include "objdump.h" #include "bucomm.h" diff --git a/binutils/po/binutils.pot b/binutils/po/binutils.pot index d1550ec..2c33344 100644 --- a/binutils/po/binutils.pot +++ b/binutils/po/binutils.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: https://sourceware.org/bugzilla/\n" -"POT-Creation-Date: 2023-07-03 11:32+0100\n" +"POT-Creation-Date: 2023-07-03 11:41+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/binutils/readelf.c b/binutils/readelf.c index 97d72d0..4ecff4c 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -168,6 +168,7 @@ #include "elf/xtensa.h" #include "elf/z80.h" #include "elf/loongarch.h" +#include "elf/bpf.h" #include "getopt.h" #include "libiberty.h" @@ -1061,6 +1062,8 @@ guess_is_rela (unsigned int e_machine) case EM_ARC: case EM_ARC_COMPACT: case EM_ARC_COMPACT2: + case EM_ARC_COMPACT3: + case EM_ARC_COMPACT3_64: case EM_AVR: case EM_AVR_OLD: case EM_BLACKFIN: @@ -1738,6 +1741,8 @@ dump_relocations (Filedata *filedata, case EM_ARC: case EM_ARC_COMPACT: case EM_ARC_COMPACT2: + case EM_ARC_COMPACT3: + case EM_ARC_COMPACT3_64: rtype = elf_arc_reloc_type (type); break; @@ -2968,9 +2973,9 @@ get_machine_name (unsigned e_machine) case EM_NFP: return "Netronome Flow Processor"; case EM_VE: return "NEC Vector Engine"; case EM_CSKY: return "C-SKY"; - case EM_ARC_COMPACT3_64: return "Synopsys ARCv2.3 64-bit"; + case EM_ARC_COMPACT3_64: return "Synopsys ARCv3 64-bit processor"; case EM_MCS6502: return "MOS Technology MCS 6502 processor"; - case EM_ARC_COMPACT3: return "Synopsys ARCv2.3 32-bit"; + case EM_ARC_COMPACT3: return "Synopsys ARCv3 32-bit processor"; case EM_KVX: return "Kalray VLIW core of the MPPA processor family"; case EM_65816: return "WDC 65816/65C816"; case EM_LOONGARCH: return "LoongArch"; @@ -3715,6 +3720,14 @@ get_machine_flags (Filedata * filedata, unsigned e_flags, unsigned e_machine) default: break; + case EM_ARC_COMPACT3: + strcat (buf, ", HS5x"); + break; + + case EM_ARC_COMPACT3_64: + strcat (buf, ", HS6x"); + break; + case EM_ARC_COMPACT2: case EM_ARC_COMPACT: decode_ARC_machine_flags (e_flags, e_machine, buf); @@ -4179,6 +4192,11 @@ get_machine_flags (Filedata * filedata, unsigned e_flags, unsigned e_machine) strcat (buf, ", no delay"); break; + case EM_BPF: + sprintf (buf + strlen (buf), ", CPU Version: %u", + e_flags & EF_BPF_CPUVER); + break; + case EM_SPARCV9: if (e_flags & EF_SPARC_32PLUS) strcat (buf, ", v8+"); @@ -4983,6 +5001,8 @@ get_section_type_name (Filedata * filedata, unsigned int sh_type) case EM_ARC: case EM_ARC_COMPACT: case EM_ARC_COMPACT2: + case EM_ARC_COMPACT3: + case EM_ARC_COMPACT3_64: result = get_arc_section_type_name (sh_type); break; case EM_MIPS: @@ -14324,6 +14344,8 @@ is_32bit_abs_reloc (Filedata * filedata, unsigned int reloc_type) return reloc_type == 1; /* R_ARC_32. */ case EM_ARC_COMPACT: case EM_ARC_COMPACT2: + case EM_ARC_COMPACT3: + case EM_ARC_COMPACT3_64: return reloc_type == 4; /* R_ARC_32. */ case EM_ARM: return reloc_type == 2; /* R_ARM_ABS32 */ @@ -14518,6 +14540,8 @@ is_32bit_pcrel_reloc (Filedata * filedata, unsigned int reloc_type) return reloc_type == 10; /* R_ALPHA_SREL32. */ case EM_ARC_COMPACT: case EM_ARC_COMPACT2: + case EM_ARC_COMPACT3: + case EM_ARC_COMPACT3_64: return reloc_type == 49; /* R_ARC_32_PCREL. */ case EM_ARM: return reloc_type == 3; /* R_ARM_REL32 */ @@ -14584,6 +14608,8 @@ is_64bit_abs_reloc (Filedata * filedata, unsigned int reloc_type) { case EM_AARCH64: return reloc_type == 257; /* R_AARCH64_ABS64. */ + case EM_ARC_COMPACT3_64: + return reloc_type == 5; /* R_ARC_64. */ case EM_ALPHA: return reloc_type == 2; /* R_ALPHA_REFQUAD. */ case EM_IA_64: @@ -14687,6 +14713,8 @@ is_16bit_abs_reloc (Filedata * filedata, unsigned int reloc_type) case EM_ARC: case EM_ARC_COMPACT: case EM_ARC_COMPACT2: + case EM_ARC_COMPACT3: + case EM_ARC_COMPACT3_64: return reloc_type == 2; /* R_ARC_16. */ case EM_ADAPTEVA_EPIPHANY: return reloc_type == 5; @@ -14969,6 +14997,8 @@ is_none_reloc (Filedata * filedata, unsigned int reloc_type) case EM_ARC: /* R_ARC_NONE. */ case EM_ARC_COMPACT2: /* R_ARC_NONE. */ case EM_ARC_COMPACT: /* R_ARC_NONE. */ + case EM_ARC_COMPACT3: /* R_ARC_NONE. */ + case EM_ARC_COMPACT3_64: /* R_ARC_NONE. */ case EM_ARM: /* R_ARM_NONE. */ case EM_CRIS: /* R_CRIS_NONE. */ case EM_FT32: /* R_FT32_NONE. */ @@ -22302,6 +22332,8 @@ process_arch_specific (Filedata * filedata) case EM_ARC: case EM_ARC_COMPACT: case EM_ARC_COMPACT2: + case EM_ARC_COMPACT3: + case EM_ARC_COMPACT3_64: return process_attributes (filedata, "ARC", SHT_ARC_ATTRIBUTES, display_arc_attribute, display_generic_attribute); diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp index 1145835..41070c3 100644 --- a/binutils/testsuite/binutils-all/objcopy.exp +++ b/binutils/testsuite/binutils-all/objcopy.exp @@ -1028,7 +1028,11 @@ proc keep_debug_symbols_for_elf_relocatable { prog flags test } { {[^a-zA-Z]+([a-zA-Z0-9_\.]+)[ \t]+([A-Z]+)[ \t]+[0-9a-f]+ [0-9a-f]+ [0-9a-f]+ [0-9]+[ \t]+([A-Z]*)[ \t]+[0-9]+(.*)} \ $got all name type flag rest] } { if { $type != "NOTE" && [regexp {[AG]} $flag] } { - lappend non_debug_sections $name + # PR 30699: Some debug sections can be in a group, so + # exclude sections whose name includes "debug_" + if { ! [regexp {debug_} $name] } { + lappend non_debug_sections $name + } } set got $rest } @@ -1086,6 +1090,7 @@ switch [copy_setup] { untested $test5 if [is_elf_format] { untested $test6 + untested $test7 } } "3" { |