Skip to content

Commit e31cdd2

Browse files
committed
[rust] switch to -C debuginfo=2
This is mainly for `pahole`, which requires type information that is only present with `-C debuginfo=2`: https://doc.rust-lang.org/rustc/codegen-options/index.html#debuginfo CE originally passed `-g` to `rustc` (which is an alias for `-C debuginfo=2`), but this was changed in c4411ff to `-C debuginfo=1` to work around rust-lang/rust#11906. However, this workaround never actually removed frame pointers, so switching back to `-C debuginfo=2` should not affect codegen for very old `rustc` versions. See also compiler-explorer#79.
1 parent a101e2d commit e31cdd2

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/compilers/rust.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ export class RustCompiler extends BaseCompiler {
247247
}
248248

249249
override optionsForFilter(filters: ParseFiltersAndOutputOptions, outputFilename: string, userOptions?: string[]) {
250-
let options = ['-C', 'debuginfo=1', '-o', this.filename(outputFilename)];
250+
let options = ['-C', 'debuginfo=2', '-o', this.filename(outputFilename)];
251251

252252
const userRequestedEmit = _.any(unwrap(userOptions), opt => opt.includes('--emit'));
253253
if (filters.binary) {

test/base-compiler-tests.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ describe('Rust overrides', () => {
856856
);
857857
expect(originalOptions).toEqual([
858858
'-C',
859-
'debuginfo=1',
859+
'debuginfo=2',
860860
'-o',
861861
'output.txt',
862862
'--crate-type',
@@ -870,6 +870,6 @@ describe('Rust overrides', () => {
870870
value: 'aarch64-linux-something',
871871
},
872872
]),
873-
).toEqual(['-C', 'debuginfo=1', '-o', 'output.txt', '--crate-type', 'bin', '-Clinker=/usr/aarch64/bin/gcc']);
873+
).toEqual(['-C', 'debuginfo=2', '-o', 'output.txt', '--crate-type', 'bin', '-Clinker=/usr/aarch64/bin/gcc']);
874874
});
875875
});

0 commit comments

Comments
 (0)