This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH/RFA] spec functions


In reference to:

[1]	http://gcc.gnu.org/ml/gcc/2002-10/msg01622.html
[2]	http://gcc.gnu.org/ml/gcc/2002-10/msg01624.html
[3]	http://gcc.gnu.org/ml/gcc-patches/2002-10/msg01847.html

This patch adds support for spec functions.  Spec functions have the
form:

	%:function(args)

ARGS are processed as a spec and split into an argument vector in
the normal fashion, and then passed to a function named by FUNCTION.
The function returns a malloc'd string which is in-turn processed
as a spec, or NULL.

There is one built-in function, which provides the functionality I
need (see [1]): "if-exists" checks to see if the file named in ARGS
exists, and if so, returns it, otherwise returns NULL.

	* gcc.c (The Specs Language): Document spec functions.
	(INIT_STATIC_SPEC_FUNCTION, static_spec_functions)
	(spec_functions, init_spec_functions, register_spec_function)
	(eval_spec_function, handle_spec_function)
	(if_exists_spec_function, alloc_args): New.
	(execute): Abort if processing_spec_function is true.
	(do_spec_1): Hand off spec to handle_spec_function if %:
	is encountered.  If processing_spec_function is true,
	end any pending argument when the end of the string is reached.
	(main): Call init_spec_functions.  Use alloc_args to allocate
	the initial argument vector.
	* gcc.h (register_spec_function): New prototype.

	* config/netbsd-elf.h (STARTFILE_SPEC): Add if-exists(crti%O%s).
	(ENDFILE_SPEC): Add if-exists(crtn%O%s).
	* config/alpha/netbsd.h (ENDFILE_SPEC): Likewise.

Now, my dilemma -- I was hoping for something simple enough that could go
into 3.3 at this stage (and the 3.2 branch) that would address the issue
outlined in my original message ([1]).  However, the result ended up being
a bit more complicated ... so I'm worried that, if approved, it would only
be for 3.4-b-i-b.

Bootstrapped/regtested on mainline with alpha-netbsd.

Bootstrap in-progress on 3.4-b-i-b with alpha-netbsd.

OK?  If so, where?

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>

Attachment: specs-patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]