Auto merge of #126534 - Rejyr:comment-section-migration, r= · rust-lang/rust@7fa8271 (original) (raw)

`@@ -2,8 +2,8 @@ use std::path::{Path, PathBuf};

`

2

2

``

3

3

`use crate::{env_var, Command};

`

4

4

``

5

``

`` -

/// Construct a new llvm-readobj invocation. This assumes that llvm-readobj is available

``

6

``

`` -

/// at $LLVM_BIN_DIR/llvm-readobj.

``

``

5

`` +

/// Construct a new llvm-readobj invocation with the GNU output style.

``

``

6

`` +

/// This assumes that llvm-readobj is available at $LLVM_BIN_DIR/llvm-readobj.

``

7

7

`pub fn llvm_readobj() -> LlvmReadobj {

`

8

8

`LlvmReadobj::new()

`

9

9

`}

`

`@@ -53,12 +53,23 @@ pub fn llvm_bin_dir() -> PathBuf {

`

53

53

`}

`

54

54

``

55

55

`impl LlvmReadobj {

`

56

``

`` -

/// Construct a new llvm-readobj invocation. This assumes that llvm-readobj is available

``

57

``

`` -

/// at $LLVM_BIN_DIR/llvm-readobj.

``

``

56

`` +

/// Construct a new llvm-readobj invocation with the GNU output style.

``

``

57

`` +

/// This assumes that llvm-readobj is available at $LLVM_BIN_DIR/llvm-readobj.

``

58

58

`pub fn new() -> Self {

`

59

59

`let llvm_readobj = llvm_bin_dir().join("llvm-readobj");

`

60

60

`let cmd = Command::new(llvm_readobj);

`

61

``

`-

Self { cmd }

`

``

61

`+

let mut readobj = Self { cmd };

`

``

62

`+

readobj.elf_output_style("GNU");

`

``

63

`+

readobj

`

``

64

`+

}

`

``

65

+

``

66

`+

/// Specify the format of the ELF information.

`

``

67

`+

///

`

``

68

`` +

/// Valid options are LLVM (default), GNU, and JSON.

``

``

69

`+

pub fn elf_output_style(&mut self, style: &str) -> &mut Self {

`

``

70

`+

self.cmd.arg("--elf-output-style");

`

``

71

`+

self.cmd.arg(style);

`

``

72

`+

self

`

62

73

`}

`

63

74

``

64

75

`/// Provide an input file.

`

`@@ -72,6 +83,13 @@ impl LlvmReadobj {

`

72

83

`self.cmd.arg("--file-header");

`

73

84

`self

`

74

85

`}

`

``

86

+

``

87

`+

/// Specify the section to display.

`

``

88

`+

pub fn section(&mut self, section: &str) -> &mut Self {

`

``

89

`+

self.cmd.arg("--string-dump");

`

``

90

`+

self.cmd.arg(section);

`

``

91

`+

self

`

``

92

`+

}

`

75

93

`}

`

76

94

``

77

95

`impl LlvmProfdata {

`