This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GENERATE_SHLIB_SCRIPT vs. EMBEDDED


On Tue, 5 Nov 2019 at 05:01, Alan Modra <amodra@gmail.com> wrote:
>
> On Tue, Oct 29, 2019 at 10:23:41AM +1030, Alan Modra wrote:
> > The error is
> > ./ld-new: tmpdir/pr22471: error: PHDR segment not covered by LOAD segment
> > which was the case before this patch but ld didn't diagnose the error.
> > So not exactly a regression.
> >
> > In more detail, we have a bunch of targets that have this nastiness in
> > their setup: eg. from ld/emulparams/elf32bfin.sh
> > GENERATE_SHLIB_SCRIPT=yes
> > EMBEDDED=yes
>
> A target that sets EMBEDDED non-empty is one that doesn't want to put
> the ELF file header or program header in a memory image.  Likely the
> target isn't interested in supporting dynamically loaded executables,
> shared libraries, or PIEs, because loaders for such binaries generally
> require program headers to be present.  This isn't 100% true though.
> The target might be one where the loader accesses the file system in
> order to retrieve headers.
>
> Also, note that not all "shared libraries" require gcc -shared or the
> shared library support in the linker.  I believe one implementation of
> shared libraries on uclinux is like this.
>
> So, this patch removes GENERATE_SHLIB_SCRIPT and GENERATE_PIE_SCRIPT
> in most emulparams files where EMBEDDED is set, restoring the shared
> lib and pie support in emulparams files that unset EMBEDDED after
> including a file where the support is removed.
>
> Exceptions to the general rule that EMBEDDED disables shared libs are:
>   arm*-*-symbianelf*, where the OS wants shared library support
>   without ELF program headers in the image, and
>
>   sh*-*-uclinux*, where I've left things as they were, ie. both
>   EMBEDDED and GENERATE_SHLIB_SCRIPT because I'm unsure as to the
>   shared library scheme.
>
> After this patch the targets I regularly test see these testsuite
> changes:
> bfin-elf  -FAIL: Build pr22471
> bfin-elf  -FAIL: DT_TEXTREL in shared lib
> bfin-elf  -FAIL: DT_TEXTREL map file warning
> bfin-elf  -FAIL: PR ld/21233 dynamic symbols with section GC (--undefined)
> bfin-elf  -FAIL: PR ld/21233 dynamic symbols with section GC (--require-defined)
> bfin-elf  -FAIL: PR ld/21233 dynamic symbols with section GC (EXTERN)
> bfin-elf  -FAIL: Build pr22150
> bfin-elf  -FAIL: Build pr20995-2.so
> bfin-elf  -FAIL: undefined symbols in shared lib (dyn reloc)
> score-elf  -FAIL: Build pr22471
> score-elf  -FAIL: DT_TEXTREL map file warning
> score-elf  -FAIL: Build pr22150
> score-elf  -FAIL: -Bsymbolic-functions
> score-elf  -FAIL: Build pr20995-2.so
> score-elf  -FAIL: pr20995
> score-elf  -FAIL: pr20995-2
> sh-rtems  -FAIL: Build pr22471
> sh-rtems  -FAIL: Build pr20995-2.so
> sh-rtems  -FAIL: pr20995
> sh-rtems  -FAIL: pr20995-2
>

Hi Alan,

On my side, after your committed this patch, I've noticed many regressions on
aarch64*-elf and arm-none-eabi:
https://ci.linaro.org/job/tcwg-compare-results/9217/artifact/artifacts/logs/0-report.html

Aren't these targets part of the set you regularly test? Or don't they
regress for you?

Thanks,

Christophe

