From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 31523 invoked from network); 24 Jul 2020 14:34:11 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 24 Jul 2020 14:34:11 -0000 Received: (qmail 5730 invoked by uid 550); 24 Jul 2020 14:34:09 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 5712 invoked from network); 24 Jul 2020 14:34:08 -0000 Date: Fri, 24 Jul 2020 16:33:56 +0200 From: Szabolcs Nagy To: =?utf-8?B?w4lyaWNv?= Rolim Cc: musl@lists.openwall.com Message-ID: <20200724143356.GA879655@port70.net> Mail-Followup-To: =?utf-8?B?w4lyaWNv?= Rolim , musl@lists.openwall.com References: <20200723034433.24004-1-ericonr@disroot.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20200723034433.24004-1-ericonr@disroot.org> Subject: Re: [musl] [PATCH] Makefile: fix src/api compilation. * =C3=89rico Rolim [2020-07-23 00:44:33 -0300]: > Adding all .o files in src/api to the api/main.OBJ variable led to them > being included twice when linking api/main.exe, which failed with a > double definition of the main() function. This can be tested by removing > the failing definitions from unistdc.c and running make. thanks. > --- >=20 > This is a patch for libc-test. >=20 > Makefile | 1 - > 1 file changed, 1 deletion(-) >=20 > diff --git a/Makefile b/Makefile > index 86b6ff5..683c850 100644 > --- a/Makefile > +++ b/Makefile > @@ -113,7 +113,6 @@ $(B)/common/mtest.o: src/common/mtest.h > $(math.OBJS): src/common/mtest.h > =20 > $(B)/api/main.exe: $(api.OBJS) > -api/main.OBJS:=3D$(api.OBJS) > $(api.OBJS):$(B)/common/options.h > $(api.OBJS):CFLAGS+=3D-pedantic-errors -Werror -Wno-unused -D_XOPEN_SOUR= CE=3D700 this is not the right fix, the problem is that api/main.o is duplicated: once because of the %.exe: %.o rule and once in the api/main.OBJS. but all other api/*.o files are not duplicated and should be linked (so we link test all referenced symbols not just include header test). i'm considering doing $(B)/%.exe: $(B)/%.o - $(CC) $(LDFLAGS) $($*.LDFLAGS) -o $@ $< $($*.OBJS) $(LDLIBS) $($*.L= DLIBS) 2>$@.ld.err || echo BUILDERROR $@; cat $@.ld.err + $(CC) $(LDFLAGS) $($*.LDFLAGS) -o $@ $(sort $< $($*.OBJS)) $(LDLIBS= ) $($*.LDLIBS) 2>$@.ld.err || echo BUILDERROR $@; cat $@.ld.err (note: the make sort function removes duplicates)