From patchwork Tue Apr 12 11:41:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 11705 Received: (qmail 41765 invoked by alias); 12 Apr 2016 11:41:40 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 41745 invoked by uid 89); 12 Apr 2016 11:41:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=UD:o-iterator.mk, oiteratormk, o-iterator.mk, Hx-languages-length:1652 X-HELO: mx1.redhat.com To: GNU C Library From: Florian Weimer Subject: Building tests from multiple object files Message-ID: <570CDEE6.3030808@redhat.com> Date: Tue, 12 Apr 2016 13:41:26 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 I'm still working on upstreaming our libresolv and NSS tests. During that, I noticed the following. The glibc makefiles do not provide a simple way to assemble a test binary from multiple object files. One way to see this is to apply the attached harmless patch and then run make subdirs=elf check (or whatever you do to run the test suite). Linking the test fails with: /home/fweimer/src/gnu/glibc/build/elf/tst-tlsalign-vars.o: In function `use_errno': /home/fweimer/src/gnu/glibc/git/elf/tst-tlsalign-vars.c:36: undefined reference to `__libc_errno' collect2: error: ld returned 1 exit status ../Rules:154: recipe for target '/home/fweimer/src/gnu/glibc/build/elf/tst-tlsalign-extern' failed The apparent cause is that the second object file for the test was built against internal glibc headers. The incorrect make rule for the elf/tst-tlsalign-vars.o target is created by o-iterator.mk. I have not been able to figure out which of the inclusions triggered this. Is there a quick fix for this? Thanks, Florian diff --git a/elf/tst-tlsalign-vars.c b/elf/tst-tlsalign-vars.c index 01b3501..840b079 100644 --- a/elf/tst-tlsalign-vars.c +++ b/elf/tst-tlsalign-vars.c @@ -2,6 +2,8 @@ purpose of the test that these definitions be in a separate translation unit from the code using the variables. */ +#include + __thread int tdata1 = 1; __thread int tdata2 __attribute__ ((aligned (0x10))) = 2; __thread int tdata3 __attribute__ ((aligned (0x1000))) = 4; @@ -26,3 +28,12 @@ unused (void) tbss2 = -5; tbss3 = -6; } + + +int +use_errno (int c) +{ + int e = errno; + errno = c; + return e; +}