>         * emulparams/aarch64elf.sh (GENERATE_SHLIB_SCRIPT),
>         (GENERATE_PIE_SCRIPT): Don't set.
>         * emulparams/aarch64elf32.sh (GENERATE_SHLIB_SCRIPT),
>         (GENERATE_PIE_SCRIPT): Don't set.
>         * emulparams/arcelf.sh (GENERATE_SHLIB_SCRIPT): Don't set.
>         * emulparams/armelf.sh (GENERATE_SHLIB_SCRIPT),
>         (GENERATE_PIE_SCRIPT): Don't set.
>         * emulparams/armelf_fbsd.sh (GENERATE_SHLIB_SCRIPT): Set.
>         * emulparams/armelf_nbsd.sh (GENERATE_SHLIB_SCRIPT),
>         (GENERATE_PIE_SCRIPT): Set.
>         * emulparams/armelf_vxworks.sh (GENERATE_SHLIB_SCRIPT): Set.
>         * emulparams/armsymbian.sh (GENERATE_SHLIB_SCRIPT): Set.
>         * emulparams/elf32bfin.sh (GENERATE_SHLIB_SCRIPT): Don't set.
>         * emulparams/elf32microblaze.sh (GENERATE_SHLIB_SCRIPT): Don't set.
>         * emulparams/score3_elf.sh (GENERATE_SHLIB_SCRIPT): Don't set.
>         * emulparams/shelf.sh (GENERATE_SHLIB_SCRIPT): Don't set.
>         * emulparams/shelf_nbsd.sh (GENERATE_SHLIB_SCRIPT),
>         (GENERATE_PIE_SCRIPT): Set.
>         * emulparams/shelf_uclinux.sh (GENERATE_SHLIB_SCRIPT): Set.
>
> diff --git a/ld/emulparams/aarch64elf.sh b/ld/emulparams/aarch64elf.sh
> index 8f68e517b4..5c70b55686 100644
> --- a/ld/emulparams/aarch64elf.sh
> +++ b/ld/emulparams/aarch64elf.sh
> @@ -12,9 +12,6 @@ NO_REL_RELOCS=yes
>  TEMPLATE_NAME=elf
>  EXTRA_EM_FILE=aarch64elf
>
> -GENERATE_SHLIB_SCRIPT=yes
> -GENERATE_PIE_SCRIPT=yes
> -
>  MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
>
>  ENTRY=_start
> diff --git a/ld/emulparams/aarch64elf32.sh b/ld/emulparams/aarch64elf32.sh
> index 5a08d9e29f..a94025a139 100644
> --- a/ld/emulparams/aarch64elf32.sh
> +++ b/ld/emulparams/aarch64elf32.sh
> @@ -12,9 +12,6 @@ NO_REL_RELOCS=yes
>  TEMPLATE_NAME=elf
>  EXTRA_EM_FILE=aarch64elf
>
> -GENERATE_SHLIB_SCRIPT=yes
> -GENERATE_PIE_SCRIPT=yes
> -
>  MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
>
>  ENTRY=_start
> diff --git a/ld/emulparams/arcelf.sh b/ld/emulparams/arcelf.sh
> index 625ec39779..b6d8f9fdf7 100644
> --- a/ld/emulparams/arcelf.sh
> +++ b/ld/emulparams/arcelf.sh
> @@ -19,5 +19,3 @@ SDATA_START_SYMBOLS='__SDATA_BEGIN__ = . + 0x100;'
>  JLI_START_TABLE='__JLI_TABLE__ = .;'
>  OTHER_SECTIONS="/DISCARD/ : { *(.__arc_profile_*) }"
>  EMBEDDED=yes
> -
> -GENERATE_SHLIB_SCRIPT=yes
> diff --git a/ld/emulparams/armelf.sh b/ld/emulparams/armelf.sh
> index 0e3147c1f2..8977fd6fea 100644
> --- a/ld/emulparams/armelf.sh
> +++ b/ld/emulparams/armelf.sh
> @@ -32,9 +32,6 @@ OTHER_READONLY_SECTIONS="
>
>  DATA_START_SYMBOLS="${CREATE_SHLIB+PROVIDE (}__data_start = .${CREATE_SHLIB+)};"
>
> -GENERATE_SHLIB_SCRIPT=yes
> -GENERATE_PIE_SCRIPT=yes
> -
>  ARCH=arm
>  MACHINE=
>  MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
> diff --git a/ld/emulparams/armelf_fbsd.sh b/ld/emulparams/armelf_fbsd.sh
> index be88c2f2e0..4428b91a34 100644
> --- a/ld/emulparams/armelf_fbsd.sh
> +++ b/ld/emulparams/armelf_fbsd.sh
> @@ -5,7 +5,7 @@ TEXT_START_ADDR=0x00010000
>
>  TARGET2_TYPE=got-rel
>  MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
> +GENERATE_SHLIB_SCRIPT=yes
>  GENERATE_PIE_SCRIPT=yes
> -
>  unset STACK_ADDR
>  unset EMBEDDED
> diff --git a/ld/emulparams/armelf_nbsd.sh b/ld/emulparams/armelf_nbsd.sh
> index 37e1a4afdd..45954597ee 100644
> --- a/ld/emulparams/armelf_nbsd.sh
> +++ b/ld/emulparams/armelf_nbsd.sh
> @@ -3,5 +3,7 @@ MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
>  TEXT_START_ADDR=0x00008000
>  TARGET2_TYPE=got-rel
>
> +GENERATE_SHLIB_SCRIPT=yes
> +GENERATE_PIE_SCRIPT=yes
>  unset STACK_ADDR
>  unset EMBEDDED
> diff --git a/ld/emulparams/armelf_vxworks.sh b/ld/emulparams/armelf_vxworks.sh
> index 5f57535fee..e344209905 100644
> --- a/ld/emulparams/armelf_vxworks.sh
> +++ b/ld/emulparams/armelf_vxworks.sh
> @@ -4,3 +4,4 @@ BIG_OUTPUT_FORMAT="elf32-bigarm-vxworks"
>  LITTLE_OUTPUT_FORMAT="$OUTPUT_FORMAT"
>  MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
>  source_sh ${srcdir}/emulparams/vxworks.sh
> +GENERATE_SHLIB_SCRIPT=yes
> diff --git a/ld/emulparams/armsymbian.sh b/ld/emulparams/armsymbian.sh
> index 1959685f9b..183750a564 100644
> --- a/ld/emulparams/armsymbian.sh
> +++ b/ld/emulparams/armsymbian.sh
> @@ -8,6 +8,8 @@ TARGET1_IS_REL=1
>  TARGET2_TYPE=abs
>  # On BPABI systems, program headers should not be mapped.
>  EMBEDDED=yes
> +# Nonetheless, shared libraries are also supported
> +GENERATE_SHLIB_SCRIPT=yes
>
>  # As for armelf.sh, but add the SymbianOS-specific
>  # .ARM.exidx$${Base,Limit} symbols.
> diff --git a/ld/emulparams/elf32bfin.sh b/ld/emulparams/elf32bfin.sh
> index 8d298b467c..6e08035b6f 100644
> --- a/ld/emulparams/elf32bfin.sh
> +++ b/ld/emulparams/elf32bfin.sh
> @@ -6,7 +6,6 @@ TARGET_PAGE_SIZE=0x1000
>  ARCH=bfin
>  MACHINE=
>  TEMPLATE_NAME=elf
> -GENERATE_SHLIB_SCRIPT=yes
>  EMBEDDED=yes
>  USER_LABEL_PREFIX=_
>  EXTRA_EM_FILE=bfin
> diff --git a/ld/emulparams/elf32microblaze.sh b/ld/emulparams/elf32microblaze.sh
> index f867018eb3..698adb7cf8 100644
> --- a/ld/emulparams/elf32microblaze.sh
> +++ b/ld/emulparams/elf32microblaze.sh
> @@ -21,6 +21,3 @@ NOP=0x80000000
>  #OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);'
>
>  TEMPLATE_NAME=elf
> -#GENERATE_SHLIB_SCRIPT=yes
> -
> -
> diff --git a/ld/emulparams/score3_elf.sh b/ld/emulparams/score3_elf.sh
> index 7be7883363..78401876e5 100644
> --- a/ld/emulparams/score3_elf.sh
> +++ b/ld/emulparams/score3_elf.sh
> @@ -26,4 +26,3 @@ ARCH=score3
>  MACHINE=
>  ENTRY=_start
>  EMBEDDED=yes
> -GENERATE_SHLIB_SCRIPT=yes
> diff --git a/ld/emulparams/shelf.sh b/ld/emulparams/shelf.sh
> index 63c2ff19dc..96c18c0750 100644
> --- a/ld/emulparams/shelf.sh
> +++ b/ld/emulparams/shelf.sh
> @@ -9,7 +9,6 @@ MAXPAGESIZE=128
>  ARCH=sh
>  MACHINE=
>  TEMPLATE_NAME=elf
> -GENERATE_SHLIB_SCRIPT=yes
>  EMBEDDED=yes
>  # These are for compatibility with the COFF toolchain.
>  ENTRY=start
> diff --git a/ld/emulparams/shelf_nbsd.sh b/ld/emulparams/shelf_nbsd.sh
> index 391399660d..57db803d00 100644
> --- a/ld/emulparams/shelf_nbsd.sh
> +++ b/ld/emulparams/shelf_nbsd.sh
> @@ -11,5 +11,7 @@ DATA_START_SYMBOLS='PROVIDE (__data_start = .);';
>
>  ENTRY=_start
>
> +GENERATE_SHLIB_SCRIPT=yes
> +GENERATE_PIE_SCRIPT=yes
>  unset EMBEDDED
>  unset STACK_ADDR
> diff --git a/ld/emulparams/shelf_uclinux.sh b/ld/emulparams/shelf_uclinux.sh
> index a22c35a9a8..41044f028c 100644
> --- a/ld/emulparams/shelf_uclinux.sh
> +++ b/ld/emulparams/shelf_uclinux.sh
> @@ -2,3 +2,4 @@ source_sh ${srcdir}/emulparams/shelf.sh
>
>  # We do not want a .stack section
>  unset STACK_ADDR
> +GENERATE_SHLIB_SCRIPT=yes
>
> --
> Alan Modra
> Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]