From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x334.google.com (mail-ot1-x334.google.com [IPv6:2607:f8b0:4864:20::334]) by sourceware.org (Postfix) with ESMTPS id 23C94385841B for ; Mon, 7 Feb 2022 17:08:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 23C94385841B Received: by mail-ot1-x334.google.com with SMTP id l43-20020a9d1cab000000b005aa50ff5869so5507785ota.0 for ; Mon, 07 Feb 2022 09:08:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=MJpiHvt8ahom4MzA3Wx7NTe5h8ZYBcV85+FoFSSw0XM=; b=akP6QtmMoTZqZGvrUQUUlsHEvxWz0N3B3vbGu+McqYUWdweHx0olicoTSf92Do/XuG LuhU5c/WsuF4IwVFYyLBqqvczU+SJrsbT7ku2wRv0k+i3ZpKcm1umrrQahNWf1WoV8AS KMExBfRJu+fljAads1tro95L5LoP215skHDCul6km1gUKx2MG4439YAKsWtn56XhO0MH Otkg+sIlZA66zQ0GKd7HgBU3NLe7KLH+sVtKNxasFaLqdWze/A3k9WGLPGtBtDMEkTcz N2vYw2FFvemQmrSCwC3DpIJvbtI28Dic4hqsyIEpqaStsSKU8kxeVL/qXkoE/IrpS7my LCRg== X-Gm-Message-State: AOAM530ZZaHSLkV/3hYuc/QbwSw+bTJYG2TSXuTcpS/2//yo71SksrI0 xjni8v2m1MKjUoY7JNNAjfAkew== X-Google-Smtp-Source: ABdhPJxnN/W4ufTXCcSNwrVnxygdODgxgjItTIDmD5UZXV7XvRCLrMuC84QLYmv1jbdmM6bMeICwtw== X-Received: by 2002:a05:6830:43ab:: with SMTP id s43mr312473otv.118.1644253711348; Mon, 07 Feb 2022 09:08:31 -0800 (PST) Received: from ?IPV6:2804:431:c7ca:733:4cdc:e08a:54c6:5108? ([2804:431:c7ca:733:4cdc:e08a:54c6:5108]) by smtp.gmail.com with ESMTPSA id l38sm4301709otl.45.2022.02.07.09.08.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 07 Feb 2022 09:08:31 -0800 (PST) Message-ID: <94cd37dd-d6a3-0811-829d-a9d41d2cad41@linaro.org> Date: Mon, 7 Feb 2022 14:08:28 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Subject: Re: cross-toolchain for x86 fails to compile Content-Language: en-US To: Waldemar Brodkorb , "H.J. Lu" , Siddhesh Poyarekar Cc: libc-help@sourceware.org References: <2c31877a-ae19-8e6a-e99f-e2f687df89fd@linaro.org> From: Adhemerval Zanella In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-help@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-help mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Feb 2022 17:08:34 -0000 On 07/02/2022 12:16, Waldemar Brodkorb wrote: > Hi, > Adhemerval Zanella wrote, > >> >> >> On 04/02/2022 21:35, Waldemar Brodkorb wrote: >>> Hi, >>> >>> I am doing my regular update in OpenADK and updated to glibc 2.35. >>> All toolchains are build fine except x86. >>> >>> I am getting following error with binutils 2.37 and gcc 11.2: >>> /home/wbx/embedded-test/openadk/toolchain_qemu-x86_glibc/usr/bin/i686-openadk-linux-gnu-gcc >>> -o >>> /home/wbx/embedded-test/openadk/toolchain_build_qemu-x86_glibc/w-glibc-2.35-1/glibc-2.35-final/support/test-run-command >>> -nostdlib -nostartfiles -static -static-pie >>> /home/wbx/embedded-test/openadk/toolchain_build_qemu-x86_glibc/w-glibc-2.35-1/glibc-2.35-final/csu/rcrt1.o >>> /home/wbx/embedded-test/openadk/toolchain_build_qemu-x86_glibc/w-glibc-2.35-1/glibc-2.35-final/csu/crti.o >>> `/home/wbx/embedded-test/openadk/toolchain_qemu-x86_glibc/usr/bin/i686-openadk-linux-gnu-gcc >>> --print-file-name=crtbeginS.o` >>> /home/wbx/embedded-test/openadk/toolchain_build_qemu-x86_glibc/w-glibc-2.35-1/glibc-2.35-final/support/test-run-command.o >>> /home/wbx/embedded-test/openadk/toolchain_build_qemu-x86_glibc/w-glibc-2.35-1/glibc-2.35-final/elf/static-stubs.o >>> /home/wbx/embedded-test/openadk/toolchain_build_qemu-x86_glibc/w-glibc-2.35-1/glibc-2.35-final/support/libsupport_nonshared.a >>> -Wl,--start-group >>> /home/wbx/embedded-test/openadk/toolchain_build_qemu-x86_glibc/w-glibc-2.35-1/glibc-2.35-final/libc.a >>> -lgcc -Wl,--end-group >>> `/home/wbx/embedded-test/openadk/toolchain_qemu-x86_glibc/usr/bin/i686-openadk-linux-gnu-gcc >>> --print-file-name=crtendS.o` >>> /home/wbx/embedded-test/openadk/toolchain_build_qemu-x86_glibc/w-glibc-2.35-1/glibc-2.35-final/csu/crtn.o >>> /home/wbx/embedded-test/openadk/toolchain_qemu-x86_glibc/usr/lib/gcc/i686-openadk-linux-gnu/11.2.0/../../../../i686-openadk-linux-gnu/bin/ld: >>> /home/wbx/embedded-test/openadk/toolchain_build_qemu-x86_glibc/w-glibc-2.35-1/glibc-2.35-final/libc.a(setlocale.o): >>> relocation R_386_GOT32 against absolute symbol >>> `_nl_current_LC_CTYPE_used' in section `__libc_freeres_fn' is >>> disallowed >>> collect2: error: ld returned 1 exit status >>> gmake[8]: *** [../Rules:293: >>> /home/wbx/embedded-test/openadk/toolchain_build_qemu-x86_glibc/w-glibc-2.35-1/glibc-2.35-final/support/test-run-command] >>> Error 1 >>> gmake[7]: *** [Makefile:483: support/others] Error 2 >>> gmake[6]: *** [Makefile:9: all] Error 2 >>> gmake[5]: *** [Makefile:62: >>> /home/wbx/embedded-test/openadk/toolchain_build_qemu-x86_glibc/w-glibc-2.35-1/glibc-2.35/.compiled] >>> Error 2 >>> gmake[4]: *** [Makefile:106: glibc-compile] Error 2 >>> gmake[3]: *** [mk/build.mk:228: toolchain/final] Error 2 >>> gmake[2]: *** [/home/wbx/embedded-test/openadk/mk/build.mk:177: >>> world] Error 2 >>> gmake[1]: *** [Makefile.adk:25: all] Error 2 >>> make: *** [Makefile:22: all] Error 2 >>> build failed >>> >>> Is it a known bug in binutils or glibc? >> >> None we are aware of and we do build check on i686 constantly. I just did a build >> with gcc 11.2 and binutins 2.37 and I haven't see any issue. How did you build >> gcc and binutils? > > Thanks for your response. It seems TARGET CFLAGS are not allowed to > be -Os or any machine specific optimizations for x86. Forcing -O2 > did work. I should work in fact, we have tracked multiple issues when building with -Os over the releases [1][2][3][4][5][6][7][8]. The problem seems to the that now static-pie is enabled as default and it seems to be triggering this issue (with --disable-static-pie it does seem to work). The localedef.o is built with -fpie, as expected, so I am not sure if the issue is compiler that is emitting wrong relocations for -Os or binutils that is not expecting it. With -O2 gcc emits R_386_GOT32X which seems to be fine. H.J or Siddhesh, could you check on this? [1] https://sourceware.org/bugzilla/show_bug.cgi?id=15105 [2] https://sourceware.org/bugzilla/show_bug.cgi?id=19463 [3] https://sourceware.org/bugzilla/show_bug.cgi?id=25240 [4] https://sourceware.org/bugzilla/show_bug.cgi?id=22581 [5] https://sourceware.org/bugzilla/show_bug.cgi?id=20729 [6] https://sourceware.org/bugzilla/show_bug.cgi?id=19462 [7] https://sourceware.org/bugzilla/show_bug.cgi?id=19465 [8] https://sourceware.org/bugzilla/show_bug.cgi?id=19466