diff --git a/avr-specs/avr-atmega1280.json b/avr-specs/avr-atmega1280.json index 5fbc931f40..1791c43f48 100644 --- a/avr-specs/avr-atmega1280.json +++ b/avr-specs/avr-atmega1280.json @@ -2,21 +2,37 @@ "arch": "avr", "atomic-cas": false, "cpu": "atmega1280", + "crt-objects-fallback": "false", "data-layout": "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8", "eh-frame-header": false, "exe-suffix": ".elf", "late-link-args": { - "gcc": [ + "gnu-cc": [ + "-lgcc" + ], + "gnu-lld-cc": [ "-lgcc" ] }, "linker": "avr-gcc", + "linker-flavor": "gnu-cc", "llvm-target": "avr-unknown-unknown", "max-atomic-width": 8, + "metadata": { + "description": null, + "host_tools": null, + "std": null, + "tier": null + }, "no-default-libraries": false, "pre-link-args": { - "gcc": [ - "-mmcu=atmega1280" + "gnu-cc": [ + "-mmcu=atmega1280", + "-Wl,--as-needed,--print-memory-usage" + ], + "gnu-lld-cc": [ + "-mmcu=atmega1280", + "-Wl,--as-needed,--print-memory-usage" ] }, "relocation-model": "static", diff --git a/avr-specs/avr-atmega1284p.json b/avr-specs/avr-atmega1284p.json index ee14275f29..38c916259f 100644 --- a/avr-specs/avr-atmega1284p.json +++ b/avr-specs/avr-atmega1284p.json @@ -2,21 +2,37 @@ "arch": "avr", "atomic-cas": false, "cpu": "atmega1284p", + "crt-objects-fallback": "false", "data-layout": "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8", "eh-frame-header": false, "exe-suffix": ".elf", "late-link-args": { - "gcc": [ + "gnu-cc": [ + "-lgcc" + ], + "gnu-lld-cc": [ "-lgcc" ] }, "linker": "avr-gcc", + "linker-flavor": "gnu-cc", "llvm-target": "avr-unknown-unknown", "max-atomic-width": 8, + "metadata": { + "description": null, + "host_tools": null, + "std": null, + "tier": null + }, "no-default-libraries": false, "pre-link-args": { - "gcc": [ - "-mmcu=atmega1284p" + "gnu-cc": [ + "-mmcu=atmega1284p", + "-Wl,--as-needed,--print-memory-usage" + ], + "gnu-lld-cc": [ + "-mmcu=atmega1284p", + "-Wl,--as-needed,--print-memory-usage" ] }, "relocation-model": "static", diff --git a/avr-specs/avr-atmega128a.json b/avr-specs/avr-atmega128a.json index 50a57bb539..2707faba03 100644 --- a/avr-specs/avr-atmega128a.json +++ b/avr-specs/avr-atmega128a.json @@ -2,21 +2,37 @@ "arch": "avr", "atomic-cas": false, "cpu": "atmega128a", + "crt-objects-fallback": "false", "data-layout": "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8", "eh-frame-header": false, "exe-suffix": ".elf", "late-link-args": { - "gcc": [ + "gnu-cc": [ + "-lgcc" + ], + "gnu-lld-cc": [ "-lgcc" ] }, "linker": "avr-gcc", + "linker-flavor": "gnu-cc", "llvm-target": "avr-unknown-unknown", "max-atomic-width": 8, + "metadata": { + "description": null, + "host_tools": null, + "std": null, + "tier": null + }, "no-default-libraries": false, "pre-link-args": { - "gcc": [ - "-mmcu=atmega128a" + "gnu-cc": [ + "-mmcu=atmega128a", + "-Wl,--as-needed,--print-memory-usage" + ], + "gnu-lld-cc": [ + "-mmcu=atmega128a", + "-Wl,--as-needed,--print-memory-usage" ] }, "relocation-model": "static", diff --git a/avr-specs/avr-atmega164pa.json b/avr-specs/avr-atmega164pa.json index a9b2da9c09..256a2222e6 100644 --- a/avr-specs/avr-atmega164pa.json +++ b/avr-specs/avr-atmega164pa.json @@ -2,21 +2,37 @@ "arch": "avr", "atomic-cas": false, "cpu": "atmega164pa", + "crt-objects-fallback": "false", "data-layout": "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8", "eh-frame-header": false, "exe-suffix": ".elf", "late-link-args": { - "gcc": [ + "gnu-cc": [ + "-lgcc" + ], + "gnu-lld-cc": [ "-lgcc" ] }, "linker": "avr-gcc", + "linker-flavor": "gnu-cc", "llvm-target": "avr-unknown-unknown", "max-atomic-width": 8, + "metadata": { + "description": null, + "host_tools": null, + "std": null, + "tier": null + }, "no-default-libraries": false, "pre-link-args": { - "gcc": [ - "-mmcu=atmega164pa" + "gnu-cc": [ + "-mmcu=atmega164pa", + "-Wl,--as-needed,--print-memory-usage" + ], + "gnu-lld-cc": [ + "-mmcu=atmega164pa", + "-Wl,--as-needed,--print-memory-usage" ] }, "relocation-model": "static", diff --git a/avr-specs/avr-atmega168.json b/avr-specs/avr-atmega168.json index baac32ae20..7fbd579a7b 100644 --- a/avr-specs/avr-atmega168.json +++ b/avr-specs/avr-atmega168.json @@ -2,21 +2,37 @@ "arch": "avr", "atomic-cas": false, "cpu": "atmega168", + "crt-objects-fallback": "false", "data-layout": "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8", "eh-frame-header": false, "exe-suffix": ".elf", "late-link-args": { - "gcc": [ + "gnu-cc": [ + "-lgcc" + ], + "gnu-lld-cc": [ "-lgcc" ] }, "linker": "avr-gcc", + "linker-flavor": "gnu-cc", "llvm-target": "avr-unknown-unknown", "max-atomic-width": 8, + "metadata": { + "description": null, + "host_tools": null, + "std": null, + "tier": null + }, "no-default-libraries": false, "pre-link-args": { - "gcc": [ - "-mmcu=atmega168" + "gnu-cc": [ + "-mmcu=atmega168", + "-Wl,--as-needed,--print-memory-usage" + ], + "gnu-lld-cc": [ + "-mmcu=atmega168", + "-Wl,--as-needed,--print-memory-usage" ] }, "relocation-model": "static", diff --git a/avr-specs/avr-atmega2560.json b/avr-specs/avr-atmega2560.json index 5d33bfe118..252b54f16a 100644 --- a/avr-specs/avr-atmega2560.json +++ b/avr-specs/avr-atmega2560.json @@ -2,21 +2,37 @@ "arch": "avr", "atomic-cas": false, "cpu": "atmega2560", + "crt-objects-fallback": "false", "data-layout": "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8", "eh-frame-header": false, "exe-suffix": ".elf", "late-link-args": { - "gcc": [ + "gnu-cc": [ + "-lgcc" + ], + "gnu-lld-cc": [ "-lgcc" ] }, "linker": "avr-gcc", + "linker-flavor": "gnu-cc", "llvm-target": "avr-unknown-unknown", "max-atomic-width": 8, + "metadata": { + "description": null, + "host_tools": null, + "std": null, + "tier": null + }, "no-default-libraries": false, "pre-link-args": { - "gcc": [ - "-mmcu=atmega2560" + "gnu-cc": [ + "-mmcu=atmega2560", + "-Wl,--as-needed,--print-memory-usage" + ], + "gnu-lld-cc": [ + "-mmcu=atmega2560", + "-Wl,--as-needed,--print-memory-usage" ] }, "relocation-model": "static", diff --git a/avr-specs/avr-atmega328.json b/avr-specs/avr-atmega328.json index d4be4aa1f0..77c64f366c 100644 --- a/avr-specs/avr-atmega328.json +++ b/avr-specs/avr-atmega328.json @@ -2,21 +2,37 @@ "arch": "avr", "atomic-cas": false, "cpu": "atmega328", + "crt-objects-fallback": "false", "data-layout": "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8", "eh-frame-header": false, "exe-suffix": ".elf", "late-link-args": { - "gcc": [ + "gnu-cc": [ + "-lgcc" + ], + "gnu-lld-cc": [ "-lgcc" ] }, "linker": "avr-gcc", + "linker-flavor": "gnu-cc", "llvm-target": "avr-unknown-unknown", "max-atomic-width": 8, + "metadata": { + "description": null, + "host_tools": null, + "std": null, + "tier": null + }, "no-default-libraries": false, "pre-link-args": { - "gcc": [ - "-mmcu=atmega328" + "gnu-cc": [ + "-mmcu=atmega328", + "-Wl,--as-needed,--print-memory-usage" + ], + "gnu-lld-cc": [ + "-mmcu=atmega328", + "-Wl,--as-needed,--print-memory-usage" ] }, "relocation-model": "static", diff --git a/avr-specs/avr-atmega328p.json b/avr-specs/avr-atmega328p.json index 7d7d82cc50..461daa7a67 100644 --- a/avr-specs/avr-atmega328p.json +++ b/avr-specs/avr-atmega328p.json @@ -2,21 +2,37 @@ "arch": "avr", "atomic-cas": false, "cpu": "atmega328p", + "crt-objects-fallback": "false", "data-layout": "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8", "eh-frame-header": false, "exe-suffix": ".elf", "late-link-args": { - "gcc": [ + "gnu-cc": [ + "-lgcc" + ], + "gnu-lld-cc": [ "-lgcc" ] }, "linker": "avr-gcc", + "linker-flavor": "gnu-cc", "llvm-target": "avr-unknown-unknown", "max-atomic-width": 8, + "metadata": { + "description": null, + "host_tools": null, + "std": null, + "tier": null + }, "no-default-libraries": false, "pre-link-args": { - "gcc": [ - "-mmcu=atmega328p" + "gnu-cc": [ + "-mmcu=atmega328p", + "-Wl,--as-needed,--print-memory-usage" + ], + "gnu-lld-cc": [ + "-mmcu=atmega328p", + "-Wl,--as-needed,--print-memory-usage" ] }, "relocation-model": "static", diff --git a/avr-specs/avr-atmega32a.json b/avr-specs/avr-atmega32a.json index 89bb33ac31..9ffda7dbdd 100644 --- a/avr-specs/avr-atmega32a.json +++ b/avr-specs/avr-atmega32a.json @@ -2,21 +2,37 @@ "arch": "avr", "atomic-cas": false, "cpu": "atmega32a", + "crt-objects-fallback": "false", "data-layout": "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8", "eh-frame-header": false, "exe-suffix": ".elf", "late-link-args": { - "gcc": [ + "gnu-cc": [ + "-lgcc" + ], + "gnu-lld-cc": [ "-lgcc" ] }, "linker": "avr-gcc", + "linker-flavor": "gnu-cc", "llvm-target": "avr-unknown-unknown", "max-atomic-width": 8, + "metadata": { + "description": null, + "host_tools": null, + "std": null, + "tier": null + }, "no-default-libraries": false, "pre-link-args": { - "gcc": [ - "-mmcu=atmega32a" + "gnu-cc": [ + "-mmcu=atmega32a", + "-Wl,--as-needed,--print-memory-usage" + ], + "gnu-lld-cc": [ + "-mmcu=atmega32a", + "-Wl,--as-needed,--print-memory-usage" ] }, "relocation-model": "static", diff --git a/avr-specs/avr-atmega32u4.json b/avr-specs/avr-atmega32u4.json index f078d2ebf5..a1632146b1 100644 --- a/avr-specs/avr-atmega32u4.json +++ b/avr-specs/avr-atmega32u4.json @@ -2,21 +2,37 @@ "arch": "avr", "atomic-cas": false, "cpu": "atmega32u4", + "crt-objects-fallback": "false", "data-layout": "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8", "eh-frame-header": false, "exe-suffix": ".elf", "late-link-args": { - "gcc": [ + "gnu-cc": [ + "-lgcc" + ], + "gnu-lld-cc": [ "-lgcc" ] }, "linker": "avr-gcc", + "linker-flavor": "gnu-cc", "llvm-target": "avr-unknown-unknown", "max-atomic-width": 8, + "metadata": { + "description": null, + "host_tools": null, + "std": null, + "tier": null + }, "no-default-libraries": false, "pre-link-args": { - "gcc": [ - "-mmcu=atmega32u4" + "gnu-cc": [ + "-mmcu=atmega32u4", + "-Wl,--as-needed,--print-memory-usage" + ], + "gnu-lld-cc": [ + "-mmcu=atmega32u4", + "-Wl,--as-needed,--print-memory-usage" ] }, "relocation-model": "static", diff --git a/avr-specs/avr-atmega48p.json b/avr-specs/avr-atmega48p.json index b13938d2eb..508677e347 100644 --- a/avr-specs/avr-atmega48p.json +++ b/avr-specs/avr-atmega48p.json @@ -2,21 +2,37 @@ "arch": "avr", "atomic-cas": false, "cpu": "atmega48p", + "crt-objects-fallback": "false", "data-layout": "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8", "eh-frame-header": false, "exe-suffix": ".elf", "late-link-args": { - "gcc": [ + "gnu-cc": [ + "-lgcc" + ], + "gnu-lld-cc": [ "-lgcc" ] }, "linker": "avr-gcc", + "linker-flavor": "gnu-cc", "llvm-target": "avr-unknown-unknown", "max-atomic-width": 8, + "metadata": { + "description": null, + "host_tools": null, + "std": null, + "tier": null + }, "no-default-libraries": false, "pre-link-args": { - "gcc": [ - "-mmcu=atmega48p" + "gnu-cc": [ + "-mmcu=atmega48p", + "-Wl,--as-needed,--print-memory-usage" + ], + "gnu-lld-cc": [ + "-mmcu=atmega48p", + "-Wl,--as-needed,--print-memory-usage" ] }, "relocation-model": "static", diff --git a/avr-specs/avr-atmega8.json b/avr-specs/avr-atmega8.json index a7be935873..b2c0c5cf08 100644 --- a/avr-specs/avr-atmega8.json +++ b/avr-specs/avr-atmega8.json @@ -2,21 +2,37 @@ "arch": "avr", "atomic-cas": false, "cpu": "atmega8", + "crt-objects-fallback": "false", "data-layout": "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8", "eh-frame-header": false, "exe-suffix": ".elf", "late-link-args": { - "gcc": [ + "gnu-cc": [ + "-lgcc" + ], + "gnu-lld-cc": [ "-lgcc" ] }, "linker": "avr-gcc", + "linker-flavor": "gnu-cc", "llvm-target": "avr-unknown-unknown", "max-atomic-width": 8, + "metadata": { + "description": null, + "host_tools": null, + "std": null, + "tier": null + }, "no-default-libraries": false, "pre-link-args": { - "gcc": [ - "-mmcu=atmega8" + "gnu-cc": [ + "-mmcu=atmega8", + "-Wl,--as-needed,--print-memory-usage" + ], + "gnu-lld-cc": [ + "-mmcu=atmega8", + "-Wl,--as-needed,--print-memory-usage" ] }, "relocation-model": "static", diff --git a/avr-specs/avr-attiny167.json b/avr-specs/avr-attiny167.json index 962df8af71..3cbdbe47d1 100644 --- a/avr-specs/avr-attiny167.json +++ b/avr-specs/avr-attiny167.json @@ -2,21 +2,37 @@ "arch": "avr", "atomic-cas": false, "cpu": "attiny167", + "crt-objects-fallback": "false", "data-layout": "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8", "eh-frame-header": false, "exe-suffix": ".elf", "late-link-args": { - "gcc": [ + "gnu-cc": [ + "-lgcc" + ], + "gnu-lld-cc": [ "-lgcc" ] }, "linker": "avr-gcc", + "linker-flavor": "gnu-cc", "llvm-target": "avr-unknown-unknown", "max-atomic-width": 8, + "metadata": { + "description": null, + "host_tools": null, + "std": null, + "tier": null + }, "no-default-libraries": false, "pre-link-args": { - "gcc": [ - "-mmcu=attiny167" + "gnu-cc": [ + "-mmcu=attiny167", + "-Wl,--as-needed,--print-memory-usage" + ], + "gnu-lld-cc": [ + "-mmcu=attiny167", + "-Wl,--as-needed,--print-memory-usage" ] }, "relocation-model": "static", diff --git a/avr-specs/avr-attiny2313.json b/avr-specs/avr-attiny2313.json index a5599e5362..aa8fffb4d5 100644 --- a/avr-specs/avr-attiny2313.json +++ b/avr-specs/avr-attiny2313.json @@ -2,21 +2,37 @@ "arch": "avr", "atomic-cas": false, "cpu": "attiny2313", + "crt-objects-fallback": "false", "data-layout": "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8", "eh-frame-header": false, "exe-suffix": ".elf", "late-link-args": { - "gcc": [ + "gnu-cc": [ + "-lgcc" + ], + "gnu-lld-cc": [ "-lgcc" ] }, "linker": "avr-gcc", + "linker-flavor": "gnu-cc", "llvm-target": "avr-unknown-unknown", "max-atomic-width": 8, + "metadata": { + "description": null, + "host_tools": null, + "std": null, + "tier": null + }, "no-default-libraries": false, "pre-link-args": { - "gcc": [ - "-mmcu=attiny2313" + "gnu-cc": [ + "-mmcu=attiny2313", + "-Wl,--as-needed,--print-memory-usage" + ], + "gnu-lld-cc": [ + "-mmcu=attiny2313", + "-Wl,--as-needed,--print-memory-usage" ] }, "relocation-model": "static", diff --git a/avr-specs/avr-attiny85.json b/avr-specs/avr-attiny85.json index 9d577dabed..d5334aa5de 100644 --- a/avr-specs/avr-attiny85.json +++ b/avr-specs/avr-attiny85.json @@ -2,21 +2,37 @@ "arch": "avr", "atomic-cas": false, "cpu": "attiny85", + "crt-objects-fallback": "false", "data-layout": "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8", "eh-frame-header": false, "exe-suffix": ".elf", "late-link-args": { - "gcc": [ + "gnu-cc": [ + "-lgcc" + ], + "gnu-lld-cc": [ "-lgcc" ] }, "linker": "avr-gcc", + "linker-flavor": "gnu-cc", "llvm-target": "avr-unknown-unknown", "max-atomic-width": 8, + "metadata": { + "description": null, + "host_tools": null, + "std": null, + "tier": null + }, "no-default-libraries": false, "pre-link-args": { - "gcc": [ - "-mmcu=attiny85" + "gnu-cc": [ + "-mmcu=attiny85", + "-Wl,--as-needed,--print-memory-usage" + ], + "gnu-lld-cc": [ + "-mmcu=attiny85", + "-Wl,--as-needed,--print-memory-usage" ] }, "relocation-model": "static", diff --git a/avr-specs/avr-attiny88.json b/avr-specs/avr-attiny88.json index 5ab1e58f93..1af5e8d338 100644 --- a/avr-specs/avr-attiny88.json +++ b/avr-specs/avr-attiny88.json @@ -2,21 +2,37 @@ "arch": "avr", "atomic-cas": false, "cpu": "attiny88", + "crt-objects-fallback": "false", "data-layout": "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8", "eh-frame-header": false, "exe-suffix": ".elf", "late-link-args": { - "gcc": [ + "gnu-cc": [ + "-lgcc" + ], + "gnu-lld-cc": [ "-lgcc" ] }, "linker": "avr-gcc", + "linker-flavor": "gnu-cc", "llvm-target": "avr-unknown-unknown", "max-atomic-width": 8, + "metadata": { + "description": null, + "host_tools": null, + "std": null, + "tier": null + }, "no-default-libraries": false, "pre-link-args": { - "gcc": [ - "-mmcu=attiny88" + "gnu-cc": [ + "-mmcu=attiny88", + "-Wl,--as-needed,--print-memory-usage" + ], + "gnu-lld-cc": [ + "-mmcu=attiny88", + "-Wl,--as-needed,--print-memory-usage" ] }, "relocation-model": "static", diff --git a/avr-specs/sync-from-upstream.py b/avr-specs/sync-from-upstream.py index 3d04e7471f..5e51075d98 100755 --- a/avr-specs/sync-from-upstream.py +++ b/avr-specs/sync-from-upstream.py @@ -95,7 +95,12 @@ def main(): spec = copy.deepcopy(upstream_spec) spec.update(COMMON) spec.update(settings) - spec["pre-link-args"]["gcc"][0] = f"-mmcu={settings['cpu']}" + + gnu_cc_pre_link_args = spec["pre-link-args"]["gnu-cc"] + gnu_lld_cc_pre_link_args = spec["pre-link-args"]["gnu-lld-cc"] + for compiler in (gnu_cc_pre_link_args, gnu_lld_cc_pre_link_args): + compiler[0] = f"-mmcu={settings['cpu']}" + compiler.append("-Wl,--as-needed,--print-memory-usage") with open(f"avr-specs/avr-{mcu}.json", "w") as f: json.dump(spec, f, sort_keys=True, indent=2)