From 35f0ffa60c3ca18b865718fd83f7b4c5e90f205e Mon Sep 17 00:00:00 2001 From: Raphael Manfredi Date: Tue, 17 Mar 2020 10:10:38 +0100 Subject: Reworked BFD section tests. It's not only bfd_get_section_vma() which is impacted! The change in the BFD library, starting with 2.34, is rather that: - bfd_section_xxx() accessors now take only the BFD section as argument. - bfd_get_section_xxx() accessors, which used 2 arguments, are removed. The first argument in bfd_get_section_xxx() calls was the BFD descriptor and it was purely ignored in recent versions of the library. --- MANIFEST | 2 +- mcon/U/d_bfd_section.U | 49 ++++++++++++++++++++++++++++ mcon/U/d_bfd_section_vma.U | 80 ---------------------------------------------- 3 files changed, 50 insertions(+), 81 deletions(-) create mode 100644 mcon/U/d_bfd_section.U delete mode 100644 mcon/U/d_bfd_section_vma.U diff --git a/MANIFEST b/MANIFEST index 35aaa0b..343abc8 100644 --- a/MANIFEST +++ b/MANIFEST @@ -172,7 +172,7 @@ mcon/U/d_backtrace.U Do we have backtrace()? mcon/U/d_bcmp.U Do we have bcmp() or memcmp()? mcon/U/d_bcopy.U Do we have bcopy() or memcpy()? mcon/U/d_bfd_lib.U Is the BFD library available? -mcon/U/d_bfd_section_vma.U Does bfd_get_section_vma() take 1 or 2 arguments? +mcon/U/d_bfd_section.U Do bfd_section_xxx() accessors exist with 1 argument? mcon/U/d_bindtxtcode.U Do we have bind_textdomain_codeset()? mcon/U/d_brokstat.U Check whether stat() macros are broken mcon/U/d_bsdjmp.U Do we have BSD _setjmp() and _longjmp()? diff --git a/mcon/U/d_bfd_section.U b/mcon/U/d_bfd_section.U new file mode 100644 index 0000000..d876541 --- /dev/null +++ b/mcon/U/d_bfd_section.U @@ -0,0 +1,49 @@ +?RCS: $Id$ +?RCS: +?RCS: Copyright (c) 2020, Raphael Manfredi +?RCS: +?RCS: You may redistribute only under the terms of the Artistic License, +?RCS: as specified in the README file that comes with the distribution. +?RCS: You may reuse parts of this distribution only within the terms of +?RCS: that same Artistic License; a copy of which may be found at the root +?RCS: of the source tree for dist 4.0. +?RCS: +?MAKE:d_bfd_section: Trylink cat d_bfd_lib +?MAKE: -pick add $@ %< +?S:d_bfd_section: +?S: This variable conditionally defines the HAS_BFD_SECTION_1ARG symbol, +?S: which indicates to the C program that the bfd_section_xxx() accessors +?S: from the BFD library exists and taks only one argument. +?S:. +?C:HAS_BFD_SECTION_1ARG: +?C: This symbol, if defined, indicates that the bfd_section_xxx() accessors +?C: from the BFD library takes only one argument, which is the new behaviour +?C: starting from BFD 2.34. +?C:. +?H:#$d_bfd_section HAS_BFD_SECTION_1ARG /**/ +?H:. +: see whether bfd_section_vma exists and takes 1 argument +case "$d_bfd_lib" in +$undef) + d_bfd_section=$undef + ;; +*) + $cat >try.c < +int main(void) +{ + bfd *b = 0; + asection *sec = 0; + + return 0 == bfd_section_vma(sec); +} +EOC + cyn="whether bfd_section_vma() takes 1 argument" + set d_bfd_section + eval $trylink + ;; +esac + diff --git a/mcon/U/d_bfd_section_vma.U b/mcon/U/d_bfd_section_vma.U deleted file mode 100644 index 0b41f44..0000000 --- a/mcon/U/d_bfd_section_vma.U +++ /dev/null @@ -1,80 +0,0 @@ -?RCS: $Id$ -?RCS: -?RCS: Copyright (c) 2020, Raphael Manfredi -?RCS: -?RCS: You may redistribute only under the terms of the Artistic License, -?RCS: as specified in the README file that comes with the distribution. -?RCS: You may reuse parts of this distribution only within the terms of -?RCS: that same Artistic License; a copy of which may be found at the root -?RCS: of the source tree for dist 4.0. -?RCS: -?MAKE:d_bfd_section_vma d_bfd_section_vma2: Trylink cat cp rm d_bfd_lib -?MAKE: -pick add $@ %< -?S:d_bfd_section_vma: -?S: This variable conditionally defines the HAS_BFD_SECTION_VMA_1ARG symbol, -?S: which indicates to the C program that the bfd_get_section_vma() routine from -?S: the BFD library takes only one argument. -?S:. -?S:d_bfd_section_vma2: -?S: This variable conditionally defines the HAS_BFD_SECTION_VMA_2ARGS symbol, -?S: which indicates to the C program that the bfd_get_section_vma() routine from -?S: the BFD library takes two arguments, the first being probably ignored. -?S: This was the old behaviour (before 2020-03 at least), the new behaviour -?S: being to use a new 1-argument signature. -?S:. -?C:HAS_BFD_SECTION_VMA_1ARG: -?C: This symbol, if defined, indicates that the bfd_get_section_vma() routine -?C: from the BFD library takes only one argument, which is the new behaviour -?C: starting from 2020-03 at least. -?C:. -?C:HAS_BFD_SECTION_VMA_2ARGS: -?C: This symbol, if defined, indicates that the bfd_get_section_vma() routine -?C: from the BFD library takes two arguments, which is the old behaviour, -?C: with the first argument probably ignored underneath. -?C:. -?H:#$d_bfd_section_vma HAS_BFD_SECTION_VMA_1ARG /**/ -?H:#$d_bfd_section_vma2 HAS_BFD_SECTION_VMA_2ARGS /**/ -?H:. -?F:!head.c -: see whether d_bfd_get_section_vma exists and takes 1 or 2 arguments -$cat >head.c < -int main(void) -{ - bfd *b = 0; - asection *sec = 0; -EOC -case "$d_bfd_lib" in -$undef) - d_bfd_section_vma=$undef - d_bfd_section_vma2=$undef - ;; -*) - $cp head.c try.c - $cat >>try.c <>try.c <