>From fea2e6a09234d13402dd6e6dce9300bc6d08efe1 Mon Sep 17 00:00:00 2001 From: Fangrui Song
Date: Fri, 15 Nov 2019 20:42:40 -0800 Subject: [PATCH] configure: Use lld --image-base for --disable-pie user mode binaries To: address@hidden For lld, --image-base is the preferred way to set the base address. lld does not actually implement -Ttext-segment, but treats it as an alias for -Ttext. -Ttext-segment=0x60000000 combined with --no-rosegment can create a 1.6GB executable. Fix the problem by using --image-base for lld. GNU ld and gold will still get -Ttext-segment. Also delete the ld --verbose fallback introduced in 2013, which is no longer relevant or correct (the default linker script has changed). --- configure | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/configure b/configure index 6099be1d84..33e5344194 100755 --- a/configure +++ b/configure @@ -6336,43 +6336,34 @@ fi # Probe for the need for relocating the user-only binary. if ( [ "$linux_user" = yes ] || [ "$bsd_user" = yes ] ) && [ "$pie" = no ]; then - textseg_addr= + # An arbitrary address that makes it unlikely to collide with user + # programs. + image_base= case "$cpu" in arm | i386 | ppc* | s390* | sparc* | x86_64 | x32) - # ??? Rationale for choosing this address - textseg_addr=0x60000000 + image_base=0x60000000 ;; mips) # A 256M aligned address, high in the address space, with enough # room for the code_gen_buffer above it before the stack. - textseg_addr=0x60000000 + image_base=0x60000000 ;; esac - if [ -n "$textseg_addr" ]; then + if [ -n "$image_base" ]; then cat > $TMPC <