shithub: mc

Download patch

ref: 28cea7b851f71fe07e4491dc8ec6eeee2e1c8011
parent: 83eef0360e0c66ff50d2874e1829470101e2afab
author: Mura Li <[email protected]>
date: Tue Nov 28 12:54:06 EST 2017

Generate per-function ELF sections to enable --gc-sections

Use diffirent directive syntax for ELF and Mach-O respectively

--- a/6/gengas.c
+++ b/6/gengas.c
@@ -244,6 +244,17 @@
 {
 	size_t i, j;
 
+	switch (asmsyntax) {
+	case Gnugaself:
+		fprintf(fd, ".section .text.%s,\"ax\",@progbits\n", fn->name);
+		fprintf(fd, ".type %s, @function\n", fn->name);
+		break;
+	case Gnugasmacho:
+		fprintf(fd, ".section __TEXT,__text,regular\n");
+		break;
+	default:
+		die("unknown target");  break;
+	}
 	if (fn->isexport)
 		fprintf(fd, ".globl %s\n", fn->name);
 	fprintf(fd, "%s:\n", fn->name);