From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,NO_DNS_FOR_FROM, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from [192.168.12.80] (unknown [182.2.69.158]) by gnuweeb.org (Postfix) with ESMTPSA id 22E547E2DF; Tue, 22 Mar 2022 13:56:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1647957411; bh=PjMcysHt2dknFDp2J9SgqL6N1EYY0N4Y0Qnc7+5AWNU=; h=Date:Subject:From:To:Cc:References:In-Reply-To:From; b=rXc5Yqn0rJPnMDmwFzT311hNYadKNDbfYhAXlKq1HdV4nFdHuj4d07ws2l6NaEKPu yjxuOTNcFslyG1L5AgvuqxyEMfDa8YGIZ3vSXSCoMdCcU629fqWOmQNHoq9gSf+KFS nb0YUhj7LC2xiNE0+zGXuTwBWAwd+ygrOQiEyKQnjZnCO63MwIFQHH9R4WvUkxrhSX qcZ+zi5Lu8FhxEfc0iyIFb87KMgI0M3sk1OIj82XNInUR2CaUCO3hKVoqqtjrr+ROI bnCvuabDEuA7dLmYawUJ/SOjEi1Jnd2uSr+6w5+7kfL0orpqEPglbfbckgQvusnH7c JnkAxD+Yv2+bw== Message-ID: <8f11bc01-4b63-eaf7-6da3-77556cfb0118@gnuweeb.org> Date: Tue, 22 Mar 2022 20:56:44 +0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [RFC PATCH v2 3/8] tools/nolibc: i386: Implement syscall with 6 arguments Content-Language: en-US From: Ammar Faizi To: Willy Tarreau , David Laight Cc: "Paul E. McKenney" , Alviro Iskandar Setiawan , Nugraha , Linux Kernel Mailing List , GNU/Weeb Mailing List , "x86@kernel.org" , "llvm@lists.linux.dev" References: <20220322102115.186179-1-ammarfaizi2@gnuweeb.org> <20220322102115.186179-4-ammarfaizi2@gnuweeb.org> <8653f6784a9b4272a59a75a530663567@AcuMS.aculab.com> <20220322121338.GD10306@1wt.eu> <81569a1c-a6d3-ceb2-a1f1-f229a024d684@gnuweeb.org> <20220322133413.GG10306@1wt.eu> <58cb5455-d065-b508-b328-20b57c3a67a7@gnuweeb.org> <3b8984ecfbcd4c93aeb468d01728cd74@AcuMS.aculab.com> <20220322134100.GH10306@1wt.eu> <9cfcb296-9dfe-aef1-4209-20a3a95c50ba@gnuweeb.org> <98304cd4-a443-5e5e-9764-654ecd1d458b@gnuweeb.org> In-Reply-To: <98304cd4-a443-5e5e-9764-654ecd1d458b@gnuweeb.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: On 3/22/22 8:54 PM, Ammar Faizi wrote: > > Willy, something goes wrong here... > > ammarfaizi2@integral2:~/work/linux.work/tools/include/nolibc$ taskset -c 0 gcc -ffreestanding -nostdlib -nostartfiles test.c -o test -lgcc > /usr/bin/ld: /tmp/ccHiYiks.o: warning: relocation against `environ' in read-only section `.text' > /usr/bin/ld: /tmp/ccHiYiks.o: in function `getenv': > test.c:(.text+0x1f76): undefined reference to `environ' > /usr/bin/ld: test.c:(.text+0x1fc3): undefined reference to `environ' > /usr/bin/ld: test.c:(.text+0x1ffc): undefined reference to `environ' > /usr/bin/ld: test.c:(.text+0x2021): undefined reference to `environ' > /usr/bin/ld: test.c:(.text+0x2049): undefined reference to `environ' > /usr/bin/ld: warning: creating DT_TEXTREL in a PIE > collect2: error: ld returned 1 exit status > ammarfaizi2@integral2:~/work/linux.work/tools/include/nolibc$ > > > I suspect it's caused by commit: > > commit c970abe796019b3d576fd154a54b94efb35c02b1 > Author: Willy Tarreau > Date:   Mon Mar 21 18:33:08 2022 +0100 > >     tools/nolibc/stdlib: add a simple getenv() implementation >     This implementation relies on an extern definition of the environ >     variable, that the caller must declare and initialize from envp. >     Signed-off-by: Willy Tarreau >     Signed-off-by: Paul E. McKenney > > I will take a look deeper on this... This bug only exists when compiling without optimization. -- Ammar Faizi