From owner-freebsd-ports-bugs@FreeBSD.ORG Sat Dec 5 08:50:01 2009 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 901461065670 for ; Sat, 5 Dec 2009 08:50:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 554508FC13 for ; Sat, 5 Dec 2009 08:50:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id nB58o0Eg081173 for ; Sat, 5 Dec 2009 08:50:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id nB58o05O081172; Sat, 5 Dec 2009 08:50:00 GMT (envelope-from gnats) Resent-Date: Sat, 5 Dec 2009 08:50:00 GMT Resent-Message-Id: <200912050850.nB58o05O081172@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Luigi Rizzo Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5572A1065670 for ; Sat, 5 Dec 2009 08:47:42 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id C68B28FC08 for ; Sat, 5 Dec 2009 08:47:41 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id C1EDC730DA; Sat, 5 Dec 2009 09:37:18 +0100 (CET) Message-Id: <20091205083718.C1EDC730DA@onelab2.iet.unipi.it> Date: Sat, 5 Dec 2009 09:37:18 +0100 (CET) From: Luigi Rizzo To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: rizzo@iet.unipi.it Subject: ports/141185: fix some tcc predefined macros, add -M support X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Luigi Rizzo List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 08:50:01 -0000 >Number: 141185 >Category: ports >Synopsis: fix some tcc predefined macros, add -M support >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sat Dec 05 08:50:00 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Luigi Rizzo >Release: FreeBSD 8.0 >Organization: Univ. Pisa >Environment: n.a. >Description: The attached files do the following 1. a small fix to the existing patch-libtcc.c which removes the predefined __INTEL_COMPILER__ (which was bringing in too many undesired features) and instead defines the macros __aligned(x), __packed and __CC_SUPPORTS___INLINE which permit correct compilation of our code. I am including the whole patch-libtcc.c for convenience 2. a new patch-z1-mode_m which implements the -M option (generate dependencies, used by mkdep) and also ignores -std=XXX options sometimes used in compilations. This has also been submitted upstream a few days ago. Already sent to the maintainer a few days ago, i will do the commit later this weekend if nobody has time to handle it. >How-To-Repeat: >Fix: bring these two files into ports/tcc/files, bump up portrevision -------------- patch-z1-mode_m ---------------- diff -ubwr ./libtcc.c ../../work.luigi/tcc-0.9.25/libtcc.c --- ./libtcc.c 2009-12-01 19:42:09.000000000 +0100 +++ ../../work.luigi/tcc-0.9.25/libtcc.c 2009-12-01 17:53:20.000000000 +0100 @@ -2119,7 +2119,9 @@ { char buf[1024]; - s->output_type = output_type; + s->output_type = output_type & 7; + s->mode_m = output_type & 8; + output_type = s->output_type; if (!s->nostdinc) { /* default include paths */ diff -ubwr ./tcc.c ../../work.luigi/tcc-0.9.25/tcc.c --- ./tcc.c 2009-05-18 16:27:06.000000000 +0200 +++ ../../work.luigi/tcc-0.9.25/tcc.c 2009-12-01 17:54:17.000000000 +0100 @@ -66,6 +66,7 @@ static int multiple_files; static int print_search_dirs; static int output_type; +static int mode_m; static int reloc_output; static const char *outfile; static int do_bench = 0; @@ -111,6 +112,8 @@ TCC_OPTION_w, TCC_OPTION_pipe, TCC_OPTION_E, + TCC_OPTION_M, /* mkdep */ + TCC_OPTION_std, /* -std= */ }; static const TCCOption tcc_options[] = { @@ -148,6 +150,8 @@ { "w", TCC_OPTION_w, 0 }, { "pipe", TCC_OPTION_pipe, 0}, { "E", TCC_OPTION_E, 0}, + { "M", TCC_OPTION_M, 0}, + { "std=", TCC_OPTION_std, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP }, { NULL }, }; @@ -399,6 +402,10 @@ } } break; + case TCC_OPTION_std: + break; /* ignore -std= */ + case TCC_OPTION_M: + mode_m = 8; /* FALLTHROUGH */ case TCC_OPTION_E: output_type = TCC_OUTPUT_PREPROCESS; break; @@ -502,7 +507,7 @@ start_time = getclock_us(); } - tcc_set_output_type(s, output_type); + tcc_set_output_type(s, output_type | mode_m); /* compile or add each files or library */ for(i = 0; i < nb_files && ret == 0; i++) { diff -ubwr ./tcc.h ../../work.luigi/tcc-0.9.25/tcc.h --- ./tcc.h 2009-05-18 16:27:06.000000000 +0200 +++ ../../work.luigi/tcc-0.9.25/tcc.h 2009-12-01 17:49:44.000000000 +0100 @@ -367,6 +367,7 @@ struct TCCState { int output_type; + int mode_m; /* tcc -M */ BufferedFile **include_stack_ptr; int *ifdef_stack_ptr; diff -ubwr ./tccpp.c ../../work.luigi/tcc-0.9.25/tccpp.c --- ./tccpp.c 2009-05-18 16:27:06.000000000 +0200 +++ ../../work.luigi/tcc-0.9.25/tccpp.c 2009-12-01 19:39:27.000000000 +0100 @@ -2897,6 +2897,7 @@ Sym *define_start; BufferedFile *file_ref; int token_seen, line_ref; + const char *base_file; preprocess_init(s1); define_start = define_stack; @@ -2908,6 +2909,12 @@ line_ref = 0; file_ref = NULL; + base_file = file->filename; + if (s1->mode_m) { + int l = strlen(base_file); + fprintf(s1->outfile, "%.*s.o: %s", l-2, base_file, base_file); + } + for (;;) { next(); if (tok == TOK_EOF) { @@ -2919,16 +2926,25 @@ token_seen = 0; } else if (!token_seen) { int d = file->line_num - line_ref; + if (s1->mode_m) { + if (file != file_ref && file->filename != base_file && + !search_cached_include(s1, '>', file->filename)) + fprintf(s1->outfile, " \\\n %s", file->filename); + } else { if (file != file_ref || d < 0 || d >= 8) fprintf(s1->outfile, "# %d \"%s\"\n", file->line_num, file->filename); else while (d) fputs("\n", s1->outfile), --d; + } line_ref = (file_ref = file)->line_num; token_seen = 1; } + if (!s1->mode_m) fputs(get_tok_str(tok, &tokc), s1->outfile); } + if (s1->mode_m) + fprintf(s1->outfile, "\n"); free_defines(define_start); return 0; } ----------------------------------------------------- ----- patch-libtcc.c --------------------------------- diff -ubwr ./libtcc.c ../../work.2/tcc-0.9.25/libtcc.c --- ./libtcc.c 2009-05-18 16:27:06.000000000 +0200 +++ ../../work.2/tcc-0.9.25/libtcc.c 2009-11-29 02:25:14.000000000 +0100 @@ -1509,10 +1509,18 @@ if (level == 0) { /* XXX: only support linux */ +#if defined(__FreeBSD__) + *paddr = uc->uc_mcontext.mc_rip; +#else *paddr = uc->uc_mcontext.gregs[REG_RIP]; +#endif return 0; } else { +#if defined(__FreeBSD__) + fp = uc->uc_mcontext.mc_rbp; +#else fp = uc->uc_mcontext.gregs[REG_RBP]; +#endif for(i=1;iRelease-Note: >Audit-Trail: >Unformatted: