Created an Orderfile go file for the build system.
In addition, I added a test file to check if flags are added and propagated correctly.

Test: mma build/soong
Output: #### build completed successfully (07:24 (mm:ss)) ####

For testing with an actual binary or shared library, steps are in this
README:
https://android.googlesource.com/toolchain/pgo-profiles/+/refs/heads/main/orderfiles/README.md

Change-Id: Idcf169156ef691bcacb8adc92828ef09450085f8
diff --git a/cc/cc.go b/cc/cc.go
index be67286..3b92696 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -74,6 +74,9 @@
 		ctx.TopDown("afdo_deps", afdoDepsMutator)
 		ctx.BottomUp("afdo", afdoMutator).Parallel()
 
+		ctx.TopDown("orderfile_deps", orderfileDepsMutator)
+		ctx.BottomUp("orderfile", orderfileMutator).Parallel()
+
 		ctx.TopDown("lto_deps", ltoDepsMutator)
 		ctx.BottomUp("lto", ltoMutator).Parallel()
 
@@ -526,6 +529,7 @@
 	getVndkExtendsModuleName() string
 	isAfdoCompile() bool
 	isPgoCompile() bool
+	isOrderfileCompile() bool
 	isCfi() bool
 	isFuzzer() bool
 	isNDKStubLibrary() bool
@@ -885,6 +889,7 @@
 	lto      *lto
 	afdo     *afdo
 	pgo      *pgo
+	orderfile *orderfile
 
 	library libraryInterface
 
@@ -1259,6 +1264,9 @@
 	if c.pgo != nil {
 		c.AddProperties(c.pgo.props()...)
 	}
+	if c.orderfile != nil {
+		c.AddProperties(c.orderfile.props()...)
+	}
 	for _, feature := range c.features {
 		c.AddProperties(feature.props()...)
 	}
@@ -1392,6 +1400,13 @@
 	return false
 }
 
+func (c *Module) isOrderfileCompile() bool {
+	if orderfile := c.orderfile; orderfile != nil {
+		return orderfile.Properties.OrderfileLoad
+	}
+	return false
+}
+
 func (c *Module) isCfi() bool {
 	if sanitize := c.sanitize; sanitize != nil {
 		return Bool(sanitize.Properties.SanitizeMutated.Cfi)
@@ -1697,6 +1712,10 @@
 	return ctx.mod.isPgoCompile()
 }
 
+func (ctx *moduleContextImpl) isOrderfileCompile() bool {
+	return ctx.mod.isOrderfileCompile()
+}
+
 func (ctx *moduleContextImpl) isCfi() bool {
 	return ctx.mod.isCfi()
 }
@@ -1806,6 +1825,7 @@
 	module.lto = &lto{}
 	module.afdo = &afdo{}
 	module.pgo = &pgo{}
+	module.orderfile = &orderfile{}
 	return module
 }
 
@@ -2234,6 +2254,9 @@
 	if c.pgo != nil {
 		flags = c.pgo.flags(ctx, flags)
 	}
+	if c.orderfile != nil {
+		flags = c.orderfile.flags(ctx, flags)
+	}
 	for _, feature := range c.features {
 		flags = feature.flags(ctx, flags)
 	}
@@ -2376,6 +2399,9 @@
 	if c.lto != nil {
 		c.lto.begin(ctx)
 	}
+	if c.orderfile != nil {
+		c.orderfile.begin(ctx)
+	}
 	if c.pgo != nil {
 		c.pgo.begin(ctx)
 	}
@@ -4284,6 +4310,7 @@
 		&LTOProperties{},
 		&AfdoProperties{},
 		&PgoProperties{},
+		&OrderfileProperties{},
 		&android.ProtoProperties{},
 		// RustBindgenProperties is included here so that cc_defaults can be used for rust_bindgen modules.
 		&RustBindgenClangProperties{},